本文整理汇总了PHP中EB类的典型用法代码示例。如果您正苦于以下问题:PHP EB类的具体用法?PHP EB怎么用?PHP EB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGuestCount
public static function getGuestCount()
{
$id = JRequest::getVar('id');
$view = JRequest::getVar('view');
$db = EB::db();
$query = '';
if ($view == 'entry') {
$query = 'select cont(1) from `#__easyblog_subscriptions` as a';
$query .= ' where (';
// entry
$query .= ' (a.`uid` = ' . $db->Quote($id) . ' AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_ENTRY) . ') OR';
// category
$query .= ' (a.`uid` IN (select pc.`category_id` from `#__easyblog_post_category` as pc where pc.`post_id` = ' . $db->Quote($id) . ' ) AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_CATEGORY) . ') OR';
// teamblog
$query .= ' (a.`uid` IN (select pc.`source_id` from `#__easyblog_post` as p where p.`id` = ' . $db->Quote($id) . ' and p.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_TEAM) . ' ) AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_TEAMBLOG) . ')';
$query .= ')';
$query .= ' AND a.`user_id` = ' . $db->Quote('0');
} else {
if ($view == 'categories' && $id) {
$query = 'select count(1) from `#__easyblog_subscriptions` as a';
$query .= ' where a.`uid` = ' . $db->Quote($id);
$query .= ' and a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_CATEGORY);
$query .= ' AND a.`user_id` = ' . $db->Quote('0');
} else {
if ($view == 'teamblog') {
$query = 'select count(1) from `#__easyblog_subscriptions` as a';
$query .= ' where a.`uid` = ' . $db->Quote($id);
$query .= ' and a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_TEAMBLOG);
$query .= ' AND a.`user_id` = ' . $db->Quote('0');
}
}
}
$db->setQuery($query);
return (int) $db->loadResult();
}
示例2: display
public function display($tmpl = null)
{
// Checks if rss is enabled
if (!$this->config->get('main_rss')) {
return;
}
// Get the archives model
$model = EB::model('Archive');
// Get a list of posts
$posts = $model->getPosts();
// Format the posts
$posts = EB::formatter('list', $posts);
// Set the link for this feed
$this->doc->link = EBR::_('index.php?option=com_easyblog&view=archive');
$this->doc->setTitle(JText::_('COM_EASYBLOG_ARCHIVED_POSTS'));
$this->doc->setDescription(JText::_('COM_EASYBLOG_ARCHIVED_POSTS_DESC'));
if (!$posts) {
return;
}
foreach ($posts as $post) {
$image = '';
if ($post->getImage('medium', true, true)) {
$image = '<img src=' . $post->getImage('medium', true, true) . '" alt="' . $post->title . '" />';
}
$item = new JFeedItem();
$item->title = $post->title;
$item->link = $post->getPermalink();
$item->description = $image . $post->getIntro();
$item->date = $post->getCreationDate()->format();
$item->category = $post->getPrimaryCategory()->getTitle();
$item->author = $post->author->getName();
$item->authorEmail = $this->getRssEmail($post->author);
$this->doc->addItem($item);
}
}
示例3: __construct
public function __construct($id, $type)
{
parent::__construct($id, $type);
$team = EB::table('TeamBlog');
$team->load($id);
$this->team = $team;
}
示例4: html
public function html(EasyBlogPost &$blog)
{
// Determines if the comment plugin is enabled
$enabled = JPluginHelper::isEnabled('content', 'easydiscuss');
if (!$enabled) {
return;
}
// Determines if EasyDiscuss exists
if (!EB::easydiscuss()->exists()) {
return;
}
$articleParams = new stdClass();
$this->app = JFactory::getApplication();
$result = $this->app->triggerEvent('onDisplayComments', array(&$blog, &$articleParams));
if (isset($result[0]) || isset($result[1])) {
// There could be komento running on the site
if (isset($result[1]) && $result[1]) {
$output = $result[1];
} else {
$output = $result[0];
}
return $output;
}
return;
}
示例5: 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;
}
示例6: main
public function main()
{
$state = true;
$db = EB::db();
// lets check if there is any default category assigned or not.
$query = "select a.`id` from `#__easyblog_category` as a where a.`published` = 1 and a.`default` = 1";
$db->setQuery($query);
$result = $db->loadResult();
if (!$result) {
$query = "select a.`id`, count(b.`id`) as `cnt` from `#__easyblog_category` as a";
$query .= " left join `#__easyblog_post_category` as b on a.`id` = b.`category_id`";
$query .= " where a.`published` = 1";
$query .= " group by a.`id`";
$query .= " order by cnt desc";
$query .= " limit 1";
$db->setQuery($query);
$id = $db->loadResult();
// now we make sure no other categories which previously marked as default but its unpublished.
$update = "update `#__easyblog_category` set `default` = 0";
$db->setQuery($update);
// now let update this category as default category
$update = "update `#__easyblog_category` set `default` = 1 where `id` = " . $db->Quote($id);
$db->setQuery($update);
$state = $db->query();
}
return $state;
}
示例7: execute
/**
* Synchronizes database tables
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function execute()
{
// Load foundry
$this->engine();
// Get this installation version
$version = $this->getInstalledVersion();
// Get previous version installed
$previous = $this->getPreviousVersion('dbversion');
$affected = '';
if ($previous !== false) {
// lets run the db scripts sync if needed.
$db = EB::db();
$affected = $db->sync($previous);
}
// Update the version in the database to the latest now
$config = EB::table('Configs');
$config->load(array('name' => 'dbversion'));
$config->name = 'dbversion';
$config->params = $version;
// Save the configuration
$config->store($config->name);
// If the previous version is empty, we can skip this altogether as we know this is a fresh installation
if (!empty($affected)) {
$this->setInfo(JText::sprintf('COM_EASYBLOG_INSTALLATION_MAINTENANCE_DB_SYNCED', $version));
} else {
$this->setInfo(JText::sprintf('COM_EASYBLOG_INSTALLATION_MAINTENANCE_DB_NOTHING_TO_SYNC', $version));
}
return $this->output();
}
示例8: html
/**
* Outputs the html code for Twitter button
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function html()
{
// If this is a frontpage, ensure that show in frontpage is enabled
if ($this->frontpage && !$this->config->get('main_twitter_button_frontpage', $this->config->get('social_show_frontpage'))) {
return;
}
// Get the button size
$size = $this->getButtonSize();
// Get the via text
$via = $this->config->get('main_twitter_button_via_screen_name', '');
if ($via) {
$via = JString::substr($via, 1);
}
// Get the absolute url to this blog post
$url = $this->getUrl();
// Ge the formatted title to this blog post
$title = $this->getTitle();
// Twitter's sharing shouldn't have urlencoded values
$title = urldecode($title);
// Remove unwanted character inside url to avoid incorrect url sharing
$title = str_replace('"', '', $title);
// Determines if we should track with analytics
$tracking = $this->config->get('main_twitter_analytics');
$placeholder = $this->getPlaceholderId();
$theme = EB::template();
$theme->set('tracking', $tracking);
$theme->set('size', $size);
$theme->set('via', $via);
$theme->set('placeholder', $placeholder);
$theme->set('url', $url);
$theme->set('title', $title);
$output = $theme->output('site/socialbuttons/twitter');
return $output;
}
示例9: map
public function map(&$file, $index, &$contents)
{
// Store the file to a temporary location
$file['tmp_name'] = $this->tmp . '/' . md5($file['name']);
JFile::write($file['tmp_name'], $file['data']);
// Load up media manager now
$mm = EB::mediamanager();
$result = $mm->upload($file, 'user:' . $this->authorId);
$title = $file['name'];
$url = $this->absoluteUrl . '/' . $file['name'];
// Get the properties from media manager result
if (is_object($result) && property_exists($result, 'title')) {
$title = $result->title;
$url = $result->url;
}
// Once the attachment is already uploaded, we want to delete the temporary file now
JFile::delete($file['tmp_name']);
// Check if a file id is provided in the email
if (isset($file['id']) && !empty($file['id'])) {
$fileId = $file['id'];
$fileId = str_replace('<', '', $fileId);
$fileId = str_replace('>', '', $fileId);
$patterns = array('/<div><img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/><\\/div>/si', '/<img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/>/si');
$replace = array('', '');
$contents = preg_replace($patterns, $replace, $contents);
}
// Now we need to insert the pdf links into the content
$template = EB::template();
$template->set('title', $title);
$template->set('url', $url);
$output = $template->output('site/mailpublishing/template.pdf');
$contents .= $output;
}
示例10: crawl
/**
* Invoke the crawling.
*
* @since 1.0
* @access public
* @author Mark Lee <mark@stackideas.com>
*/
public function crawl($url)
{
$tmp = str_ireplace(array('http://', 'https://'), '', $url);
if (!EB::string()->isValidDomain($tmp)) {
return false;
}
// Ensure that urls always contains a protocol
if (stristr($url, 'http://') === false && stristr($url, 'https://') === false) {
$url = 'http://' . $url;
}
// Load up the connector first.
$connector = EB::connector();
$connector->addUrl($url);
$connector->execute();
// Get the result and parse them.
$info = parse_url($url);
$this->contents = $connector->getResult($url);
// Replace any href="// with href="scheme://"
$this->contents = str_ireplace('src="//', 'src="' . $info['scheme'] . '://', $this->contents);
// Get the final url, if there's any redirection.
$originalUrl = $url;
$url = $connector->getFinalUrl($url);
$this->parse($originalUrl, $url);
return $this;
}
示例11: crawl
/**
* Given a specific URL, try to crawl the site
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function crawl()
{
// Get a list of urls to crawl
$urls = $this->input->get('url', array(), 'array');
if (!is_array($urls)) {
$urls = array($urls);
}
// Result placeholder
$result = array();
if (!$urls || empty($urls)) {
return $this->ajax->reject();
}
// Get the crawler library
$crawler = EB::crawler();
foreach ($urls as $url) {
// Ensures that the domain is valid
if (!EB::string()->isValidDomain($url)) {
return $this->ajax->reject(JText::_('COM_EASYBLOG_COMPOSER_BLOCKS_LINKS_EMPTY'));
}
// Crawl the url
$state = $crawler->crawl($url);
// Get the data from the crawled site
$data = $crawler->getData();
$result[$url] = $data;
}
return $this->ajax->resolve($result);
}
示例12: testMailbox
/**
* Runs mailbox testing
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function testMailbox()
{
$server = $this->input->get('server', '', 'default');
$port = $this->input->get('port', '', 'default');
$service = $this->input->get('service', '', 'default');
$ssl = $this->input->get('ssl', true, 'bool');
$mailbox = $this->input->get('mailbox', 'INBOX', 'default');
$user = $this->input->get('user', '', 'default');
$pass = $this->input->get('pass', '', 'default');
// Ensure that all properties are set
if (empty($server)) {
return $this->ajax->reject(JText::_('Please enter the server address for your mail server.'));
}
if (empty($port)) {
return $this->ajax->reject(JText::_('Please enter the server port for your mail server.'));
}
if (empty($user)) {
return $this->ajax->reject(JText::_('Please enter your mailbox username.'));
}
if (empty($pass)) {
return $this->ajax->reject(JText::_('Please enter your mailbox password.'));
}
$mailbox = EB::mailbox();
$result = $mailbox->test($server, $port, $service, $ssl, $mailbox, $user, $pass);
return $this->ajax->resolve($result);
}
示例13: html
/**
* Outputs the html code for Facebook button
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function html()
{
// If this is a frontpage, ensure that show in frontpage is enabled
if ($this->frontpage && !$this->config->get('main_facebook_like_frontpage', $this->config->get('social_show_frontpage'))) {
return;
}
// Get the button size
$size = $this->getButtonSize();
// Get standard properties
$locale = $this->getLocale();
$width = $this->config->get('main_facebook_like_width');
$verb = $this->config->get('main_facebook_like_verb');
$fbTheme = $this->config->get('main_facebook_like_theme');
$send = $this->config->get('main_facebook_like_send');
// Get the permalink to the blog post.
$url = $this->post->getExternalPermalink();
// Determines if we should track with analytics
$tracking = $this->config->get('main_facebook_analytics');
// Generate a placeholder
$placeholder = $this->getPlaceholderId();
$theme = EB::template();
$theme->set('size', $size);
$theme->set('placeholder', $placeholder);
$theme->set('url', $url);
$theme->set('locale', $locale);
$theme->set('verb', $verb);
$theme->set('fbTheme', $fbTheme);
$theme->set('send', $send);
$theme->set('tracking', $tracking);
$output = $theme->output('site/socialbuttons/facebook');
return $output;
}
示例14: data
public function data()
{
$theme = EB::template();
$content = $theme->output('site/composer/blocks/handlers/text/html');
$data = (object) array('content' => $content);
return $data;
}
示例15: reject
public function reject()
{
// Check for request forgeries
EB::checkToken();
// Ensure that user is logged in
EB::requireLogin();
// Get any return url
$return = EB::_('index.php?option=com_easyblog&view=dashboard&layout=moderate');
if ($this->getReturnURL()) {
$return = $this->getReturnURL();
}
// Check if the user is privileged enough
if (!$this->acl->get('add_entry') && !$this->acl->get('manage_pending')) {
return JError::raiseError(500, JText::_('COM_EASYBLOG_NO_PERMISSION_TO_MODERATE_BLOG'));
}
// Get a list of ids
$ids = $this->input->get('ids', array(), 'array');
$message = $this->input->get('message', '', 'default');
foreach ($ids as $id) {
$id = (int) $id;
$post = EB::post($id);
$post->reject($message);
}
$message = JText::_('COM_EASYBLOG_BLOGS_BLOG_SAVE_REJECTED');
$this->info->set($message, 'success');
return $this->app->redirect($return);
}