本文整理汇总了PHP中JComponentHelper类的典型用法代码示例。如果您正苦于以下问题:PHP JComponentHelper类的具体用法?PHP JComponentHelper怎么用?PHP JComponentHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JComponentHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getInput
public function getInput()
{
jimport('joomla.filesystem.file');
$mainframe = JFactory::getApplication();
if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php')) {
$mainframe->enqueueMessage(JText::_('JM_PLEASE_INSTALL_JOOMLAMAILER'), 'error');
$mainframe->redirect('index.php');
}
$listId = $this->form->getValue('listid', 'params');
require_once JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php';
$params = JComponentHelper::getParams('com_joomailermailchimpintegration');
$MCapi = $params->get('params.MCapi');
$api = new joomlamailerMCAPI($MCapi);
$interests = $api->listInterestGroupings($listId);
$options = array();
if ($interests) {
foreach ($interests as $interest) {
if ($interest['form_field'] != 'hidden') {
$groups = array();
foreach ($interest['groups'] as $ig) {
$groups[] = $ig['name'];
}
$groups = implode('####', $groups);
$options[] = array('id' => $interest['id'] . ';' . $interest['form_field'] . ';' . $interest['name'] . ';' . $groups, 'name' => $interest['name']);
}
}
}
if (count($options)) {
return JHtml::_('select.genericlist', $options, 'jform[params][interests][]', 'multiple="multiple"', 'id', 'name', $this->value, $this->id);
} else {
return JText::_('JM_NO_INTEREST_GROUPS');
}
}
开发者ID:rodhoff,项目名称:MNW,代码行数:33,代码来源:interests.php
示例2: display
/**
* Generates a list of JSON items.
*
* @return void
*/
public function display($tpl = null)
{
$model = $this->getModel();
$this->item = $this->get('Item');
$this->component = $model->getState($model->getName() . '.component');
$this->section = $model->getState($model->getName() . '.section');
$this->asset_id = $model->getState($model->getName() . '.asset_id');
$this->project_id = $model->getState($model->getName() . '.project_id');
$this->inherit = $model->getState($model->getName() . '.inherit');
if (!$this->asset_id && $this->inherit) {
$this->asset_id = $this->getComponentProjectAssetId($this->component, $this->project_id);
}
$this->rules = $this->getAssetRules();
$this->public_groups = array('1', JComponentHelper::getParams('com_users')->get('guest_usergroup', 1));
$user = JFactory::getUser();
if (!$user->authorise('core.admin', $this->component) && !$user->authorise('core.manage', $this->component)) {
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
return false;
}
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
parent::display($tpl);
}
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:31,代码来源:view.raw.php
示例3: onAfterRoute
public function onAfterRoute()
{
$app = JFactory::getApplication();
if($app->isAdmin()){
return;
}
$menus = $app->getMenu('site');
$menu = $menus->getActive();
if(!$menu || $menu->home != 1) return;
$doc = JFactory::getDocument();
if($doc->getType() != 'html') return;
$params = JComponentHelper::getParams('com_xmlrpc');
if($params->get('show_rsd', 1)){
class_exists('XMLRPCHelperRoute') or require(JPATH_SITE.'/components/com_xmlrpc/helpers/route.php');
$link = JRoute::_(XMLRPCHelperRoute::getRsdRoute());
$doc->addHeadLink($link, 'EditURI', 'rel', array('type' => 'application/rsd+xml', 'title'=>'RSD'));
}
if($params->get('show_manifest', 1)){
class_exists('XMLRPCHelperRoute') or require(JPATH_SITE.'/components/com_xmlrpc/helpers/route.php');
$link = JRoute::_(XMLRPCHelperRoute::getManifestRoute());
$doc->addHeadLink($link, 'wlwmanifest', 'rel', array('type'=>'application/wlwmanifest+xml'));
}
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:29,代码来源:rsd.php
示例4: __construct
/**
* constructor (registers additional tasks to methods)
* @return void
*/
function __construct()
{
parent::__construct();
// Set reference to parameters
$this->params = JComponentHelper::getParams('com_chessvn');
//$dummy = $this->params->get('parm_text');
}
开发者ID:khangcodt,项目名称:nvssehcweb,代码行数:11,代码来源:gameoption.php
示例5: display
function display($tpl = null)
{
global $mainframe;
// Check if registration is allowed
$usersConfig =& JComponentHelper::getParams('com_users');
if (!$usersConfig->get('allowUserRegistration')) {
JError::raiseError(403, JText::_('Access Forbidden'));
return;
}
$pathway =& $mainframe->getPathway();
$document =& JFactory::getDocument();
$params =& $mainframe->getParams();
// Page Title
$menus =& JSite::getMenu();
$menu = $menus->getActive();
// because the application sets a default page title, we need to get it
// right from the menu item itself
if (is_object($menu)) {
$menu_params = new JParameter($menu->params);
if (!$menu_params->get('page_title')) {
$params->set('page_title', JText::_('Registration'));
}
} else {
$params->set('page_title', JText::_('Registration'));
}
$document->setTitle($params->get('page_title'));
$pathway->addItem(JText::_('New'));
// Load the form validation behavior
JHTML::_('behavior.formvalidation');
$user =& JFactory::getUser();
$this->assignRef('user', $user);
$this->assignRef('params', $params);
parent::display($tpl);
}
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:34,代码来源:view.html.php
示例6: __construct
function __construct() {
$app = JFactory::getApplication();
parent::__construct();
$config = JFactory::getConfig();
$paramsC = JComponentHelper::getParams('com_phocadownload') ;
$defaultPagination = $paramsC->get( 'default_pagination', '20' );
$file_ordering = $paramsC->get( 'file_ordering', 1 );
$context = $this->_context.'.';
// Get the pagination request variables
$this->setState('limit', $app->getUserStateFromRequest($context.'limit', 'limit', $defaultPagination, 'int'));
$this->setState('limitstart', $app->input->get('limitstart', 0, 'int'));
// In case limit has been changed, adjust limitstart accordingly
$this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0));
$this->setState('filter.language',$app->getLanguageFilter());
$this->setState('fileordering', $app->getUserStateFromRequest($context .'fileordering', 'fileordering', $file_ordering, 'int'));
// Get the filter request variables
$this->setState('filter_order', JRequest::getCmd('filter_order', 'ordering'));
$this->setState('filter_order_dir', JRequest::getCmd('filter_order_Dir', 'ASC'));
}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:29,代码来源:category.php
示例7: populateState
protected function populateState($ordering = null, $direction = null)
{
// Load the component parameters.
$params = JComponentHelper::getParams($this->option);
$this->setState('params', $params);
// Load filter search.
$value = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $value);
// Load filter state.
$value = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string');
$this->setState('filter.state', $value);
// Load filter approved state.
$value = $this->getUserStateFromRequest($this->context . '.filter.approved', 'filter_approved', '', 'string');
$this->setState('filter.approved', $value);
// Load filter featured state.
$value = $this->getUserStateFromRequest($this->context . '.filter.featured', 'filter_featured', '', 'string');
$this->setState('filter.featured', $value);
// Load filter category.
$value = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', 0, 'int');
$this->setState('filter.category_id', $value);
// Load filter type.
$value = $this->getUserStateFromRequest($this->context . '.filter.type_id', 'filter_type_id', 0, 'int');
$this->setState('filter.type_id', $value);
// List state information.
parent::populateState('a.created', 'asc');
}
开发者ID:bellodox,项目名称:CrowdFunding,代码行数:26,代码来源:projects.php
示例8: upload
/**
* @brief Accion que se encarga de manipular el proceso de guardar
* un archivo en el servidor
* @param array $allowedExtensions Arreglo de extensiones validas para el archivo
* @param int $sizeLimit Tamaño maximo permitido del fichero que se sube
*/
function upload($allowedExtensions, $sizeLimit = 10485760)
{
jimport('Amadeus.Util.Uploader');
$media =& JComponentHelper::getParams('com_media');
$postSize = $this->toBytes(ini_get('post_max_size'));
$uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
$mediaSize = (int) $media->get('upload_maxsize');
// Se selecciona el minimo tamaño válido para un fichero, de acuerdo
// a los valores configurados en el php, el joomla y el componente.
$sizeLimit = min($postSize, $uploadSize, $mediaSize, $sizeLimit);
// Se alamacena la imagen en la ruta especificada
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload(JPATH_SITE . '/tmp/', true);
if (!isset($result['error'])) {
jimport('Amadeus.Util.Validation');
$file = $uploader->getName();
$result = AmadeusUtilValidation::isValidFile($file, $only_image);
if (isset($result['error'])) {
jimport('joomla.filesystem.file');
if (!JFile::delete($file)) {
$result = array('error' => JText::_('DELETEERROR'));
}
} else {
$this->_file = $file;
}
}
return $result;
}
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:34,代码来源:File.php
示例9: display
/**
* Display
*
* @param string $tmpl Template
*
* @return void
*/
public function display($tmpl = 'default')
{
$srcs = FabrikHelperHTML::framework();
$app = JFactory::getApplication();
$input = $app->input;
FabrikHelperHTML::script($srcs);
$model = $this->getModel();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
$visualization = $model->getVisualization();
$pluginParams = $model->getPluginParams();
$pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikModel');
$plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization');
$plugin->_row = $visualization;
if ($visualization->published == 0) {
return JError::raiseWarning(500, FText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED'));
}
// Plugin is basically a model
$pluginTask = $input->get('plugintask', 'render', 'request');
// @FIXME cant set params directly like this, but I think plugin model setParams() is not right
$plugin->_params = $pluginParams;
$tmpl = $plugin->getParams()->get('calendar_layout', $tmpl);
$plugin->{$pluginTask}($this);
$this->plugin = $plugin;
$viewName = $this->getName();
$this->addTemplatePath($this->_basePath . '/plugins/' . $this->_name . '/' . $plugin->_name . '/tmpl/' . $tmpl);
$root = $app->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE;
$this->addTemplatePath($root . '/templates/' . $app->getTemplate() . '/html/com_fabrik/visualization/' . $plugin->_name . '/' . $tmpl);
$ab_css_file = JPATH_SITE . '/plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/template.css';
if (JFile::exists($ab_css_file)) {
JHTML::stylesheet('template.css', 'plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true);
}
echo parent::display();
}
开发者ID:ankaau,项目名称:GathBandhan,代码行数:41,代码来源:view.html.php
示例10: addEvForm
function addEvForm()
{
$listid = JRequest::getInt('listid');
$viewName = 'calendar';
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model =& $this->getModel($viewName);
$id = JRequest::getInt('visualizationid', $usersConfig->get('visualizationid', 0));
$model->setId($id);
$model->setupEvents();
if (array_key_exists($listid, $model->_events)) {
$datefield = $model->_events[$listid][0]['startdate'];
} else {
$config = JFactory::getConfig();
$prefix = $config->getValue('config.dbprefix');
$datefield = $prefix . 'fabrik_calendar_events___start_date';
}
$rowid = JRequest::getInt('rowid');
$listModel = JModel::getInstance('list', 'FabrikFEModel');
$listModel->setId($listid);
$table = $listModel->getTable();
JRequest::setVar('view', 'form');
JRequest::setVar('formid', $table->form_id);
JRequest::setVar('tmpl', 'component');
JRequest::setVar('ajax', '1');
$link = 'index.php?option=com_fabrik&view=form&formid=' . $table->form_id . '&rowid=' . $rowid . '&tmpl=component&ajax=1';
$link .= '&jos_fabrik_calendar_events___visualization_id=' . JRequest::getInt('jos_fabrik_calendar_events___visualization_id');
$start_date = JRequest::getVar('start_date', '');
if (!empty($start_date)) {
$link .= "&{$datefield}=" . $start_date;
}
// $$$ rob have to add this to stop the calendar filtering itself after adding an new event?
$link .= '&clearfilters=1';
$this->setRedirect($link);
}
开发者ID:romuland,项目名称:khparts,代码行数:34,代码来源:calendar.php
示例11: addToolbar
protected function addToolbar()
{
$user = JFactory::getUser();
$par = JComponentHelper::getParams('com_djclassifieds');
JToolBarHelper::title(JText::_('COM_DJCLASSIFIEDS_ITEMS'), 'generic.png');
if ($user->authorise('core.create', 'com_djclassifieds')) {
JToolBarHelper::addNew('item.add', 'JTOOLBAR_NEW');
}
if ($user->authorise('core.edit', 'com_djclassifieds')) {
JToolBarHelper::editList('item.edit', 'JTOOLBAR_EDIT');
}
JToolBarHelper::divider();
if ($user->authorise('core.admin', 'com_djclassifieds')) {
if ($par->get('store_org_img', '1') == 1) {
JToolBarHelper::custom('items.recreateThumbnails', 'move', 'move', JText::_('COM_DJCLASSIFIEDS_RECREATE_THUMBNAILS'), true, true);
}
JToolBarHelper::custom('items.resmushitThumbnails', 'loop', 'loop', JText::_('COM_DJCLASSIFIEDS_OPTIMIZE_THUMBNAILS'), true, true);
JToolBarHelper::custom('items.generateCoordinates', 'refresh', 'refresh', JText::_('COM_DJCLASSIFIEDS_GENERATE_COORDINATES'), false, true);
JToolBarHelper::divider();
}
if ($user->authorise('core.edit.state', 'com_djclassifieds')) {
JToolBarHelper::custom('items.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::custom('items.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
JToolBarHelper::custom('items.archive', 'archive.png', 'archive_f2.png', 'JTOOLBAR_ARCHIVE', true);
}
if ($user->authorise('core.delete', 'com_djclassifieds')) {
JToolBarHelper::deleteList('', 'items.delete', 'JTOOLBAR_DELETE');
}
JToolBarHelper::divider();
if ($user->authorise('core.admin', 'com_djclassifieds')) {
JToolBarHelper::preferences('com_djclassifieds', 450, 800);
JToolBarHelper::divider();
}
}
开发者ID:kidaa30,项目名称:lojinha,代码行数:34,代码来源:view.html.php
示例12: display
public function display($tpl = null)
{
$this->option = JFactory::getApplication()->input->get('option');
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
// Get parameters of com_crowdfunding.
/** @var $cParams Joomla\Registry\Registry */
$cParams = JComponentHelper::getParams('com_crowdfunding');
$this->cfParams = $cParams;
$currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->cfParams->get('project_currency'));
$this->amount = new Crowdfunding\Amount($this->cfParams);
$this->amount->setCurrency($currency);
// Get rewards number
$projectsIds = array();
foreach ($this->items as $item) {
$projectsIds[] = $item->id;
}
$projects = new Crowdfunding\Projects(JFactory::getDbo());
$this->transactions = $projects->getTransactionsNumber($projectsIds);
// Prepare sorting data
$this->prepareSorting();
// Prepare actions
$this->addToolbar();
$this->addSidebar();
$this->setDocument();
parent::display($tpl);
}
开发者ID:bellodox,项目名称:CrowdfundingFinance,代码行数:28,代码来源:view.html.php
示例13: save
function save()
{
// Check for request forgeries
JRequest::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN');
$cid = JRequest::getInt("cid", 0);
$post = JRequest::get('post');
if ($cid > 0) {
$club =& JTable::getInstance("Club", "Table");
$club->load($cid);
$club->bind($post);
$params =& JComponentHelper::getParams('com_joomleague');
if ($club->store() && $params->get('cfg_edit_club_info_update_notify') == "1") {
$db = JFactory::getDBO();
$user = JFactory::getUser();
$query = "SELECT email\n FROM #__users \n WHERE usertype = 'Super Administrator' \n OR usertype = 'Administrator'";
$db->setQuery($query);
$to = $db->loadResultArray();
$subject = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_SUBJECT"), $club->name));
$message = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_MESSAGE"), $user->name, $club->name));
$message .= $this->_getShowClubInfoLink();
JUtility::sendMail('', '', $to, $subject, $message);
}
}
$this->setRedirect($this->_getShowClubInfoLink());
}
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:25,代码来源:clubinfo.php
示例14: postflight
public function postflight($action, $adapter)
{
$table = JTable::getInstance('extension');
$component = "com_jevents";
if (!$table->load(array("element" => "com_jevents", "type" => "component"))) {
JFactory::getApplication()->enqueueMessage('Not a valid component', 'error');
return false;
}
$params = JComponentHelper::getParams("com_jevents");
$checkClashes = $params->get("checkclashes", 0);
if ($params->get("noclashes", 0)) {
$params->set("checkconflicts", "2");
} else {
if ($params->get("checkclashes", 0)) {
$params->set("checkconflicts", "1");
}
}
$paramsArray = $params->toArray();
unset($paramsArray['checkclashes']);
unset($paramsArray['noclashes']);
$post['params'] = $paramsArray;
$post['option'] = $component;
$table->bind($post);
// pre-save checks
if (!$table->check()) {
JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
return false;
}
// save the changes
if (!$table->store()) {
JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
return false;
}
return true;
}
开发者ID:pguilford,项目名称:vcomcc,代码行数:35,代码来源:install.php
示例15: getFeeds
function getFeeds()
{
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_jce');
$limit = $params->get('feed_limit', 2);
$feeds = array();
$options = array('rssUrl' => 'http://www.joomlacontenteditor.net/news/feed/rss/latest-news?format=feed', 'cache_time' => $params->get('feed_cachetime', 86400));
// use this directly instead of JFactory::getXMLParserto avoid the feed data error
jimport('simplepie.simplepie');
if (!is_writable(JPATH_BASE . '/cache')) {
$options['cache_time'] = 0;
}
$rss = new SimplePie($options['rssUrl'], JPATH_BASE . '/cache', isset($options['cache_time']) ? $options['cache_time'] : 0);
$rss->force_feed(true);
$rss->handle_content_type();
if ($rss->init()) {
$count = $rss->get_item_quantity();
if ($count) {
$count = $count > $limit ? $limit : $count;
for ($i = 0; $i < $count; $i++) {
$feed = new StdClass();
$item = $rss->get_item($i);
$feed->link = $item->get_link();
$feed->title = $item->get_title();
$feed->description = $item->get_description();
$feeds[] = $feed;
}
}
}
return $feeds;
}
开发者ID:01J,项目名称:bealtine,代码行数:31,代码来源:cpanel.php
示例16: save
public function save()
{
$app = JFactory::getApplication();
$model = $this->getModel('promotion');
$row =& JTable::getInstance('Promotions', 'DJClassifiedsTable');
$par =& JComponentHelper::getParams('com_djclassifieds');
if (!$row->bind(JRequest::get('post'))) {
echo "<script> alert('" . $row->getError() . "');\n\t\t\t\twindow.history.go(-1); </script>\n";
exit;
}
if (!$row->store()) {
echo "<script> alert('" . $row->getError() . "');\n\t\t\t\twindow.history.go(-1); </script>\n";
exit;
}
switch (JRequest::getVar('task')) {
case 'apply':
$link = 'index.php?option=com_djclassifieds&task=promotion.edit&id=' . $row->id;
$msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED');
break;
case 'save2new':
$link = 'index.php?option=com_djclassifieds&task=promotion.add';
$msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED');
break;
case 'saveItem':
default:
$link = 'index.php?option=com_djclassifieds&view=promotions';
$msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED');
break;
}
$app->redirect($link, $msg);
}
开发者ID:politik86,项目名称:test2,代码行数:31,代码来源:promotion.php
示例17: __construct
/**
* creates the lineitem object. $dblineitem is the database object of this line item
*
* @param string $foldername
* @param string $filename
*/
function __construct($foldername, $filename = null)
{
if (is_object($foldername)) {
$this->_file = $foldername;
$foldername = $this->_file->folder;
$filename = $this->_file->file;
}
parent::__construct($foldername, $filename);
$app = JFactory::getApplication();
$params = null;
if ($app instanceof JSite) {
/**
* @var JSite $app
*/
$params = JComponentHelper::getParams('com_eventgallery');
} else {
$params = JComponentHelper::getParams('com_eventgallery');
}
if ($params->get('use_legacy_image_rendering', '0') == '1') {
$this->_image_script_path = "index.php";
}
if (isset($this->_file->exif)) {
$this->exif = json_decode($this->_file->exif);
} else {
$this->exif = new stdClass();
}
}
开发者ID:sansandeep143,项目名称:av,代码行数:33,代码来源:local.php
示例18: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
* @since 1.6
*/
protected function getOptions()
{
$options = array();
$params = JComponentHelper::getParams('com_joomdle');
$app = $params->get('activities');
$option = array('value' => 'no', 'text' => JText::_('COM_JOOMDLE_NONE'));
$options[] = $option;
$option = array('value' => 'jomsocial', 'text' => 'Jomsocial');
$options[] = $option;
// Add sources added via plugins
JPluginHelper::importPlugin('joomdleactivities');
$dispatcher = JDispatcher::getInstance();
$more_sources = $dispatcher->trigger('onGetActivitiesSource', array());
if (is_array($more_sources)) {
foreach ($more_sources as $source) {
$keys = array_keys($source);
$key = $keys[0];
$source_name = array_shift($source);
$option['value'] = $key;
$option['text'] = $source_name;
$options[] = $option;
}
}
return $options;
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:31,代码来源:activities.php
示例19: GeoCode
static function GeoCode($address, $returnBox = false)
{
$params =& JComponentHelper::getParams('com_webmapplus');
$key = $params->get('gmaps_api_key', '');
$request = "http://maps.google.com/maps/geo?q=" . urlencode($address) . "&key={$key}";
if (function_exists("curl_version")) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
$page = curl_exec($ch);
curl_close($ch);
} elseif (ini_get('allow_url_fopen') == 1) {
$page = file_get_contents($request);
} else {
echo "cURL is not installed and allow_url_fopen is false. Can not continue.";
die;
return false;
}
//Silly Google doesn't use UTF-8 Encoding
$page = mb_convert_encoding($page, 'UTF-8', mb_detect_encoding($page, 'UTF-8, ISO-8859-1', true));
$data = json_decode($page);
if ($data->Status->code == "200") {
if (!$returnBox) {
return $data->Placemark[0]->Point->coordinates;
} else {
return $data->Placemark[0]->ExtendedData->LatLonBox;
}
} else {
return $data->Status->code;
}
}
开发者ID:notWood,项目名称:webmapplus,代码行数:32,代码来源:webmapplus.php
示例20: postflight
/**
* Called after any type of action
*
* @param string $route Which action is happening (install|uninstall|discover_install)
* @param jadapterinstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function postflight($route, JAdapterInstance $adapter)
{
if (strtolower($route) == 'install') {
$element = $adapter->get('element');
// Restore assets from backup
PFInstallerHelper::restoreAssets($element);
// Make the admin component menu item a child of com_projectfork
PFInstallerHelper::setComponentMenuItem($element);
// Create a menu item in the projectfork site menu
$com = JComponentHelper::getComponent($element);
$eid = is_object($com) && isset($com->id) ? $com->id : 0;
if ($eid) {
$item = array();
$item['title'] = 'Time Tracking';
$item['alias'] = 'timetracking';
$item['link'] = 'index.php?option=' . $element . '&view=timesheet';
$item['component_id'] = $eid;
PFInstallerHelper::addMenuItem($item);
}
}
if (strtolower($route) == 'update') {
$element = $adapter->get('element');
// Make the admin component menu item a child of com_projectfork
PFInstallerHelper::setComponentMenuItem($element);
}
return true;
}
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:35,代码来源:script.php
注:本文中的JComponentHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论