本文整理汇总了PHP中EB::loadLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP EB::loadLanguages方法的具体用法?PHP EB::loadLanguages怎么用?PHP EB::loadLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EB
的用法示例。
在下文中一共展示了EB::loadLanguages方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($message, $type = EASYBLOG_MSG_ERROR, $silent = false, $customErrorCode = null)
{
// EASYBLOG_MSG_ERROR
if (is_string($type)) {
$code = isset(self::$codeMap[$type]) ? self::$codeMap[$type] : null;
$this->type = $type;
// array(400, EASYBLOG_MSG_ERROR)
} else {
if (is_array($type)) {
$code = $type[0];
$this->type = $code[1];
}
}
// We're riding the third param. Blame strict standards.
if (is_bool($silent)) {
$previous = null;
} else {
$silent = false;
$previous = $silent;
}
$this->customErrorCode = $customErrorCode;
// Load front end language
EB::loadLanguages(JPATH_ADMINISTRATOR);
EB::loadLanguages(JPATH_ROOT);
// Translate message so a user can pass in the language string directly.
$message = JText::_($message);
// Construct exception so we can retrieve the rest of the properties
parent::__construct($message, $code, $previous);
// Add to our global list of exceptions
self::$exceptions[] = $this;
}
示例2: getLanguage
/**
* Translates text
*
* @since 4.0
* @access public
* @param string The language string to translate
* @return string
*/
public function getLanguage($constant)
{
// Load languages on the site
EB::loadLanguages();
$string = JText::_(strtoupper($constant));
return $string;
}
示例3: display
/**
* Display a list of email activities
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function display($tpl = null)
{
$this->checkAccess('easyblog.manage.mail');
$layout = $this->getLayout();
if (method_exists($this, $layout)) {
return $this->{$layout}();
}
// Load frontend language file
EB::loadLanguages();
// Set heading
$this->setHeading('COM_EASYBLOG_TITLE_MAIL_ACTIVITIES', '', 'fa-send-o');
$filter_state = $this->app->getUserStateFromRequest('com_easyblog.spools.filter_state', 'filter_state', '*', 'word');
$search = $this->app->getUserStateFromRequest('com_easyblog.spools.search', 'search', '', 'string');
$search = trim(JString::strtolower($search));
$order = $this->app->getUserStateFromRequest('com_easyblog.spools.filter_order', 'filter_order', 'created', 'cmd');
$orderDirection = $this->app->getUserStateFromRequest('com_easyblog.spools.filter_order_Dir', 'filter_order_Dir', 'asc', 'word');
$mails = $this->get('Data');
$pagination = $this->get('Pagination');
$this->set('mails', $mails);
$this->set('pagination', $pagination);
$this->set('state', JHTML::_('grid.state', $filter_state, JText::_('COM_EASYBLOG_SENT'), JText::_('COM_EASYBLOG_PENDING')));
$this->set('search', $search);
$this->set('order', $order);
$this->set('orderDirection', $orderDirection);
parent::display('spools/default');
}
示例4: __construct
public function __construct()
{
// Load language file
EB::loadLanguages();
$this->app = JFactory::getApplication();
$this->exists = $this->exists();
parent::__construct();
}
示例5: __construct
public function __construct()
{
EB::loadLanguages(JPATH_ADMINISTRATOR);
// Load our own js library
EB::init('admin');
// $this->doc = JFactory::getDocument();
// $this->doc->addStylesheet(rtrim(JURI::base(), '/') . '/components/com_easyblog/themes/default/css/elements.css');
JHTML::_('behavior.modal');
$this->app = JFactory::getApplication();
}
示例6: store
public function store($updateNulls = false)
{
$config = EasyBlogHelper::getConfig();
$maxTimes = $config->get('main_reporting_maxip');
// @task: Run some checks on reported items and
if ($maxTimes > 0) {
$db = EasyBlogHelper::db();
$query = 'SELECT COUNT(1) FROM ' . $db->nameQuote($this->_tbl) . ' ' . 'WHERE ' . $db->nameQuote('obj_id') . ' = ' . $db->Quote($this->obj_id) . ' ' . 'AND ' . $db->nameQuote('obj_type') . ' = ' . $db->Quote($this->obj_type) . ' ' . 'AND ' . $db->nameQuote('ip') . ' = ' . $db->Quote($this->ip);
$db->setQuery($query);
$total = (int) $db->loadResult();
if ($total >= $maxTimes) {
EB::loadLanguages();
JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
$this->setError(JText::_('COM_EASYBLOG_REPORT_ALREADY_REPORTED'));
return false;
}
}
// Assign badge for users that report blog post.
// Only give points if the viewer is viewing another person's blog post.
EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.report', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_REPORT_BLOG'));
return parent::store();
}
示例7: templates
/**
* Displays a list of templates
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function templates()
{
// Ensure the user has access to manage templates
$this->checkAccess('easyblog.manage.templates');
$this->setHeading('COM_EASYBLOG_BLOGS_POST_TEMPLATES_TITLE', '', 'fa-clipboard');
EB::loadLanguages();
$model = EB::model('Templates');
$rows = $model->getItems();
$pagination = $model->getPagination();
$templates = array();
foreach ($rows as $row) {
$template = EB::table('PostTemplate');
$template->bind($row);
$templates[] = $template;
}
$this->set('templates', $templates);
$this->set('pagination', $pagination);
parent::display('blogs/templates');
}
示例8: EasyBlogParseRoute
function EasyBlogParseRoute(&$segments)
{
// Load site's language file
EB::loadLanguages();
$vars = array();
$active = JFactory::getApplication()->getMenu()->getActive();
$config = EB::config();
// We know that the view=categories&layout=listings&id=xxx because there's only 1 segment
// and the active menu is view=categories
if (isset($active) && $active->query['view'] == 'categories' && !isset($active->query['layout']) && count($segments) == 1) {
$vars['view'] = 'categories';
$vars['layout'] = 'listings';
$category = EB::table('Category');
$category->load(array('alias' => $segments[0]));
// if still can't get the correct category id try this
if (!$category->id) {
$categoryAlias = $segments[0];
$categoryAlias = str_replace(':', '-', $categoryAlias);
$category->load(array('alias' => $categoryAlias));
}
$vars['id'] = $category->id;
return $vars;
}
// RSD View
if (isset($segments[0]) && $segments[0] == 'rsd') {
$vars['view'] = 'rsd';
return $vars;
}
// Feed view
if (isset($segments[1])) {
if ($segments[1] == 'rss' || $segments[1] == 'atom') {
$vars['view'] = $segments[0];
unset($segments);
return $vars;
}
}
// If user chooses to use the simple sef setup, we need to add the proper view
if ($config->get('main_sef') == 'simple' && count($segments) == 1) {
$files = JFolder::folders(JPATH_ROOT . '/components/com_easyblog/views');
$views = array();
foreach ($files as $file) {
$views[] = EBR::translate($file);
}
if (!in_array($segments[0], $views)) {
array_unshift($segments, EBR::translate('entry'));
}
}
// Composer view
if (isset($segments[0]) && $segments[0] == EBR::translate('composer')) {
$vars['view'] = 'composer';
}
// Entry view
if (isset($segments[0]) && $segments[0] == EBR::translate('entry')) {
$count = count($segments);
$entryId = '';
// perform manual split on the string.
if ($config->get('main_sef_unicode')) {
$permalinkSegment = $segments[$count - 1];
$permalinkArr = explode(':', $permalinkSegment);
$entryId = $permalinkArr[0];
} else {
$index = $count - 1;
$alias = $segments[$index];
$post = EB::post();
$post->loadByPermalink($alias);
if ($post) {
$entryId = $post->id;
}
}
if ($entryId) {
$vars['id'] = $entryId;
}
$vars['view'] = 'entry';
}
// Calendar view
if (isset($segments[0]) && $segments[0] == EBR::translate('calendar')) {
$vars['view'] = 'calendar';
$count = count($segments);
$totalSegments = $count - 1;
if ($totalSegments >= 1) {
// First segment is always the year
if (isset($segments[1])) {
$vars['year'] = $segments[1];
}
// Second segment is always the month
if (isset($segments[2])) {
$vars['month'] = $segments[2];
}
// Third segment is always the day
if (isset($segments[3])) {
$vars['day'] = $segments[3];
}
}
}
if (isset($segments[0]) && $segments[0] == EBR::translate('archive')) {
$vars['view'] = 'archive';
$count = count($segments);
$totalSegments = $count - 1;
if ($totalSegments >= 1) {
$indexSegment = 1;
//.........这里部分代码省略.........
示例9: defined
* @copyright Copyright (C) 2010 - 2015 Stack Ideas Sdn Bhd. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* EasyBlog is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
// Require main framework for EasyBlog
require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php';
// Looks like we need to manually include the router
require_once __DIR__ . '/router.php';
// Process ajax calls
EB::ajax()->process();
// Start profiling
EB::profiler()->start();
// Load extension languages
EB::loadLanguages();
// Include the main controller
require_once dirname(__FILE__) . '/controllers/controller.php';
// Execute services
EB::loadServices();
// Get controller name if specified
$app = JFactory::getApplication();
$controllerName = $app->input->get('controller', 'easyblog', 'cmd');
// Create controller
$controller = JControllerLegacy::getInstance('easyblog');
$task = $app->input->get('task');
$controller->execute($task);
$controller->redirect();
示例10: subscribe
/**
* Allows caller to send a subscribe IPN to mailchimp
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function subscribe($email, $firstName, $lastName = '')
{
EB::loadLanguages();
if (!function_exists('curl_init')) {
return false;
}
if (!$this->config->get('subscription_mailchimp')) {
return false;
}
// Get the list id
$listId = $this->config->get('subscription_mailchimp_listid');
if (!$listId) {
return false;
}
$firstName = urlencode($firstName);
$lastName = urlencode($lastName);
// Determines if we should send the welcome email
$sendWelcome = $this->config->get('subscription_mailchimp_welcome') ? 'true' : 'false';
$url = $this->url . '?method=listSubscribe';
$url = $url . '&apikey=' . $this->key;
$url = $url . '&id=' . $listId;
$url = $url . '&output=json';
$url = $url . '&email_address=' . $email;
$url = $url . '&merge_vars[FNAME]=' . $firstName;
$url = $url . '&merge_vars[LNAME]=' . $lastName;
$url = $url . '&merge_vars[email_type]=html';
$url = $url . '&merge_vars[send_welcome]=' . $sendWelcome;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
curl_close($ch);
return true;
}
示例11: store
/**
* Override parent's implementation of store
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function store($updateNulls = false)
{
if (!$this->created) {
$this->created = EB::date()->toSql();
}
// Generate an alias if alias is empty
if (!$this->alias) {
$this->alias = EBR::normalizePermalink($this->title);
}
$my = JFactory::getUser();
// Add point integrations for new categories
if ($this->id == 0 && $my->id > 0) {
EB::loadLanguages();
// Integrations with EasyDiscuss
EB::easydiscuss()->log('easyblog.new.category', $my->id, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_NEW_CATEGORY', $this->title));
EB::easydiscuss()->addPoint('easyblog.new.category', $my->id);
EB::easydiscuss()->addBadge('easyblog.new.category', $my->id);
// AlphaUserPoints
EB::aup()->assign('plgaup_easyblog_add_category', '', 'easyblog_add_category_' . $this->id, JText::sprintf('COM_EASYBLOG_AUP_NEW_CATEGORY_CREATED', $this->title));
// JomSocial integrations
EB::jomsocial()->assignPoints('com_easyblog.category.add', $my->id);
// Assign EasySocial points
EB::easysocial()->assignPoints('category.create', $my->id);
}
// Figure out the proper nested set model
if ($this->id == 0 && $this->lft == 0) {
// No parent id, we use the current lft,rgt
if ($this->parent_id) {
$left = $this->getLeft($this->parent_id);
$this->lft = $left;
$this->rgt = $this->lft + 1;
// Update parent's right
$this->updateRight($left);
$this->updateLeft($left);
} else {
$this->lft = $this->getLeft() + 1;
$this->rgt = $this->lft + 1;
}
}
if ($this->id == 0) {
// new cats. we need to store the ordering.
$this->ordering = $this->getOrdering($this->parent_id) + 1;
}
$isNew = !$this->id ? true : false;
$state = parent::store();
return $state;
}
示例12: getTemplateContents
/**
* Retrieves the template contents.
*
**/
public function getTemplateContents($template, $data)
{
// Load front end's language file.
EB::loadLanguages();
// We only want to show unsubscribe link when the user is really subscribed to the blogs
if (!isset($data['unsubscribeLink'])) {
$data['unsubscribeLink'] = '';
}
$config = EasyBlogHelper::getConfig();
// @rule: Detect what type of emails that we should process.
$type = $config->get('main_mailqueuehtmlformat') ? 'html' : 'text';
$theme = EB::template();
// Fetch the child theme first.
foreach ($data as $key => $val) {
$theme->set($key, $val);
}
$namespace = 'site/emails/html/' . $template;
$contents = $theme->output($namespace);
// @rule: Now we need to process the main template holder.
$title = $config->get('notifications_title');
$theme->set('unsubscribe', $data['unsubscribeLink']);
$theme->set('emailTitle', $title);
$theme->set('contents', $contents);
$output = $theme->output('site/emails/html/template');
return $output;
}
示例13: store
/**
* Stores the blog post
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function store($log = true)
{
// Load language file from the front end.
EB::loadLanguages();
// Whenever the blog post is stored, we need to clear the cache.
$cache = EB::getCache();
$cache->clean('com_easyblog');
$cache->clean('_system');
$cache->clean('page');
// Get easyblog's config
$config = EB::config();
// Get the current logged in user.
$my = JFactory::getUser();
// @rule: no guest allowed to create blog post.
if (JRequest::getVar('task', '') != 'cron' && JRequest::getVar('task', '') != 'cronfeed' && empty($my->id)) {
$this->setError(JText::_('COM_EASYBLOG_YOU_ARE_NOT_LOGIN'));
return false;
}
$under_approval = false;
if (isset($this->under_approval)) {
$under_approval = true;
// now we need to reset this variable from the blog object.
unset($this->under_approval);
}
// @trigger: onBeforeSave
$this->triggerBeforeSave();
// @rule: Determine if this record is new or not.
if (empty($this->isnew)) {
$isNew = empty($this->id) ? true : false;
} else {
$isNew = true;
}
// @rule: Get the rulesets for this user.
$acl = EB::acl();
// @rule: Process badword filters for title here.
$blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->title);
if ($blockedWord !== false) {
$this->setError(JText::sprintf('COM_EASYBLOG_BLOG_TITLE_CONTAIN_BLOCKED_WORDS', $blockedWord));
return false;
}
// @rule: Check for minimum words in the content if required.
if ($config->get('main_post_min') && $this->_checkLength) {
$minimum = $config->get('main_post_length');
$total = JString::strlen(strip_tags($this->intro . $this->content));
if ($total < $minimum) {
$this->setError(JText::sprintf('COM_EASYBLOG_CONTENT_LESS_THAN_MIN_LENGTH', $minimum));
return false;
}
}
// @rule: Check for invalid title
if (empty($this->title) || $this->title == JText::_('COM_EASYBLOG_DASHBOARD_WRITE_DEFAULT_TITLE')) {
$this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_EMPTY_TITLE_ERROR'));
return false;
}
// @rule: For edited blogs, ensure that they have permissions to edit it.
if (!$isNew && $this->created_by != JFactory::getUser()->id && !EasyBlogHelper::isSiteAdmin() && !$acl->get('moderate_entry')) {
// @task: Only throw error when this blog post is not a team blog post and it's not owned by the current logged in user.
$model = EB::model('TeamBlogs');
$contribution = $model->getBlogContributed($this->id);
if (!$contribution || !$model->checkIsTeamAdmin(JFactory::getUser()->id, $contribution->team_id)) {
$this->setError(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_EDIT_BLOG'));
return false;
}
}
// Filter / strip contents that are not allowed
$filterTags = EasyBlogHelper::getHelper('Acl')->getFilterTags();
$filterAttributes = EasyBlogHelper::getHelper('Acl')->getFilterAttributes();
// @rule: Apply filtering on contents
jimport('joomla.filter.filterinput');
$inputFilter = JFilterInput::getInstance($filterTags, $filterAttributes, 1, 1, 0);
$inputFilter->tagBlacklist = $filterTags;
$inputFilter->attrBlacklist = $filterAttributes;
$filterTpe = EasyBlogHelper::getJoomlaVersion() >= '1.6' ? 'html' : 'string';
if (count($filterTags) > 0 && !empty($filterTags[0]) || count($filterAttributes) > 0 && !empty($filterAttributes[0])) {
$this->intro = $inputFilter->clean($this->intro, $filterTpe);
$this->content = $inputFilter->clean($this->content, $filterTpe);
}
// @rule: Process badword filters for content here.
$blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->intro . $this->content);
if ($blockedWord !== false) {
$this->setError(JText::sprintf('COM_EASYBLOG_BLOG_POST_CONTAIN_BLOCKED_WORDS', $blockedWord));
return false;
}
// @rule: Test for the empty-ness
if (empty($this->intro) && empty($this->content)) {
$this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_CONTENT_ERROR'));
}
$state = parent::store();
$source = JRequest::getVar('blog_contribute_source', 'easyblog');
// if this is blog edit, then we should see the column isnew to determine
// whether the post is really new or not.
if (!$isNew) {
//.........这里部分代码省略.........
示例14: getBiography
/**
* Retrieves the biography from the specific blogger
*
* @since 4.0
* @access public
* @param boolean True to retrieve raw data
* @return string
*/
public function getBiography($raw = false)
{
static $items = array();
if (!isset($items[$this->id])) {
EB::loadLanguages();
$biography = $raw ? $this->biography : nl2br($this->biography);
if (!$biography) {
$biography = JText::sprintf('COM_EASYBLOG_BIOGRAPHY_NOT_SET', $this->getName());
}
$items[$this->id] = $biography;
}
return $items[$this->id];
}
示例15: __construct
public function __construct()
{
EB::loadLanguages();
}