本文整理汇总了PHP中EB::config方法的典型用法代码示例。如果您正苦于以下问题:PHP EB::config方法的具体用法?PHP EB::config怎么用?PHP EB::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EB
的用法示例。
在下文中一共展示了EB::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->my = JFactory::getUser();
$this->config = EB::config();
$this->app = JFactory::getApplication();
$this->input = EB::request();
}
示例2: store
/**
* Saves a new rating item
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function store($updateNulls = false)
{
$config = EB::config();
$state = parent::store();
if ($this->type == 'entry' && $this->created_by) {
// Load the post item
$post = EB::post($this->uid);
// Get the author of the post
$author = $post->getAuthor();
// Get the link to the post
$link = $post->getExternalPermalink();
// Notify EasySocial users that someone rated their post
EB::easysocial()->notifySubscribers($post, 'ratings.add');
// Assign EasySocial points
EB::easysocial()->assignPoints('blog.rate');
EB::easysocial()->assignPoints('blog.rated', $post->created_by);
// Assign badge for users that report blog post.
// Only give points if the viewer is viewing another person's blog post.
EB::easysocial()->assignBadge('blog.rate', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_RATED_BLOG'));
// Assign points for AUP
EB::aup()->assign('plgaup_easyblog_rate_blog', '', 'easyblog_rating', JText::_('COM_EASYBLOG_AUP_BLOG_RATED'));
// Add notifications for EasyDiscuss
// Add notifications
// EB::jomsocial()->addNotification(JText::sprintf('COM_EASYBLOG_JOMSOCIAL_NOTIFICATIONS_NEW_RATING_FOR_YOUR_BLOG', str_replace("administrator/","", $author->getProfileLink()), $author->getName() , $link , $blog->title), 'easyblog_new_blog' , $target , $author , $link);
// Add notifications for easydiscuss
if ($config->get('integrations_jomsocial_notification_rating')) {
$target = array($post->created_by);
EB::easydiscuss()->addNotification($post, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_NOTIFICATIONS_NEW_RATING_FOR_YOUR_BLOG', $author->getName(), $post->title), EBLOG_NOTIFICATIONS_TYPE_RATING, array($post->created_by), $this->created_by, $link);
}
}
return $state;
}
示例3: display
/**
* Default user listings page.
*
* @since 1.0
* @access public
* @param null
* @return null
*/
public function display($tpl = null)
{
$this->checkAccess('easyblog.manage.languages');
$this->setHeading('COM_EASYBLOG_HEADING_LANGUAGES', '', 'fa-language');
// Get configuration
$config = EB::config();
// Get the api key from the config
$key = $config->get('main_apikey');
// Add Joomla buttons
JToolbarHelper::title(JText::_('COM_EASYBLOG_HEADING_LANGUAGES'));
if (!$key) {
JToolbarHelper::custom('savekey', 'save', '', JText::_('COM_EASYBLOG_SAVE_APIKEY_BUTTON'), false);
$return = base64_encode('index.php?option=com_easyblog&view=languages');
$this->set('return', $return);
return parent::display('languages/key');
}
JToolbarHelper::custom('languages.discover', 'refresh', '', JText::_('COM_EASYBLOG_TOOLBAR_BUTTON_FIND_UPDATES'), false);
JToolbarHelper::custom('languages.install', 'upload', '', JText::_('COM_EASYBLOG_TOOLBAR_BUTTON_INSTALL_OR_UPDATE'));
JToolbarHelper::custom('languages.purge', 'purge', '', JText::_('COM_EASYBLOG_TOOLBAR_BUTTON_PURGE_CACHE'), false);
// Get the languages that are already stored on the db
$model = EB::model('Languages');
$initialized = $model->initialized();
if (!$initialized) {
$this->set('key', $key);
return parent::display('languages/initialize');
}
// Get languages
$languages = $model->getLanguages();
foreach ($languages as &$language) {
$translators = json_decode($language->translator);
$language->translator = $translators;
}
$this->set("languages", $languages);
parent::display('languages/default');
}
示例4: __construct
public function __construct()
{
$this->config = EB::config();
$this->doc = JFactory::getDocument();
// If environment is set to production, change to static.
$environment = $this->config->get('easyblog_environment');
if ($environment == 'production') {
$environment = 'static';
}
$this->namespace = 'EASYBLOG';
$this->shortName = 'eb';
$this->environment = $environment;
$this->mode = $this->config->get('easyblog_mode');
$this->version = (string) EB::getLocalVersion();
$this->baseUrl = EB::getBaseUrl();
$this->token = EB::getToken();
$this->inline = $this->config->get('inline_configuration');
$this->enableCdn = $this->config->get('enable_cdn');
$this->ajaxUrl = JURI::base() . '?option=com_easyblog';
// If we should use http://site.com/index.php for the ajax calls, we need to append it here
if ($this->config->get('ajax_use_index')) {
$this->ajaxUrl = JURI::base() . 'index.php?option=com_easyblog';
}
parent::__construct();
}
示例5: __construct
public function __construct($location, $name = null, $useOverride = false)
{
static $defaultWorkspace;
$this->app = JFactory::getApplication();
$this->input = EB::request();
$this->config = EB::config();
$this->doc = JFactory::getDocument();
// Determines if this is a module section
if ($location == 'module') {
$this->isModule = true;
$location = 'site';
}
if (!isset($defaultWorkspace)) {
$override = $this->app->getTemplate();
$defaultWorkspace = array('site' => strtolower($this->config->get('theme_site')), 'site_base' => strtolower($this->config->get('theme_site_base')), 'admin' => strtolower($this->config->get('theme_admin')), 'admin_base' => strtolower($this->config->get('theme_admin_base')), 'module' => null, 'override' => $override);
}
$this->workspace = $defaultWorkspace;
$workspace = array();
// Internally, override is a location.
if ($useOverride) {
$location = 'override';
}
// For specific template, else default template will be used.
if (!empty($name)) {
$workspace[$location] = $name;
}
// Because we can't do late static binding on PHP < 5.3.
// Used by $this->override() method.
$this->class = __CLASS__;
parent::__construct('EASYBLOG', $workspace, $location);
}
示例6: __construct
public function __construct()
{
$config = EB::config();
$this->config = $config;
$this->url = $config->get('subscription_sendy_url');
$this->id = $config->get('subscription_sendy_listid');
}
示例7: addBlogSubscription
/**
* Add / Update an existing blog subscription
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function addBlogSubscription($blogId, $email, $userId = '0', $fullname = '')
{
$config = EB::config();
$acl = EB::acl();
$my = JFactory::getUser();
// If user is not allowed here, skip this
if (!$acl->get('allow_subscription') || !$my->id && !$config->get('main_allowguestsubscribe')) {
return false;
}
// Check if user already has an existing subscription
$subscriptionId = $this->isBlogSubscribed($blogId, $email, $userId);
// Get the subscriber object
$subscriber = EB::table('Subscriptions');
// Try to load the subscription data
if ($subscriptionId) {
$subscriber->load($subscriptionId);
}
$subscriber->utype = EBLOG_SUBSCRIPTION_ENTRY;
$subscriber->uid = $blogId;
// Set the email address
$subscriber->email = $email;
// Set the subscribers name
$subscriber->fullname = $fullname;
// Set the creation date
$date = EB::date();
$subscriber->created = $date->toMySQL();
// Try to save the new subscription
$state = $subscriber->store();
if (!$state) {
return false;
}
return $subscriber;
}
示例8: voters
/**
* Displays a list of voters
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function voters()
{
// Get the composite keys
$uid = $this->input->get('uid', 0, 'int');
$type = $this->input->get('type', '', 'cmd');
// Get maximum number of voters to show up in the dialog.
$limit = EB::config()->get('main_ratings_display_raters_max');
// Get the ratings
$model = EB::model('Ratings');
$votes = $model->getRatingUsers($uid, $type, $limit);
// Determines the total number of guest votes
$totalGuests = 0;
// Format the votes
if ($votes) {
foreach ($votes as &$vote) {
$vote->user = false;
if ($vote->created_by) {
$user = EB::user($vote->created_by);
$vote->user = $user;
} else {
$totalGuests += 1;
}
}
}
$theme = EB::template();
$theme->set('totalGuests', $totalGuests);
$theme->set('votes', $votes);
$output = $theme->output('site/ratings/dialog.voters');
return $this->ajax->resolve($output);
}
示例9: discover
/**
* Discover new languages
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function discover()
{
$config = EB::config();
$key = $config->get('main_apikey');
$connector = EB::connector();
$connector->addUrl(EBLOG_LANGUAGES_SERVER);
$connector->addQuery('key', $key);
$connector->setMethod('POST');
$connector->execute();
$contents = $connector->getResult(EBLOG_LANGUAGES_SERVER);
if (!$contents) {
$result = new stdClass();
$result->message = 'No language found';
return $result;
}
// Decode the result
$result = json_decode($contents);
if ($result->code != 200) {
$return = base64_encode('index.php?option=com_easyblog&view=languages');
return $result->message;
}
foreach ($result->languages as $language) {
// If it does, load it instead of overwriting it.
$table = EB::table('Language');
$exists = $table->load(array('locale' => $language->locale));
// We do not want to bind the id
unset($language->id);
// Since this is the retrieval, the state should always be disabled
if (!$exists) {
$table->state = EBLOG_LANGUAGES_NOT_INSTALLED;
}
// Then check if the language needs to be updated. If it does, update the ->state to EBLOG_LANGUAGES_NEEDS_UPDATING
// We need to check if the language updated time is greater than the local updated time
if ($exists && $table->state) {
$languageTime = strtotime($language->updated);
$localLanguageTime = strtotime($table->updated);
if ($languageTime > $localLanguageTime && $table->state == EBLOG_LANGUAGES_INSTALLED) {
$table->state = EBLOG_LANGUAGES_NEEDS_UPDATING;
}
}
// Set the title
$table->title = $language->title;
// Set the locale
$table->locale = $language->locale;
// Set the translator
$table->translator = $language->translator;
// Set the updated time
$table->updated = $language->updated;
// Update the progress
$table->progress = $language->progress;
// Update the table with the appropriate params
$params = new JRegistry();
$params->set('download', $language->download);
$params->set('md5', $language->md5);
$table->params = $params->toString();
$table->store();
}
return true;
}
示例10: __construct
public function __construct()
{
$this->config = EB::config();
$this->app = JFactory::getApplication();
$this->input = EB::request();
// Determines if the current request is for debug
$this->debug = $this->input->get('debug', false, 'bool');
}
示例11: __construct
public function __construct()
{
$this->app = JFactory::getApplication();
$this->input = EB::request();
$config = EB::config();
$key = $config->get('integrations_flickr_api_key');
$secret = $config->get('integrations_flickr_secret_key');
parent::__construct($key, $secret);
}
示例12: loadProvider
public function loadProvider($provider = null)
{
// If provider is empty, then we get it based on settings
if (empty($provider)) {
$provider = EB::config()->get('location_service_provider', '');
}
$this->provider = $this->getProvider($provider);
return $this->provider;
}
示例13: __construct
public function __construct()
{
$this->my = JFactory::getUser();
$this->app = JFactory::getApplication();
$this->input = EB::request();
$this->acl = EB::acl();
$this->config = EB::config();
// Set the user project
$this->user = EB::user($this->my->id);
}
示例14: __construct
public function __construct()
{
// Get the config object
$this->config = EB::config();
// Get app settings
$this->app = JFactory::getApplication();
$this->input = EB::request();
// Assign the key and secret
$this->key = $this->config->get('amazon_key');
$this->secret = $this->config->get('amazon_secret');
}
示例15: getPosts
public static function getPosts(&$params)
{
$config = EB::config();
$count = (int) $params->get('count', 0);
// Retrieve the model from the component.
$model = EB::model('Blog');
$categories = trim($params->get('catid'));
$type = !empty($categories) ? 'category' : '';
if (!empty($categories)) {
$categories = explode(',', $categories);
}
$sorting = array();
$sorting[] = $params->get('sorting', 'latest');
$sorting[] = $params->get('ordering', 'desc');
$rows = $model->getBlogsBy($type, $categories, $sorting, $count, EBLOG_FILTER_PUBLISHED, null, false);
$posts = array();
// Retreive settings from params
$maxWidth = $params->get('imagewidth', 300);
$maxHeight = $params->get('imageheight', 200);
foreach ($rows as $data) {
$row = EB::post($data->id);
$row->bind($data);
$row->media = '';
//var_dump($row->image);
if (!empty($row->image)) {
$media = $row->getImage('thumbnail');
$imgHtml = $media;
$row->media = $imgHtml;
} else {
$image = self::getImage($row->intro . $row->content);
if ($image !== false) {
// TODO: Here's where we need to crop the image based on the cropping ratio provided in the params.
// Currently this is just a lame hack to fix the width and height
$pattern = '/<\\s*img [^\\>]*src\\s*=\\s*[\\""\']?([^\\""\'>]*)/i';
preg_match($pattern, $image, $matches);
$imageurl = '';
if ($matches) {
$imageurl = isset($matches[1]) ? $matches[1] : '';
}
if (!empty($imageurl)) {
// $imgHtml = '<img title="'.$row->title.'" src="' . $imageurl . '" style="width: '. $maxWidth . 'px !important;height: '. $maxHeight . 'px !important;" />';
$imgHtml = $imageurl;
$row->media = $imgHtml;
} else {
$row->media = $image;
}
}
}
if (!empty($row->media)) {
$posts[] = $row;
}
}
return $posts;
}