本文整理汇总了PHP中SourceFactory类的典型用法代码示例。如果您正苦于以下问题:PHP SourceFactory类的具体用法?PHP SourceFactory怎么用?PHP SourceFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SourceFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
global $sugar_config;
require_once 'include/connectors/sources/SourceFactory.php';
require_once 'include/connectors/utils/ConnectorUtils.php';
$source_id = $_REQUEST['source_id'];
$connector_language = ConnectorUtils::getConnectorStrings($source_id);
$source = SourceFactory::getSource($source_id);
$properties = $source->getProperties();
$required_fields = array();
$config_fields = $source->getRequiredConfigFields();
$fields = $source->getRequiredConfigFields();
foreach ($fields as $field_id) {
$label = isset($connector_language[$field_id]) ? $connector_language[$field_id] : $field_id;
$required_fields[$field_id] = $label;
}
// treat string as a template (the string resource plugin is unavailable in the current Smarty version)
if (isset($connector_language['LBL_LICENSING_INFO'])) {
$siteUrl = rtrim($sugar_config['site_url'], '/');
$connector_language['LBL_LICENSING_INFO'] = str_replace('{$SITE_URL}', $siteUrl, $connector_language['LBL_LICENSING_INFO']);
}
$this->ss->assign('required_properties', $required_fields);
$this->ss->assign('source_id', $source_id);
$this->ss->assign('properties', $properties);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('app', $GLOBALS['app_strings']);
$this->ss->assign('connector_language', $connector_language);
$this->ss->assign('hasTestingEnabled', $source->hasTestingEnabled());
echo $this->ss->fetch($this->getCustomFilePathIfExists('modules/Connectors/tpls/source_properties.tpl'));
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:30,代码来源:view.sourceproperties.php
示例2: display
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings;
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
$required_fields = array();
//Get required fields for first connector only
$connectorsToShow = $connectors;
foreach ($connectors as $id => $entry) {
$s = SourceFactory::getSource($id);
$connector_strings = ConnectorUtils::getConnectorStrings($id);
$fields = $s->getRequiredConfigFields();
if (!$s->isEnabledInAdminProperties() || empty($fields)) {
unset($connectorsToShow[$id]);
} else {
if (empty($required_fields)) {
foreach ($fields as $field_id) {
$label = isset($connector_strings[$field_id]) ? $connector_strings[$field_id] : $field_id;
$required_fields[$id][$field_id] = $label;
}
}
}
}
$this->ss->assign('SOURCES', $connectorsToShow);
$this->ss->assign('REQUIRED_FIELDS', $required_fields);
// Handle active tab selection
$active_tab = isset($_REQUEST['active_tab']) ? $_REQUEST['active_tab'] : null;
$this->ss->assign('ACTIVE_TAB', $active_tab);
echo $this->getModuleTitle(false);
$this->ss->display($this->getCustomFilePathIfExists('modules/Connectors/tpls/modify_properties.tpl'));
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:37,代码来源:view.modifyproperties.php
示例3: display
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings;
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
$required_fields = array();
//Get required fields for first connector only
$connectorsToShow = $connectors;
foreach ($connectors as $id => $entry) {
$s = SourceFactory::getSource($id);
$connector_strings = ConnectorUtils::getConnectorStrings($id);
$fields = $s->getRequiredConfigFields();
if (empty($fields)) {
unset($connectorsToShow[$id]);
} else {
if (empty($required_fields)) {
foreach ($fields as $field_id) {
$label = isset($connector_strings[$field_id]) ? $connector_strings[$field_id] : $field_id;
$required_fields[$id][$field_id] = $label;
}
}
}
}
$this->ss->assign('SOURCES', $connectorsToShow);
$this->ss->assign('REQUIRED_FIELDS', $required_fields);
echo $this->getModuleTitle();
$this->ss->display('modules/Connectors/tpls/modify_properties.tpl');
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:34,代码来源:view.modifyproperties.php
示例4: display
function display()
{
global $mod_strings, $app_strings;
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
$sugar_smarty = new Sugar_Smarty();
$sugar_smarty->assign('mod', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
$required_fields = array();
//Get required fields for first connector only
foreach ($connectors as $id => $entry) {
$s = SourceFactory::getSource($id);
$connector_strings = ConnectorUtils::getConnectorStrings($id);
$fields = $s->getRequiredConfigFields();
foreach ($fields as $field_id) {
$label = isset($connector_strings[$field_id]) ? $connector_strings[$field_id] : $field_id;
$required_fields[$id][$field_id] = $label;
}
break;
}
$sugar_smarty->assign('SOURCES', $connectors);
$sugar_smarty->assign('REQUIRED_FIELDS', $required_fields);
echo get_module_title('Connectors', $mod_strings['LBL_MODIFY_PROPERTIES_PAGE_TITLE'], true);
$sugar_smarty->display('modules/Connectors/tpls/modify_properties.tpl');
}
开发者ID:klr2003,项目名称:sourceread,代码行数:26,代码来源:view.modifyproperties.php
示例5: getEAPM
/**
* gets twitter EAPM
* @return array|bool|ExternalAPIBase
*/
public function getEAPM()
{
// ignore auth and load to just check if connector configured
$twitterEAPM = ExternalAPIFactory::loadAPI('Twitter', true);
if (!$twitterEAPM) {
$source = SourceFactory::getSource('ext_rest_twitter');
if ($source && $source->hasTestingEnabled()) {
try {
if (!$source->test()) {
return array('error' => 'ERROR_NEED_OAUTH');
}
} catch (Exception $e) {
return array('error' => 'ERROR_NEED_OAUTH');
}
}
return array('error' => 'ERROR_NEED_OAUTH');
}
$twitterEAPM->getConnector();
$eapmBean = EAPM::getLoginInfo('Twitter');
if (empty($eapmBean->id)) {
return array('error' => 'ERROR_NEED_AUTHORIZE');
}
//return a fully authed EAPM
$twitterEAPM = ExternalAPIFactory::loadAPI('Twitter');
return $twitterEAPM;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:30,代码来源:TwitterApi.php
示例6: filterAPIList
/**
* Filter the list of APIs, removing disabled ones
* @param array $apiFullList
* @return array Filtered list
*/
public static function filterAPIList($apiFullList)
{
$filteredList = array();
foreach ($apiFullList as $name => $data) {
if (isset($data['connector'])) {
if (ConnectorUtils::eapmEnabled($data['connector'])) {
if (isset($data['authMethod']) && $data['authMethod'] == 'oauth') {
$connector = SourceFactory::getSource($data['connector'], false);
if (!empty($connector) && $connector->propertyExists('oauth_consumer_key') && $connector->isRequiredConfigFieldsSet()) {
$filteredList[$name] = $data;
}
} elseif (isset($data['authMethod']) && $data['authMethod'] == 'oauth2') {
$connector = SourceFactory::getSource($data['connector'], false);
if (!empty($connector) && $connector->isRequiredConfigFieldsSet()) {
$filteredList[$name] = $data;
}
} else {
$filteredList[$name] = $data;
}
}
} else {
$filteredList[$name] = $data;
}
}
return $filteredList;
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:31,代码来源:ExternalAPIFactory.php
示例7: filterAPIList
/**
* Filter the list of APIs, removing disabled ones
* @param array $apiFullList
* @return array Filtered list
*/
public static function filterAPIList($apiFullList)
{
$filteredList = array();
foreach ($apiFullList as $name => $data) {
if (isset($data['connector'])) {
if (ConnectorUtils::eapmEnabled($data['connector'])) {
if (isset($data['authMethod']) && $data['authMethod'] == 'oauth') {
$connector = SourceFactory::getSource($data['connector'], false);
if (!empty($connector)) {
$key = $connector->getProperty('oauth_consumer_key');
$secret = $connector->getProperty('oauth_consumer_secret');
if (!empty($key) && !empty($secret)) {
$filteredList[$name] = $data;
}
}
} else {
$filteredList[$name] = $data;
}
}
} else {
$filteredList[$name] = $data;
}
}
return $filteredList;
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:30,代码来源:ExternalAPIFactory.php
示例8: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
$source = $_REQUEST['source_id'];
$sources = ConnectorUtils::getConnectors();
$modules_sources = ConnectorUtils::getDisplayConfig();
$enabled_modules = array();
$disabled_modules = array();
//Find all modules this source has been enabled for
foreach ($modules_sources as $module => $mapping) {
foreach ($modules_sources[$module] as $entry) {
if ($entry == $source) {
$enabled_modules[$module] = isset($GLOBALS['app_list_strings']['moduleList'][$module]) ? $GLOBALS['app_list_strings']['moduleList'][$module] : $module;
}
}
}
global $moduleList, $beanList;
//Do filtering here?
$count = 0;
global $current_user;
$access = $current_user->getDeveloperModules();
foreach (SugarAutoLoader::getDirFiles("modules", true) as $e) {
//Strip the 'modules/' portion out from beginning of $e
$e = substr($e, 8);
if (empty($enabled_modules[$e]) && SugarAutoLoader::existingCustomOne("modules/{$e}/metadata/studio.php") && SugarAutoLoader::fileExists('modules/' . $e . '/metadata/detailviewdefs.php') && isset($GLOBALS['beanList'][$e]) && (in_array($e, $access) || is_admin($current_user))) {
$disabled_modules[$e] = isset($GLOBALS['app_list_strings']['moduleList'][$e]) ? $GLOBALS['app_list_strings']['moduleList'][$e] : $e;
}
}
$s = SourceFactory::getSource($source);
// Not all sources can be connected to all modules
$enabled_modules = $s->filterAllowedModules($enabled_modules);
$disabled_modules = $s->filterAllowedModules($disabled_modules);
asort($enabled_modules);
asort($disabled_modules);
//$enabled = $json->encode($enabled_modules);
//$disabled = $json->encode($disabled_modules);
//$script = "addTable('{$module}', '{$enabled}', '{$disabled}', '{$source}', '{$GLOBALS['theme']}');\n";
//$this->ss->assign('new_modules_sources', $modules_sources);
//$this->ss->assign('dynamic_script', $script);
$this->ss->assign('enabled_modules', $enabled_modules);
$this->ss->assign('disabled_modules', $disabled_modules);
$this->ss->assign('source_id', $source);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('theme', $GLOBALS['theme']);
$this->ss->assign('external', !empty($sources[$source]['eapm']));
$this->ss->assign('externalOnly', !empty($sources[$source]['eapm']['only']));
// We don't want to tell the user to set the properties of the connector if there aren't any
$fields = $s->getRequiredConfigFields();
$this->ss->assign('externalHasProperties', !empty($fields));
$this->ss->assign('externalChecked', !empty($sources[$source]['eapm']['enabled']) ? " checked" : "");
echo $this->ss->fetch($this->getCustomFilePathIfExists('modules/Connectors/tpls/display_properties.tpl'));
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:56,代码来源:view.displayproperties.php
示例9: getInstance
public static function getInstance($source_name)
{
if (empty(self::$source_map[$source_name])) {
require_once 'include/connectors/sources/SourceFactory.php';
require_once 'include/connectors/component.php';
$source = SourceFactory::getSource($source_name);
$component = new component();
$component->setSource($source);
$component->init();
self::$source_map[$source_name] = $component;
}
return self::$source_map[$source_name];
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:13,代码来源:ConnectorFactory.php
示例10: newsSearch
/**
* Returns the API key given by the user
* @param ServiceBase $api
* @param array $args Arguments array built by the service base
* @return null
*/
public function newsSearch(ServiceBase $api, array $args)
{
$source = 'ext_rest_nytsearch';
$s = SourceFactory::getSource($source);
$config = $s->getConfig();
$apiKey = $config['properties']['api_key'];
$url = "http://api.nytimes.com/svc/search/v2/articlesearch.json?hl=1&q=" . $args['query'] . "&api-key=" . $apiKey;
$curl = curl_init();
curl_setopt_array($curl, array(CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $url));
$resp = curl_exec($curl);
curl_close($curl);
return $resp;
}
开发者ID:delkyd,项目名称:examples,代码行数:19,代码来源:NytDashletApi.php
示例11: run
public function run()
{
// must be upgrading from 6.7.5+
if (!version_compare($this->from_version, '6.7.4', '>') || !version_compare($this->from_version, '7.0.0', '<')) {
return;
}
// remove data_widget_id from custom config file
$source = SourceFactory::getSource("ext_rest_twitter");
if ($source && $source->getProperty('data_widget_id')) {
$properties = $source->getProperties();
unset($properties['data_widget_id']);
$source->setProperties($properties);
$source->saveConfig();
}
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:15,代码来源:7_RemoveTwitterWidgetId.php
示例12: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
$source_id = $_REQUEST['source_id'];
$connector_strings = ConnectorUtils::getConnectorStrings($source_id);
$is_enabled = ConnectorUtils::isSourceEnabled($source_id);
$modules_sources = array();
$sources = ConnectorUtils::getConnectors();
$display_data = array();
if ($is_enabled) {
$searchDefs = ConnectorUtils::getSearchDefs();
$searchDefs = !empty($searchDefs[$_REQUEST['source_id']]) ? $searchDefs[$_REQUEST['source_id']] : array();
$source = SourceFactory::getSource($_REQUEST['source_id']);
$field_defs = $source->getFieldDefs();
//Create the Javascript code to dynamically add the tables
$json = getJSONobj();
foreach ($searchDefs as $module => $fields) {
$disabled = array();
$enabled = array();
$enabled_fields = array_flip($fields);
$field_keys = array_keys($field_defs);
foreach ($field_keys as $index => $key) {
if (!empty($field_defs[$key]['hidden']) || empty($field_defs[$key]['search'])) {
continue;
}
if (!isset($enabled_fields[$key])) {
$disabled[$key] = !empty($connector_strings[$field_defs[$key]['vname']]) ? $connector_strings[$field_defs[$key]['vname']] : $key;
} else {
$enabled[$key] = !empty($connector_strings[$field_defs[$key]['vname']]) ? $connector_strings[$field_defs[$key]['vname']] : $key;
}
}
$modules_sources[$module] = array_merge($enabled, $disabled);
asort($disabled);
$display_data[$module] = array('enabled' => $enabled, 'disabled' => $disabled);
}
}
$this->ss->assign('no_searchdefs_defined', !$is_enabled);
$this->ss->assign('display_data', $display_data);
$this->ss->assign('modules_sources', $modules_sources);
$this->ss->assign('sources', $sources);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('source_id', $_REQUEST['source_id']);
$this->ss->assign('theme', $GLOBALS['theme']);
$this->ss->assign('connector_language', $connector_strings);
echo $this->ss->fetch('modules/Connectors/tpls/search_properties.tpl');
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:51,代码来源:view.searchproperties.php
示例13: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
$connectors = ConnectorUtils::getConnectors(true);
foreach ($connectors as $id => $source) {
$s = SourceFactory::getSource($id);
if (!$s->isEnabledInAdminDisplay()) {
unset($connectors[$id]);
}
}
$this->ss->assign('SOURCES', $connectors);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('theme', $GLOBALS['theme']);
echo $this->getModuleTitle(false);
$this->ss->display($this->getCustomFilePathIfExists('modules/Connectors/tpls/modify_display.tpl'));
}
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:20,代码来源:view.modifydisplay.php
示例14: getPopup
/**
* Get popup for sources
*
* @param array $shown_sources
* @param mixed $module
* @param mixed $smarty
* @return string
*/
private function getPopup(array $shown_sources, $module, $smarty)
{
global $app_strings;
$code = '';
$menuParams = 'var menuParams = "';
$formatterCode = '';
$sourcesDisplayed = 0;
$singleIcon = '';
foreach ($shown_sources as $id) {
$formatter = FormatterFactory::getInstance($id);
$formatter->setModule($module);
$formatter->setSmarty($smarty);
$buttonCode = $formatter->getDetailViewFormat();
if (!empty($buttonCode)) {
$sourcesDisplayed++;
$singleIcon = $formatter->getIconFilePath();
$source = SourceFactory::getSource($id);
$config = $source->getConfig();
$name = !empty($config['name']) ? $config['name'] : $id;
//Create the menu item to call show_[source id] method in javascript
$menuParams .= '<a href=\'#\' style=\'width:150px\' class=\'menuItem\' onmouseover=\'hiliteItem(this,\\"yes\\");\'' . ' onmouseout=\'unhiliteItem(this);\' onclick=\'show_' . $id . '(event);\'>' . $name . '</a>';
$formatterCode .= $buttonCode;
}
}
//for
if (!empty($formatterCode)) {
if ($sourcesDisplayed > 1) {
$dswidget_img = SugarThemeRegistry::current()->getImageURL('MoreDetail.png');
$code = '<!--not_in_theme!--><img id="dswidget_img" src="' . $dswidget_img . '" width="11" height="7" border="0" alt="' . $app_strings['LBL_CONNECTORS_POPUPS'] . '" onclick="return showConnectorMenu2(this);">';
} else {
$dswidget_img = SugarThemeRegistry::current()->getImageURL('MoreDetail.png');
$singleIcon = empty($singleIcon) ? $dswidget_img : $singleIcon;
$code = '<!--not_in_theme!--><img id="dswidget_img" border="0" src="' . $singleIcon . '" alt="' . $app_strings['LBL_CONNECTORS_POPUPS'] . '" onclick="return showConnectorMenu2(this);">';
}
$code .= "<script type='text/javascript' src='{sugar_getjspath file='include/connectors/formatters/default/company_detail.js'}'></script>\n";
$code .= "<script type='text/javascript'>\n";
$code .= "function showConnectorMenu2(el) {literal} { {/literal}\n";
$menuParams .= '";';
$code .= $menuParams . "\n";
$code .= "return SUGAR.util.showHelpTips(el,menuParams);\n";
$code .= "{literal} } {/literal}\n";
$code .= "</script>\n";
$code .= $formatterCode;
}
return $code;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:54,代码来源:ConnectorHtmlHelper.php
示例15: getInstance
public static function getInstance($source_name)
{
if (empty(self::$source_map[$source_name])) {
require_once 'include/connectors/sources/SourceFactory.php';
require_once 'include/connectors/component.php';
$source = SourceFactory::getSource($source_name);
if (empty($source)) {
$GLOBALS['log']->fatal("Failed to load source {$source_name}");
return false;
}
$component = new component();
$component->setSource($source);
$component->init();
self::$source_map[$source_name] = $component;
}
return self::$source_map[$source_name];
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:17,代码来源:ConnectorFactory.php
示例16: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
global $mod_strings, $app_strings;
$sugar_smarty = new Sugar_Smarty();
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors();
foreach ($connectors as $id => $source) {
$s = SourceFactory::getSource($id);
if (!$s->isEnabledInAdminSearch() || !$s->isEnabledInWizard()) {
unset($connectors[$id]);
}
}
$this->ss->assign('SOURCES', $connectors);
echo $this->getModuleTitle(false);
$this->ss->display($this->getCustomFilePathIfExists('modules/Connectors/tpls/modify_search.tpl'));
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:21,代码来源:view.modifysearch.php
示例17: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
global $mod_strings, $app_strings;
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
foreach ($connectors as $id => $source) {
$s = SourceFactory::getSource($id);
$mapping = $s->getMapping();
if (!$s->isEnabledInAdminMapping() || empty($mapping)) {
unset($connectors[$id]);
}
}
$this->ss->assign('SOURCES', $connectors);
echo $this->getModuleTitle(false);
$this->ss->display($this->getCustomFilePathIfExists('modules/Connectors/tpls/modify_mapping.tpl'));
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:22,代码来源:view.modifymapping.php
示例18: display
function display()
{
require_once 'include/connectors/sources/SourceFactory.php';
require_once 'include/connectors/utils/ConnectorUtils.php';
$source_id = $_REQUEST['source_id'];
$connector_language = ConnectorUtils::getConnectorStrings($source_id);
$source = SourceFactory::getSource($source_id);
$properties = $source->getProperties();
$required_fields = array();
$config_fields = $source->getRequiredConfigFields();
$fields = $source->getRequiredConfigFields();
foreach ($fields as $field_id) {
$label = isset($connector_language[$field_id]) ? $connector_language[$field_id] : $field_id;
$required_fields[$field_id] = $label;
}
$this->ss->assign('required_properties', $required_fields);
$this->ss->assign('source_id', $source_id);
$this->ss->assign('properties', $properties);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('app', $GLOBALS['app_strings']);
$this->ss->assign('connector_language', $connector_language);
$this->ss->assign('hasTestingEnabled', $source->hasTestingEnabled());
echo $this->ss->fetch('modules/Connectors/tpls/source_properties.tpl');
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:24,代码来源:view.sourceproperties.php
示例19: action_RunTest
function action_RunTest()
{
$this->view = 'ajax';
$source_id = $_REQUEST['source_id'];
$source = SourceFactory::getSource($source_id);
$properties = array();
foreach ($_REQUEST as $name => $value) {
if (preg_match("/^{$source_id}_(.*?)\$/", $name, $matches)) {
$properties[$matches[1]] = $value;
}
}
$source->setProperties($properties);
$source->saveConfig();
//Call again and call init
$source = SourceFactory::getSource($source_id);
$source->init();
global $mod_strings;
try {
if ($source->isRequiredConfigFieldsForButtonSet() && $source->test()) {
echo $mod_strings['LBL_TEST_SOURCE_SUCCESS'];
} else {
echo $mod_strings['LBL_TEST_SOURCE_FAILED'];
}
} catch (Exception $ex) {
$GLOBALS['log']->fatal($ex->getMessage());
echo $ex->getMessage();
}
}
开发者ID:nartnik,项目名称:sugarcrm_test,代码行数:28,代码来源:controller.php
示例20: getConnector
/**
* Get connector for this API
* @return source|null
*/
public function getConnector()
{
if (isset($this->connector)) {
if (empty($this->connector_source)) {
$this->connector_source = SourceFactory::getSource($this->connector, false);
$this->connector_source->setEAPM($this);
}
return $this->connector_source;
}
return null;
}
开发者ID:omusico,项目名称:sugar_work,代码行数:15,代码来源:ExternalAPIBase.php
注:本文中的SourceFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论