本文整理汇总了PHP中Foundry::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Foundry::get方法的具体用法?PHP Foundry::get怎么用?PHP Foundry::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foundry
的用法示例。
在下文中一共展示了Foundry::get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getToolbar
/**
* Retrieves EasySocial's toolbar
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function getToolbar()
{
$toolbar = Foundry::get( 'Toolbar' );
$output = $toolbar->render();
return $output;
}
示例2: location
public static function location($location, $options = '')
{
$uid = uniqid();
$classname = 'es-location-' . $uid;
$selector = '.' . $classname;
if (empty($location)) {
$location = Foundry::table('Location');
}
$theme = Foundry::get('Themes');
$theme->set('uid', $uid);
$theme->set('classname', $classname);
$theme->set('selector', $selector);
$theme->set('location', $location);
return $theme->output('admin/html/grid.location');
}
示例3: addIndexerNewBlog
/**
* Creates a new stream for new comments in EasyBlog
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function addIndexerNewBlog($blog)
{
if (!class_exists('Foundry')) {
return;
}
$config = EasyBlogHelper::getConfig();
$indexer = Foundry::get('Indexer', 'com_easyblog');
$template = $indexer->getTemplate();
// getting the blog content
$content = $blog->intro . $blog->content;
$image = '';
// @rule: Try to get the blog image.
if ($blog->getImage()) {
$image = $blog->getImage()->getSource('small');
}
if (empty($image)) {
// @rule: Match images from blog post
$pattern = '/<\\s*img [^\\>]*src\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i';
preg_match($pattern, $content, $matches);
$image = '';
if ($matches) {
$image = isset($matches[1]) ? $matches[1] : '';
if (JString::stristr($matches[1], 'https://') === false && JString::stristr($matches[1], 'http://') === false && !empty($image)) {
$image = rtrim(JURI::root(), '/') . '/' . ltrim($image, '/');
}
}
}
if (!$image) {
$image = rtrim(JURI::root(), '/') . '/components/com_easyblog/assets/images/default_facebook.png';
}
// @task: Strip out video tags
$content = EasyBlogHelper::getHelper('Videos')->strip($content);
// @task: Strip out audio tags
$content = EasyBlogHelper::getHelper('Audio')->strip($content);
// @task: Strip out gallery tags
$content = EasyBlogHelper::getHelper('Gallery')->strip($content);
// @task: Strip out album tags
$content = EasyBlogHelper::getHelper('Album')->strip($content);
// @rule: Once the gallery is already processed above, we will need to strip out the gallery contents since it may contain some unwanted codes
// @2.0: <input class="easyblog-gallery"
// @3.5: {ebgallery:'name'}
$content = EasyBlogHelper::removeGallery($content);
$content = strip_tags($content);
if (JString::strlen($content) > $config->get('integrations_easysocial_indexer_newpost_length', 250)) {
$content = JString::substr($content, 0, $config->get('integrations_easysocial_indexer_newpost_length', 250));
}
// lets include the title as the search snapshot.
$content = $blog->title . ' ' . $content;
$template->setContent($blog->title, $content);
$url = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id);
// Remove /administrator/ from the url.
$url = JString::str_ireplace('administrator/', '', $url);
$template->setSource($blog->id, 'blog', $blog->created_by, $url);
$template->setThumbnail($image);
$template->setLastUpdate($blog->modified);
$state = $indexer->index($template);
return $state;
}
示例4: getPagination
public function getPagination()
{
$htmlContent = '';
if ($this->pagination) {
$page = $this->pagination;
$previousLink = '';
$nextLink = '';
//build the extra params into the url
$params = $this->buildPaginationParams();
if (!is_null($page['previous'])) {
$previousLink = JRoute::_($params . '&limitstart=' . $page['previous']);
}
if (!is_null($page['next'])) {
$nextLink = JRoute::_($params . '&limitstart=' . $page['next']);
}
$theme = Foundry::get('Themes');
$theme->set('next', $nextLink);
$theme->set('previous', $previousLink);
$htmlContent = $theme->output('site/stream/pagination');
}
return $htmlContent;
}
示例5: _installSubextensions
/**
* Installs subextensions (modules, plugins) bundled with the main extension
*
* @param JInstaller $parent
* @return JObject The subextension installation status
*/
private function _installSubextensions($parent)
{
$src = $parent->getParent()->getPath('source');
$db = JFactory::getDbo();
$status = new JObject();
$status->modules = array();
$status->plugins = array();
// Modules installation
if (count($this->installation_queue['modules'])) {
foreach ($this->installation_queue['modules'] as $folder => $modules) {
if (count($modules)) {
foreach ($modules as $module => $modulePreferences) {
// Install the module
if (empty($folder)) {
$folder = 'site';
}
$path = "{$src}/modules/{$folder}/{$module}";
if (!is_dir($path)) {
$path = "{$src}/modules/{$folder}/mod_{$module}";
}
if (!is_dir($path)) {
$path = "{$src}/modules/{$module}";
}
if (!is_dir($path)) {
$path = "{$src}/modules/mod_{$module}";
}
if (!is_dir($path)) {
$fortest = '';
//continue;
}
// Was the module already installed?
$sql = $db->getQuery(true)->select('COUNT(*)')->from('#__modules')->where($db->qn('module') . ' = ' . $db->q('mod_' . $module));
$db->setQuery($sql);
$count = $db->loadResult();
$installer = new JInstaller();
$result = $installer->install($path);
$status->modules[] = array('name' => $module, 'client' => $folder, 'result' => $result, 'status' => $modulePreferences[1]);
// Modify where it's published and its published state
if (!$count) {
// A. Position and state
list($modulePosition, $modulePublished) = $modulePreferences;
if ($modulePosition == 'cpanel') {
$modulePosition = 'icon';
}
$sql = $db->getQuery(true)->update($db->qn('#__modules'))->set($db->qn('position') . ' = ' . $db->q($modulePosition))->where($db->qn('module') . ' = ' . $db->q('mod_' . $module));
if ($modulePublished) {
$sql->set($db->qn('published') . ' = ' . $db->q('1'));
}
$db->setQuery($sql);
$db->execute();
// B. Change the ordering of back-end modules to 1 + max ordering
if ($folder == 'admin') {
$query = $db->getQuery(true);
$query->select('MAX(' . $db->qn('ordering') . ')')->from($db->qn('#__modules'))->where($db->qn('position') . '=' . $db->q($modulePosition));
$db->setQuery($query);
$position = $db->loadResult();
$position++;
$query = $db->getQuery(true);
$query->update($db->qn('#__modules'))->set($db->qn('ordering') . ' = ' . $db->q($position))->where($db->qn('module') . ' = ' . $db->q('mod_' . $module));
$db->setQuery($query);
$db->execute();
}
// C. Link to all pages
$query = $db->getQuery(true);
$query->select('id')->from($db->qn('#__modules'))->where($db->qn('module') . ' = ' . $db->q('mod_' . $module));
$db->setQuery($query);
$moduleid = $db->loadResult();
$query = $db->getQuery(true);
$query->select('*')->from($db->qn('#__modules_menu'))->where($db->qn('moduleid') . ' = ' . $db->q($moduleid));
$db->setQuery($query);
$assignments = $db->loadObjectList();
$isAssigned = !empty($assignments);
if (!$isAssigned) {
$o = (object) array('moduleid' => $moduleid, 'menuid' => 0);
$db->insertObject('#__modules_menu', $o);
}
}
}
}
}
}
// Plugins installation
if (count($this->installation_queue['plugins'])) {
foreach ($this->installation_queue['plugins'] as $folder => $plugins) {
if (count($plugins)) {
foreach ($plugins as $plugin => $published) {
$path = "{$src}/plugins/{$folder}/{$plugin}";
if (!is_dir($path)) {
$path = "{$src}/plugins/{$folder}/plg_{$plugin}";
}
if (!is_dir($path)) {
$path = "{$src}/plugins/{$plugin}";
}
if (!is_dir($path)) {
//.........这里部分代码省略.........
示例6: onPrepareStoryPanel
public function onPrepareStoryPanel($story)
{
$config = Foundry::config();
if (!$config->get('photos.enabled')) {
return;
}
// Get current logged in user.
$my = Foundry::user();
// Get user access
$access = Foundry::access($my->id, SOCIAL_TYPE_USER);
$plugin = $story->createPlugin("photos", "panel");
$theme = Foundry::get('Themes');
// check max photos upload here.
if ($access->exceeded('photos.uploader.max', $my->getTotalPhotos())) {
$theme->set('exceeded', JText::sprintf('COM_EASYSOCIAL_PHOTOS_EXCEEDED_MAX_UPLOAD', $access->get('photos.uploader.max')));
}
// check max photos upload daily here.
if ($access->exceeded('photos.uploader.maxdaily', $my->getTotalPhotos(true))) {
$theme->set('exceeded', JText::sprintf('COM_EASYSOCIAL_PHOTOS_EXCEEDED_DAILY_MAX_UPLOAD', $access->get('photos.uploader.maxdaily')));
}
$plugin->button->html = $theme->output('themes:/apps/user/photos/story/panel.button');
$plugin->content->html = $theme->output('themes:/apps/user/photos/story/panel.content');
$script = Foundry::get('Script');
$script->set('maxFileSize', $access->get('photos.uploader.maxsize') . 'M');
$plugin->script = $script->output('apps:/user/photos/story');
return $plugin;
}
示例7: addIndexerNewBlog
/**
* Creates a new stream for new comments in EasyBlog
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function addIndexerNewBlog($blog)
{
if (!class_exists('Foundry')) {
return;
}
$config = EasyBlogHelper::getConfig();
$indexer = Foundry::get('Indexer', 'com_easyblog');
$template = $indexer->getTemplate();
// getting the blog content
$content = $blog->intro . $blog->content;
$image = '';
// @rule: Try to get the blog image.
if ($blog->getImage()) {
$image = $blog->getImage()->getSource('small');
}
if (empty($image)) {
// @rule: Match images from blog post
$pattern = '/<\\s*img [^\\>]*src\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i';
preg_match($pattern, $content, $matches);
$image = '';
if ($matches) {
$image = isset($matches[1]) ? $matches[1] : '';
if (JString::stristr($matches[1], 'https://') === false && JString::stristr($matches[1], 'http://') === false && !empty($image)) {
$image = rtrim(JURI::root(), '/') . '/' . ltrim($image, '/');
}
}
}
if (!$image) {
$image = rtrim(JURI::root(), '/') . '/components/com_easyblog/assets/images/default_facebook.png';
}
$content = strip_tags($content);
if (JString::strlen($content) > $config->get('integrations_easysocial_indexer_newpost_length', 250)) {
$content = JString::substr($content, 0, $config->get('integrations_easysocial_indexer_newpost_length', 250));
}
$template->setContent($blog->title, $content);
$url = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id);
$template->setSource($blog->id, 'blog', $blog->created_by, $url);
$template->setThumbnail($image);
$template->setLastUpdate($blog->modified);
$state = $indexer->index($template);
return $state;
}