本文整理汇总了PHP中Component::path方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::path方法的具体用法?PHP Component::path怎么用?PHP Component::path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component::path方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Get module contents
*
* @return void
*/
public function run()
{
require_once \Component::path('com_feedback') . DS . 'models' . DS . 'quote.php';
// Get the admin configured settings
$this->charlimit = $this->params->get('charlimit', 150);
$this->showauthor = $this->params->get('show_author', 1);
$this->showall = $this->params->get('show_all_link', 1);
$quotesrc = $this->params->get('quotesrc', 'miniquote');
// Get quotes
$quote = Quote::all()->whereEquals('notable_quote', $this->params->get('quotepool') == 'notable_quotes' ? 1 : 0)->whereEquals('miniquote', $quotesrc == 'miniquote' ? 1 : 0)->limit(1)->rows()->first();
/*$quote = $sq->find('one', array(
'limit' => 1,
'notable_quote' => ($this->params->get('quotepool') == 'notable_quotes' ? 1 : 0),
'miniquote' => ($quotesrc == 'miniquote' ? 1 : 0),
'sort' => 'RAND()',
'sort_Dir' => ''
));*/
if ($quote) {
$this->quote_to_show = $quotesrc == 'miniquote' ? stripslashes($quote->get('miniquote')) : stripslashes($quote->get('short_quote'));
} else {
$this->quote_to_show = '';
}
$this->quote = $quote;
require $this->getLayoutPath($this->params->get('layout', 'default'));
}
示例2: _includeScripts
/**
* Include necessary scripts
*
* @return void
*/
protected function _includeScripts()
{
// Enable publication management
if ($this->_publishing) {
require_once \Component::path('com_publications') . DS . 'models' . DS . 'publication.php';
}
}
示例3: display
/**
* Display module content
*
* @return void
*/
public function display()
{
require_once \Component::path('com_poll') . DS . 'models' . DS . 'poll.php';
$menu = \App::get('menu');
$items = $menu->getItems('link', 'index.php?option=com_poll&view=poll');
$itemid = isset($items[0]) ? '&Itemid=' . $items[0]->id : '';
if ($id = $this->params->get('id', 0)) {
$poll = \Components\Poll\Models\Poll::oneOrNew($id);
} else {
$poll = \Components\Poll\Models\Poll::current();
}
if ($poll && $poll->id) {
require $this->getLayoutPath();
}
}
示例4: onSearch
/**
* Build search query and add it to the $results
*
* @param object $request \Components\Search\Models\Basic\Request
* @param object &$results \Components\Search\Models\Basic\Result\Set
* @param object $authz \Components\Search\Models\Basic\Authorization
* @return void
*/
public static function onSearch($request, &$results, $authz)
{
$terms = $request->get_term_ar();
$weight = '(match(wp.title) against (\'' . join(' ', $terms['stemmed']) . '\') + match(wv.pagetext) against (\'' . join(' ', $terms['stemmed']) . '\'))';
$addtl_where = array();
foreach ($terms['mandatory'] as $mand) {
$addtl_where[] = "(wp.title LIKE '%{$mand}%' OR wv.pagetext LIKE '%{$mand}%')";
}
foreach ($terms['forbidden'] as $forb) {
$addtl_where[] = "(wp.title NOT LIKE '%{$forb}%' AND wv.pagetext NOT LIKE '%{$forb}%')";
}
$viewlevels = implode(',', User::getAuthorisedViewLevels());
if ($gids = $authz->get_group_ids()) {
$authorization = '(wp.access IN (0,' . $viewlevels . ') OR (wp.access = 1 AND xg.gidNumber IN (' . join(',', $gids) . ')))';
} else {
$authorization = '(wp.access IN (0,' . $viewlevels . '))';
}
// fml
$groupAuth = array();
if ($authz->is_super_admin()) {
$groupAuth[] = '1';
} else {
$groupAuth[] = 'xg.plugins LIKE \'%wiki=anyone%\'';
if (!$authz->is_guest()) {
$groupAuth[] = 'xg.plugins LIKE \'%wiki=registered%\'';
if ($gids = $authz->get_group_ids()) {
$groupAuth[] = '(xg.plugins LIKE \'%wiki=members%\' AND xg.gidNumber IN (' . join(',', $gids) . '))';
}
}
}
$rows = new \Components\Search\Models\Basic\Result\Sql("SELECT\n\t\t\t\twp.title,\n\t\t\t\twp.scope,\n\t\t\t\twp.scope_id,\n\t\t\t\twv.pagehtml AS description,\n\t\t\t\tCASE\n\t\t\t\t\tWHEN wp.path != '' THEN concat(wp.path, '/', wp.pagename)\n\t\t\t\t\tELSE wp.pagename\n\t\t\t\tEND AS link,\n\t\t\t\t{$weight} AS weight,\n\t\t\t\twv.created AS date,\n\t\t\t\tCASE\n\t\t\t\t\tWHEN wp.scope='project' THEN 'Project Notes'\n\t\t\t\t\tELSE 'Wiki'\n\t\t\t\tEND AS section\n\t\t\tFROM `#__wiki_versions` wv\n\t\t\tINNER JOIN `#__wiki_pages` wp\n\t\t\t\tON wp.id = wv.page_id\n\t\t\tLEFT JOIN `#__xgroups` xg ON xg.gidNumber = wp.scope_id AND wp.scope='group'\n\t\t\tWHERE\n\t\t\t\t{$authorization} AND\n\t\t\t\t{$weight} > 0 AND\n\t\t\t\twp.state < 2 AND\n\t\t\t\twv.id = (SELECT MAX(wv2.id) FROM `#__wiki_versions` wv2 WHERE wv2.page_id = wv.page_id) " . ($addtl_where ? ' AND ' . join(' AND ', $addtl_where) : '') . " AND (xg.gidNumber IS NULL OR (" . implode(' OR ', $groupAuth) . "))\n\t\t\t ORDER BY {$weight} DESC");
include_once Component::path('com_wiki') . DS . 'models' . DS . 'page.php';
foreach ($rows->to_associative() as $row) {
if (!$row) {
continue;
}
$page = \Components\Wiki\Models\Page::blank();
$page->set('pagename', $row->link);
$page->set('scope', $row->scope);
$page->set('scope_id', $row->scope_id);
$row->set_link(Route::url($page->link()));
// rough de-wikifying. probably a bit faster than rendering to html and then stripping the tags, but not perfect
//$row->set_description(preg_replace('/(\[+.*?\]+|\{+.*?\}+|[=*])/', '', $row->get_description()));
$row->set_description(strip_tags($row->get_description()));
$results->add($row);
}
}
示例5: __construct
/**
* Constructor
*
* @param object &$subject Event observer
* @param array $config Optional config values
* @return void
*/
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
Lang::load('com_jobs');
$path = Component::path('com_jobs');
include_once $path . DS . 'tables' . DS . 'admin.php';
include_once $path . DS . 'tables' . DS . 'application.php';
include_once $path . DS . 'tables' . DS . 'category.php';
include_once $path . DS . 'tables' . DS . 'employer.php';
include_once $path . DS . 'tables' . DS . 'job.php';
include_once $path . DS . 'tables' . DS . 'prefs.php';
include_once $path . DS . 'tables' . DS . 'resume.php';
include_once $path . DS . 'tables' . DS . 'seeker.php';
include_once $path . DS . 'tables' . DS . 'shortlist.php';
include_once $path . DS . 'tables' . DS . 'stats.php';
include_once $path . DS . 'tables' . DS . 'type.php';
$this->config = Component::params('com_jobs');
}
示例6: onCourse
/**
* Return data on a course view (this will be some form of HTML)
*
* @param object $course Current course
* @param object $offering Name of the component
* @param boolean $describe Return plugin description only?
* @return object
*/
public function onCourse($course, $offering, $describe = false)
{
$response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)))->set('description', Lang::txt('PLG_COURSES_' . strtoupper($this->_name) . '_BLURB'))->set('default_access', $this->params->get('plugin_access', 'members'))->set('display_menu_tab', true)->set('icon', 'f095');
if ($describe) {
return $response;
}
if (!($active = Request::getVar('active'))) {
Request::setVar('active', $active = $this->_name);
}
// Get a student count
$response->set('meta_count', $offering->announcements(array('count' => true)));
// Check if our area is in the array of areas we want to return results for
if ($response->get('name') == $active) {
// Set some variables so other functions have access
$this->option = Request::getCmd('option', 'com_courses');
$this->course = $course;
$this->offering = $offering;
// Set the page title
Document::setTitle(Document::getTitle() . ': ' . Lang::txt('PLG_COURSES_ANNOUNCEMENTS'));
Pathway::append(Lang::txt('PLG_COURSES_' . strtoupper($this->_name)), $this->offering->link() . '&active=' . $this->_name);
require_once Component::path('com_courses') . DS . 'models' . DS . 'announcement.php';
$action = Request::getWord('action', '');
switch (strtolower($action)) {
case 'save':
$response->set('html', $this->_save());
break;
case 'new':
$response->set('html', $this->_edit());
break;
case 'edit':
$response->set('html', $this->_edit());
break;
case 'delete':
$response->set('html', $this->_delete());
break;
default:
$response->set('html', $this->_list());
break;
}
}
// Return the output
return $response;
}
示例7: run
/**
* Display module contents
*
* @return void
*/
public function run()
{
Lang::load('com_blog', Component::path('com_blog') . '/site');
include_once \Component::path('com_blog') . DS . 'models' . DS . 'archive.php';
$this->pullout = $this->params->get('pullout', 'yes');
$this->feedlink = $this->params->get('feedlink', 'yes');
$this->limit = $this->params->get('limit', 5);
$filters = array('limit' => $this->params->get('limit', 5), 'start' => 0, 'scope' => $this->params->get('blog', 'site'), 'scope_id' => 0, 'state' => 1, 'access' => User::getAuthorisedViewLevels());
if ($filters['scope'] == 'both' || $filters['scope'] == 'group') {
$filters['limit'] = $filters['limit'] * 5;
// Since some groups May have private entries, we need to up the limit to try and catch more
}
if ($filters['scope'] == 'both') {
$filters['scope'] = '';
}
$archive = new Archive('site', 0);
$rows = $archive->entries($filters)->ordered()->rows();
$posts = array();
foreach ($rows as $k => $gf) {
if ($this->params->get('blog', 'site') == 'group' || $this->params->get('blog', 'site') == 'both') {
//make sure that the group for each blog post has the right privacy setting
if (!$gf->get('scope_id')) {
continue;
}
$group = $gf->item();
if (is_object($group)) {
$blog_access = GroupHelper::getPluginAccess($group, 'blog');
if ($blog_access == 'nobody' || $blog_access == 'registered' && User::isGuest() || $blog_access == 'members' && !in_array(User::get('id'), $group->get('members'))) {
continue;
}
} else {
continue;
}
}
$posts[] = $gf;
}
$this->posts = $posts;
require $this->getLayoutPath();
}
示例8: diskspace
/**
* Show disk usage
*
* @param object $model Project model
* @param string $repoName
* @param integer $by
* @return string
*/
public function diskspace($model, $repoName = 'local', $by = '')
{
// Output HTML
$view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'files', 'name' => 'diskspace'));
if (!isset($this->repo)) {
$this->repo = new \Components\Projects\Models\Repo($model, $repoName);
}
$url = Route::url('index.php?option=' . $this->_option . '&alias=' . $model->get('alias') . '&active=files&action=diskspace');
// Report usage with all history?
if ($this->params->get('disk_usage') == true || $by == 'admin') {
$view->dirsize = $this->repo->call('getDiskUsage', $params = array('working' => true, 'history' => true));
$view->totalspace = $this->repo->call('getDiskUsage', $params = array('working' => false, 'history' => false));
} else {
$view->totalspace = $this->repo->call('getDiskUsage', $params = array('working' => false, 'history' => true));
$view->dirsize = $view->totalspace;
}
// Get publication usage
if (Plugin::isEnabled('projects', 'publications') && $by == 'admin') {
require_once Component::path('com_publications') . DS . 'helpers' . DS . 'html.php';
$filters = array();
$filters['project'] = $model->get('id');
$filters['ignore_access'] = 1;
$filters['dev'] = 1;
$database = \App::get('db');
$objP = new \Components\Publications\Tables\Publication($database);
$pubs = $objP->getRecords($filters);
$view->pubDiskUsage = \Components\Publications\Helpers\Html::getDiskUsage($pubs);
$view->pubQuota = $model->params->get('pubQuota') ? $model->params->get('pubQuota') : \Components\Projects\Helpers\Html::convertSize(floatval($model->config()->get('pubQuota', '1')), 'GB', 'b');
}
$view->total = $this->repo->count();
$view->quota = $model->params->get('quota', \Components\Projects\Helpers\Html::convertSize(floatval($model->config()->get('defaultQuota', '1')), 'GB', 'b'));
$view->by = $by;
$view->model = $model;
$view->option = $this->_option;
$view->config = $model->config();
$view->title = isset($this->_area['title']) ? $this->_area['title'] : '';
$view->params = $this->params;
return $view->loadTemplate();
}
示例9:
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* HUBzero is a registered trademark of Purdue University.
*
* @package hubzero-cms
* @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
* @license http://opensource.org/licenses/MIT MIT
*/
namespace Components\Wiki\Models;
use Components\Wiki\Helpers\Parser;
use Hubzero\Database\Relational;
use Lang;
use Date;
require_once \Component::path('com_members') . DS . 'models' . DS . 'member.php';
/**
* Wiki model for a page version
*/
class Version extends Relational
{
/**
* The table namespace
*
* @var string
*/
protected $namespace = 'wiki';
/**
* Adapter type
*
* @var object
示例10: renderMembers
/**
* Render the events
*
* @param array Array of group events
* @return string
*/
private function renderMembers($group, $members)
{
$content = '<div class="member_browser">';
if (count($members) > 0) {
include_once \Component::path('com_members') . DS . 'models' . DS . 'member.php';
foreach ($members as $member) {
$profile = \Components\Members\Models\Member::oneOrNew($member);
$link = \Route::url($profile->link());
$content .= '<a href="' . $link . '" class="member" title="Go to ' . stripslashes($profile->get('name')) . '\'s Profile.">';
$content .= '<img src="' . $profile->picture(0, true) . '" alt="' . stripslashes($profile->get('name')) . '" class="member-border" width="50px" height="50px" />';
$content .= '<span class="name">' . stripslashes($profile->get('name')) . '</span>';
$content .= '<span class="org">' . stripslashes($profile->get('organization')) . '</span>';
$content .= '</a>';
}
}
$content .= '</div><!-- /.member_browser -->';
return $content;
}
示例11: out
/**
* Static method for formatting results
*
* @param object $row Database row
* @return string HTML
*/
public static function out($row)
{
include_once Component::path('com_publications') . DS . 'tables' . DS . 'author.php';
require_once Component::path('com_publications') . DS . 'helpers' . DS . 'html.php';
$row->href = Route::url('index.php?option=com_publications&id=' . $row->id);
$database = App::get('db');
// Get version authors
$pa = new \Components\Publications\Tables\Author($database);
$authors = $pa->getAuthors($row->ftext);
// Get the component params
$config = Component::params('com_publications');
$row->rating = $row->rcount;
$row->category = $row->data1;
$row->area = $row->data2;
$row->ranking = $row->data3;
// Set the display date
switch ($config->get('show_date')) {
case 0:
$thedate = '';
break;
case 1:
$thedate = Date::of($row->created)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
break;
case 2:
$thedate = Date::of($row->modified)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
break;
case 3:
$thedate = Date::of($row->publish_up)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
break;
}
if (strstr($row->href, 'index.php')) {
$row->href = Route::url($row->href);
}
// Start building the HTML
$html = "\t" . '<li class="';
$html .= 'publication">' . "\n";
$html .= "\t\t" . '<p class="title"><a href="' . $row->href . '/?v=' . $row->alias . '">' . stripslashes($row->title) . '</a></p>' . "\n";
$html .= "\t\t" . '<p class="details">' . $thedate . ' <span>|</span> ' . $row->area;
if ($authors) {
$html .= ' <span>|</span> ' . Lang::txt('PLG_TAGS_PUBLICATIONS_CONTRIBUTORS') . ' ' . stripslashes(\Components\Publications\Helpers\Html::showContributors($authors, true, false));
}
$html .= '</p>' . "\n";
if ($row->itext) {
$html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(\Hubzero\Utility\Sanitize::stripAll(stripslashes($row->itext)), 200) . '</p>' . "\n";
}
$html .= "\t\t" . '<p class="href">' . Request::base() . trim($row->href . '/?v=' . $row->alias, '/') . '</p>' . "\n";
$html .= "\t" . '</li>' . "\n";
// Return output
return $html;
}
示例12: defined
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* HUBzero is a registered trademark of Purdue University.
*
* @package hubzero-cms
* @author Steve Snyder <snyder13@purdue.edu>
* @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
* @license http://opensource.org/licenses/MIT MIT
*/
// No direct access
defined('_HZEXEC_') or die;
use Components\Publications\Models\Orm\Publication;
require_once Component::path('com_publications') . DS . 'models' . DS . 'orm' . DS . 'publication.php';
/**
* Publications child sorter class
*/
class PublicationChildSorter
{
/**
* Description for 'order'
*
* @var array
*/
private $order;
/**
* Constructor
*
* @param array $order Parameter description (if any) ...
示例13: array
<?php
}
?>
</fieldset>
<div class="clear"></div>
<?php
}
?>
<?php
// Convert to XML so we can use the Form processor
$xml = Field::toXml($this->fields, 'create');
// Gather data to pass to the form processor
$data = new Hubzero\Config\Registry();
// Create a new form
Hubzero\Form\Form::addFieldPath(Component::path('com_members') . DS . 'models' . DS . 'fields');
$form = new Hubzero\Form\Form('profile', array('control' => 'profile'));
$form->load($xml);
$form->bind($data);
$scripts = array();
$toggle = array();
if ($this->fields->count() > 0) {
?>
<fieldset>
<legend><?php
echo Lang::txt('COM_MEMBERS_REGISTER_LEGEND_PERSONAL_INFO');
?>
</legend>
<?php
foreach ($this->fields as $field) {
示例14: defined
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* HUBzero is a registered trademark of Purdue University.
*
* @package hubzero-cms
* @author Steve Snyder <snyder13@purdue.edu>
* @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
* @license http://opensource.org/licenses/MIT MIT
*/
// No direct access
defined('_HZEXEC_') or die;
use Components\Events\Models\Orm\Event as CalEvent;
require_once Component::path('com_events') . DS . 'models' . DS . 'orm' . DS . 'event.php';
/**
* Search events
*/
class plgSearchEvents extends \Hubzero\Plugin\Plugin
{
/**
* Build search query and add it to the $results
*
* @param object $request \Components\Search\Models\Basic\Request
* @param object &$results \Components\Search\Models\Basic\Result\Set
* @param object $authz \Components\Search\Models\Basic\Authorization
* @return void
*/
public static function onSearch($request, &$results, $authz)
{
示例15: displayTask
*
* @package hubzero-cms
* @author HUBzero
* @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
* @license http://opensource.org/licenses/MIT MIT
*/
namespace Components\Members\Admin\Controllers;
use Hubzero\Component\AdminController;
use Filesystem;
use Request;
use Config;
use Route;
use Lang;
use App;
require_once Component::path('com_members') . DS . 'helpers' . DS . 'permissions.php';
/**
* Import PREMIS redistration dump files
*/
class Premis extends AdminController
{
/**
* Display all employer types
*
* @return void
*/
public function displayTask()
{
// Set any errors
if ($this->getError()) {
$this->view->setError($this->getError());