本文整理汇总了PHP中Loader::definePathConstants方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::definePathConstants方法的具体用法?PHP Loader::definePathConstants怎么用?PHP Loader::definePathConstants使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::definePathConstants方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authControl
public function authControl()
{
$config = Config::getInstance();
Loader::definePathConstants();
$this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/hellothinkup/view/hellothinkup.account.index.tpl');
$this->addToView('message', 'Hello ThinkUp world! This is an example plugin configuration page for ' . $this->owner->email . '.');
$this->view_mgr->addHelp('hellothinkup', 'contribute/developers/plugins/buildplugin');
/** set option fields **/
// name text field
$name_field = array('name' => 'testname', 'label' => 'Your Name', 'size' => 40);
// set element name and label
$name_field['default_value'] = 'ThinkUp User';
// set default value
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $name_field);
// add element
// set testname header
$this->addPluginOptionHeader('testname', 'User Info');
// add a header for an element
// set a special required message
$this->addPluginOptionRequiredMessage('testname', 'Please enter a name, because we\'d really like to have one...');
// gender radio field
$gender_field = array('name' => 'testradio', 'label' => 'You Like');
// set an element name and label
$gender_field['values'] = array('Cookies' => 1, 'Cake' => 2, 'Other' => 3);
$gender_field['default_value'] = '3';
// set default value
$this->addPluginOption(self::FORM_RADIO_ELEMENT, $gender_field);
// add element
// Birth Year Select
$bday_field = array('name' => 'testbirthyear', 'label' => 'Select The Year You Were Born');
$years = array();
$i = 1900;
while ($i <= 2010) {
$years['Born in ' . $i] = $i;
$i++;
}
$bday_field['values'] = $years;
$bday_field['default_value'] = '2005';
$this->addPluginOption(self::FORM_SELECT_ELEMENT, $bday_field);
// Enable registration stuff
$reg_field = array('name' => 'testregopen', 'label' => 'Open Registration');
$this->addPluginOptionHeader('testregopen', 'Registration Options');
$reg_field['values'] = array('Open' => 1, 'Closed' => 0);
$this->addPluginOption(self::FORM_RADIO_ELEMENT, $reg_field);
// registration key
$reg_key = array('name' => 'RegKey', 'validation_regex' => '^\\d+$');
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $reg_key);
$this->setPluginOptionNotRequired('RegKey');
$this->addPluginOptionRequiredMessage('RegKey', 'Please enter interger value for RegKey');
// advanced data
$adv1 = array('name' => 'AdvancedInfo1', 'label' => '1st advanced field', 'advanced' => true);
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $adv1);
$this->setPluginOptionNotRequired('AdvancedInfo1');
// by default not required
$adv2 = array('name' => 'AdvancedInfo2', 'label' => '2nd advanced field', 'advanced' => true);
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $adv2);
$plugin = new HelloThinkUpPlugin();
$this->addToView('is_configured', $plugin->isConfigured());
return $this->generateView();
}
示例2: authControl
public function authControl()
{
$config = Config::getInstance();
Loader::definePathConstants();
$this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/geoencoder/view/geoencoder.account.index.tpl');
$this->view_mgr->addHelp('geoencoder', 'userguide/settings/plugins/geoencoder');
$this->addToView('message', 'This is the GeoEncoder plugin configuration page for ' . $this->owner->email . '.');
/** set option fields **/
// gmaps_api_key text field
$name_field = array('name' => 'gmaps_api_key', 'label' => 'Google Maps API Key', 'size' => 55);
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $name_field);
$this->addPluginOptionRequiredMessage('gmaps_api_key', 'Please enter your Google Maps API Key');
// distance_unit radio field
$distance_unit_field = array('name' => 'distance_unit', 'label' => 'Unit of Distance');
$distance_unit_field['values'] = array('Kilometers' => 'km', 'Miles' => 'mi');
$distance_unit_field['default_value'] = 'km';
$this->addPluginOption(self::FORM_RADIO_ELEMENT, $distance_unit_field);
$plugin = new GeoEncoderPlugin();
if (!$plugin->isConfigured()) {
$this->addInfoMessage('Please complete plugin setup to start using it.', 'setup');
$this->addToView('is_configured', false);
} else {
$this->addToView('is_configured', true);
}
$this->addToView('thinkup_site_url', Utils::getApplicationURL());
return $this->generateView();
}
示例3: authControl
public function authControl()
{
$config = Config::getInstance();
Loader::definePathConstants();
$this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/facebook/view/facebook.account.index.tpl');
$this->view_mgr->addHelp('facebook', 'userguide/settings/plugins/facebook');
/** set option fields **/
// Application ID text field
$this->addPluginOption(self::FORM_TEXT_ELEMENT, array('name' => 'facebook_app_id', 'label' => 'App ID', 'size' => 18));
// add element
// set a special required message
$this->addPluginOptionRequiredMessage('facebook_app_id', 'The Facebook plugin requires a valid App ID.');
// Application Secret text field
$this->addPluginOption(self::FORM_TEXT_ELEMENT, array('name' => 'facebook_api_secret', 'label' => 'App Secret', 'size' => 37));
// add element
// set a special required message
$this->addPluginOptionRequiredMessage('facebook_api_secret', 'The Facebook plugin requires a valid App Secret.');
$max_crawl_time_label = 'Max crawl time in minutes';
$max_crawl_time = array('name' => 'max_crawl_time', 'label' => $max_crawl_time_label, 'default_value' => '20', 'advanced' => true, 'size' => 3);
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $max_crawl_time);
$this->addToView('thinkup_site_url', Utils::getApplicationURL());
$facebook_plugin = new FacebookPlugin();
if ($facebook_plugin->isConfigured()) {
$this->setUpFacebookInteractions($facebook_plugin->getOptionsHash());
$this->addToView('is_configured', true);
} else {
$this->addInfoMessage('Please complete plugin setup to start using it.', 'setup');
$this->addToView('is_configured', false);
}
return $this->generateView();
}
示例4: authControl
public function authControl()
{
$config = Config::getInstance();
Loader::definePathConstants();
$this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/twitter/view/twitter.account.hashtag.tpl');
$this->view_mgr->addHelp('twitterhashtag', 'userguide/settings/plugins/twitter/savedsearches');
if (isset($this->instance_username) && $this->instance_username != '') {
$this->addToView('user', $this->instance_username);
$instance_dao = DAOFactory::getDAO('InstanceDAO');
$instance = $instance_dao->getByUsername($this->instance_username, 'twitter');
if (isset($instance)) {
$this->addToView('instance', $instance);
$hashtaginstance_dao = DAOFactory::getDAO('InstanceHashtagDAO');
$hashtags = $hashtaginstance_dao->getByUsername($this->instance_username, 'twitter');
if (isset($hashtags)) {
$this->addToView('hashtags', $hashtags);
}
} else {
$this->addErrorMessage("Twitter user @" . $this->instance_username . " does not exist.");
}
} else {
$this->addErrorMessage("User undefined.");
}
return $this->generateView();
}
示例5: __construct
/**
* Private Constructor
* @param array $vals Optional values to override file config
* @return Config
*/
private function __construct($vals = null)
{
if ($vals != null) {
$this->config = $vals;
} else {
Loader::definePathConstants();
if (file_exists(EFC_WEBAPP_PATH . 'config.inc.php')) {
require EFC_WEBAPP_PATH . 'config.inc.php';
$this->config = $EFC_CFG;
//set version info...
/*
require EFC_WEBAPP_PATH . 'install/version.php';
$this->config['EFC_VERSION'] = $EFC_VERSION;
$this->config['EFC_VERSION_REQUIRED'] =
array('php' => $EFC_VERSION_REQUIRED['php'], 'mysql' => $EFC_VERSION_REQUIRED['mysql']);
*/
} else {
throw new ConfigurationException("EFC's configuration file does not exist! " . "Try installing EFC.");
}
}
foreach (array_keys(self::$defaults) as $default) {
if (!isset($this->config[$default])) {
$this->config[$default] = self::$defaults[$default];
}
}
}
示例6: authControl
public function authControl()
{
$config = Config::getInstance();
Loader::definePathConstants();
$this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/twitter/view/twitter.account.index.tpl');
$this->view_mgr->addHelp('twitter', 'userguide/settings/plugins/twitter/index');
$instance_dao = DAOFactory::getDAO('InstanceDAO');
// get plugin option values if defined...
$plugin_options = $this->getPluginOptions();
$oauth_consumer_key = $this->getPluginOption('oauth_consumer_key');
$oauth_consumer_secret = $this->getPluginOption('oauth_consumer_secret');
$archive_limit = $this->getPluginOption('archive_limit');
$num_twitter_errors = $this->getPluginOption('num_twitter_errors');
$this->addToView('twitter_app_name', "ThinkUp " . $_SERVER['SERVER_NAME']);
$this->addToView('thinkup_site_url', Utils::getApplicationURL(true));
$plugin = new TwitterPlugin();
if ($plugin->isConfigured()) {
$this->addToView('is_configured', true);
$owner_instances = $instance_dao->getByOwnerAndNetwork($this->owner, 'twitter');
$this->addToView('owner_instances', $owner_instances);
if (isset($this->owner) && $this->owner->isMemberAtAnyLevel()) {
if ($this->owner->isMemberLevel()) {
if (sizeof($owner_instances) > 0) {
$this->do_show_add_button = false;
$this->addInfoMessage("To connect another Twitter account to ThinkUp, upgrade your membership.", 'membership_cap');
}
}
}
if (isset($_GET['oauth_token']) || $this->do_show_add_button) {
$twitter_oauth = new TwitterOAuth($oauth_consumer_key, $oauth_consumer_secret);
/* Request tokens from twitter */
$token_array = $twitter_oauth->getRequestToken(Utils::getApplicationURL(true) . "account/?p=twitter");
if (isset($token_array['oauth_token']) || isset($_SESSION["MODE"]) && $_SESSION["MODE"] == "TESTS" || getenv("MODE") == "TESTS") {
//testing
$token = $token_array['oauth_token'];
SessionCache::put('oauth_request_token_secret', $token_array['oauth_token_secret']);
if (isset($_GET['oauth_token'])) {
self::addAuthorizedUser($oauth_consumer_key, $oauth_consumer_secret, $num_twitter_errors);
}
if ($this->do_show_add_button) {
/* Build the authorization URL */
$oauthorize_link = $twitter_oauth->getAuthorizeURL($token);
$this->addToView('oauthorize_link', $oauthorize_link);
}
} else {
//set error message here
$this->addErrorMessage("Unable to obtain OAuth tokens from Twitter. Please double-check the consumer key and secret " . "are correct.", "setup");
$oauthorize_link = '';
$this->addToView('is_configured', false);
}
}
} else {
$this->addInfoMessage('Please complete plugin setup to start using it.', 'setup');
$this->addToView('is_configured', false);
}
// add plugin options from
$this->addOptionForm();
return $this->generateView();
}
示例7: authControl
/**
* @return str
*/
public function authControl()
{
$config = Config::getInstance();
Loader::definePathConstants();
$this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/twitterrealtime/view/twitterrealtime.account.index.tpl');
$this->view_mgr->addHelp('twitterrealtime', 'userguide/settings/plugins/twitterrealtime');
$id = DAOFactory::getDAO('InstanceDAO');
$od = DAOFactory::getDAO('OwnerDAO');
// get plugin option values if defined...
$plugin_options = $this->getPluginOptions();
// get oauth option values from twitter plugin.
// @TODO -- what is the right way to do this?
$plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
$twitter_options = $plugin_option_dao->getOptionsHash('twitter', true);
$oauth_consumer_key = null;
if (isset($twitter_options['oauth_consumer_key'])) {
$oauth_consumer_key = $twitter_options['oauth_consumer_key']->option_value;
}
$oauth_consumer_secret = null;
if (isset($twitter_options['oauth_consumer_secret'])) {
$oauth_consumer_secret = $twitter_options['oauth_consumer_secret']->option_value;
}
// @TODO - get any other option values as necessary
// $archive_limit = $this->getPluginOption('archive_limit');
$auth_from_twitter = '';
if (isset($oauth_consumer_key) && isset($oauth_consumer_secret)) {
$to = new TwitterOAuth($oauth_consumer_key, $oauth_consumer_secret);
/* Request tokens from twitter */
$tok = $to->getRequestToken();
if (isset($tok['oauth_token'])) {
$token = $tok['oauth_token'];
$_SESSION['oauth_request_token_secret'] = $tok['oauth_token_secret'];
/* Build the authorization URL */
$oauthorize_link = $to->getAuthorizeURL($token);
// create indication that auth from twitter plugin is okay
$auth_from_twitter = "Using the Twitter Consumer key and secret as set in " . "the <a href=\"./?p=twitter\">Twitter plugin</a>.";
} else {
//set error message here
$this->addErrorMessage("Unable to obtain OAuth token. Check your Twitter plugin consumer key and secret configuration.");
$oauthorize_link = '';
}
} else {
$this->addErrorMessage("Missing required settings! Please configure the Twitter plugin.");
$oauthorize_link = '';
}
$owner_instances = $id->getByOwnerAndNetwork($this->owner, 'twitter');
$this->addToView('owner_instances', $owner_instances);
$this->addToView('oauthorize_link', $oauthorize_link);
$this->addToView('auth_from_twitter', $auth_from_twitter);
// add plugin options from
$this->addOptionForm();
$plugin = new TwitterRealtimePlugin();
$this->addToView('is_configured', $plugin->isConfigured());
return $this->generateView();
}
示例8: __construct
/**
* Constructor
* @param bool $session_started
* @return ThreadJSController
*/
public function __construct($session_started = false)
{
parent::__construct($session_started);
foreach ($this->REQUIRED_PARAMS as $param) {
if (!isset($_GET[$param]) || $_GET[$param] == '') {
$this->is_missing_param = true;
}
}
Loader::definePathConstants();
$this->setViewTemplate(THINKUP_WEBAPP_PATH . '_lib/view/api.embed.v1.thread_js.tpl');
}
示例9: __construct
public function __construct()
{
$config = Config::getInstance();
if ($config->getValue('recaptcha_enable')) {
$this->type = self::RECAPTCHA_CAPTCHA;
Loader::definePathConstants();
require_once EFC_WEBAPP_PATH . '_lib/extlib/recaptcha-php-1.10/recaptchalib.php';
} else {
$this->type = self::THINKUP_CAPTCHA;
}
}
示例10: __construct
public function __construct($session_started = false, $reqs = null)
{
//Explicitly set TZ (before we have user's choice) to avoid date() warning about using system settings
Utils::setDefaultTimezonePHPini();
Loader::definePathConstants();
//Don't call parent constructor because config.inc.php doesn't exist yet
//Instead, set up the view manager with manual array configuration
$cfg_array = array('site_root_path' => Utils::getSiteRootPathFromFileSystem(), 'source_root_path' => THINKUP_ROOT_PATH, 'datadir_path' => THINKUP_WEBAPP_PATH . 'data/', 'debug' => false, 'app_title_prefix' => '', 'cache_pages' => false);
$this->view_mgr = new ViewManager($cfg_array);
$this->setPageTitle('Install ThinkUp');
$this->disableCaching();
$this->reqs = $reqs;
}
示例11: control
/**
* Generates the calling JavaScript to create embedded thread on calling page.
* @return str JavaScript source
*/
public function control()
{
Loader::definePathConstants();
$this->setViewTemplate(THINKUP_WEBAPP_PATH . '_lib/view/api.embed.v1.embed.tpl');
$this->setContentType('text/javascript');
if (!$this->is_missing_param) {
$this->addToView('post_id', $_GET['p']);
$this->addToView('network', $_GET['n']);
} else {
$this->addErrorMessage('No ThinkUp thread specified.');
}
return $this->generateView();
}
示例12: getInstalledInsightPlugins
private function getInstalledInsightPlugins()
{
// Detect what plugins exist in the filesystem; parse their header comments for plugin metadata
Loader::definePathConstants();
$installed_plugins = array();
foreach (glob(THINKUP_WEBAPP_PATH . "plugins/insightsgenerator/insights/*.php") as $includefile) {
$fhandle = fopen($includefile, "r");
$contents = fread($fhandle, filesize($includefile));
fclose($fhandle);
$plugin_vals = $this->parseFileContents($contents);
array_push($installed_plugins, $plugin_vals);
}
return $installed_plugins;
}
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:14,代码来源:class.InsightsGeneratorPluginConfigurationController.php
示例13: authControl
public function authControl()
{
// Get an instance
$config = Config::getInstance();
// Set up some constants
Loader::definePathConstants();
// Set the view to the account index page for this plugin
$this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/foursquare/view/foursquare.account.index.tpl');
// URL to the help page for this plugin
$this->view_mgr->addHelp('foursquare', 'userguide/settings/plugins/foursquare');
// Set some option fields on the template page
// Set the client ID text field
$name_field = array('name' => 'foursquare_client_id', 'label' => 'Client ID', 'size' => 48);
// Set the default value to be blank
$name_field['default_value'] = '';
// Add the element to the page
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $name_field);
// Set a message saying this field is required
$this->addPluginOptionRequiredMessage('foursquare_client_id', 'A client id is requried to use foursquare');
// Set the client secret field
$name_field = array('name' => 'foursquare_client_secret', 'label' => 'Client Secret', 'size' => 48);
// Set the default value to be blank
$name_field['default_value'] = '';
// Add the element to the page
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $name_field);
// Set a message saying this field is required
$this->addPluginOptionRequiredMessage('foursquare_client_secret', 'A client secret is requried to use foursquare');
// Get a data access object so we can get the options for the plugin from the database
$plugin_option_dao = DAOFactory::getDAO('PluginOptionDAO');
// Get a cached hash of the options from the database
$options = $plugin_option_dao->getOptionsHash('foursquare', true);
// Create a new plugin object
$plugin = new FoursquarePlugin();
// If the plugin is configured
if ($plugin->isConfigured()) {
// Set up the interactions
$this->setUpFoursquareInteractions($options);
// Indicate on the view that this plugin is configured
$this->addToView('is_configured', true);
} else {
// If the plugin isn't configured
// Tell the user that this plugin needs configuring
$this->addInfoMessage('Please complete plugin setup to start using it', 'setup');
// Indicate on the view that this plugin is not configured
$this->addToView('is_configured', false);
}
$this->addToView('thinkup_site_url', Utils::getApplicationURL());
// Display the foursquare account index page
return $this->generateView();
}
示例14: __construct
public function __construct($session_started = false)
{
parent::__construct($session_started);
$config = Config::getInstance();
Loader::definePathConstants();
$this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/twitter/view/auth.tpl');
$this->setPageTitle('Authorizing Your Twitter Account');
if (!isset($_GET['oauth_token']) || $_GET['oauth_token'] == '') {
$this->addInfoMessage('No OAuth token specified.');
$this->is_missing_param = true;
}
if (!SessionCache::isKeySet('oauth_request_token_secret') || SessionCache::get('oauth_request_token_secret') == '') {
$this->addInfoMessage('Secret token not set.');
$this->is_missing_param = true;
}
}
示例15: authControl
public function authControl()
{
$config = Config::getInstance();
Loader::definePathConstants();
$this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/youtube/view/account.index.tpl');
$this->view_mgr->addHelp('youtube', 'userguide/settings/plugins/youtube');
/* set option fields **/
// client ID text field
$name_field = array('name' => 'youtube_client_id', 'label' => 'Client ID', 'size' => 50);
$name_field['default_value'] = '';
// set default value
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $name_field);
// add element
// set a special required message
$this->addPluginOptionRequiredMessage('youtube_client_id', 'A client ID is required to use YouTube.');
// client secret text field
$name_field = array('name' => 'youtube_client_secret', 'label' => 'Client secret', 'size' => 40);
$name_field['default_value'] = '';
// set default value
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $name_field);
// add element
// set a special required message
$this->addPluginOptionRequiredMessage('youtube_client_secret', 'A client secret is required to use YouTube.');
// Three optional fields that will be useful for very active YouTubers
$max_crawl_time_label = 'Max crawl time in minutes';
$max_crawl_time = array('name' => 'max_crawl_time', 'label' => $max_crawl_time_label, 'default_value' => '20', 'advanced' => true, 'size' => 3);
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $max_crawl_time);
$developer_key_label = 'YouTube Developer Key';
$developer_key = array('name' => 'developer_key', 'label' => $developer_key_label, 'default_value' => '', 'advanced' => true, 'size' => 40);
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $developer_key);
$comments_label = 'Maximum Comments to Collect';
$comments = array('name' => 'max_comments', 'label' => $comments_label, 'default_value' => '', 'advanced' => true, 'size' => 5);
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $comments);
$plugin_option_dao = DAOFactory::getDAO('PluginOptionDAO');
$options = $plugin_option_dao->getOptionsHash('youtube', true);
//get cached
$plugin = new YouTubePlugin();
if ($plugin->isConfigured()) {
$this->setUpYouTubeInteractions($options);
$this->addToView('is_configured', true);
} else {
$this->addInfoMessage('Please complete plugin setup to start using it.', 'setup');
$this->addToView('is_configured', false);
}
$this->addToView('thinkup_site_url', Utils::getApplicationURL());
return $this->generateView();
}