本文整理汇总了PHP中Utils::getPluginViewDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::getPluginViewDirectory方法的具体用法?PHP Utils::getPluginViewDirectory怎么用?PHP Utils::getPluginViewDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils
的用法示例。
在下文中一共展示了Utils::getPluginViewDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: control
/**
* Main control method
* @return Page markup
*/
public function control() {
if ($this->shouldRefreshCache()) {
$this->setViewTemplate(Utils::getPluginViewDirectory('geoencoder').'geoencoder.map.iframe.tpl');
$this->setPageTitle('Locate Post on Map');
$post_dao = DAOFactory::getDAO('PostDAO');
$plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
$options = $plugin_option_dao->getOptionsHash('geoencoder', true);
if (isset($options['gmaps_api_key']->option_value)) {
$api_key = $options['gmaps_api_key']->option_value;
} else {
$api_key = NULL;
}
$network = (isset($_GET['n']))?$_GET['n']:'twitter';
$type = (isset($_GET['t']))?$_GET['t']:'post';
$post_id = (isset($_GET['pid']))?$_GET['pid']:'post_id';
$post = $post_dao->getPost($post_id, $network);
if ($type == 'post' && isset($post) && $post->is_geo_encoded == 1) {
$this->addToView('post', $post);
$this->addHeaderJavaScript('plugins/geoencoder/assets/js/generatemap.js');
$this->addToView('gmaps_api', $api_key);
$post_rows = $post_dao->getRelatedPostsArray($post_id, $network, !$this->isLoggedIn());
$posts_json = $this->processLocations($post_rows, $post_id);
$this->addToView('posts_data', $posts_json);
} else {
$this->addErrorMessage('This post has not been geoencoded yet; cannot display map.');
}
}
return $this->generateView();
}
示例2: getPostDetailMenuItems
public function getPostDetailMenuItems($post) {
$menus = array();
$map_template_path = Utils::getPluginViewDirectory('geoencoder').'geoencoder.map.tpl';
//Define a menu item
$map_menu_item = new MenuItem("Response Map", "", $map_template_path, 'Geoencoder');
//Define a dataset to be displayed when that menu item is selected
$map_menu_item_dataset_1 = new Dataset("geoencoder_map", 'PostDAO', "getRelatedPosts",
array($post->post_id, $post->network, 'location') );
//Associate dataset with menu item
$map_menu_item->addDataset($map_menu_item_dataset_1);
//Add menu item to menu
$menus["geoencoder_map"] = $map_menu_item;
$nearest_template_path = Utils::getPluginViewDirectory('geoencoder').'geoencoder.nearest.tpl';
//Define a menu item
$nearest_menu_item = new MenuItem("Nearest Responses", "", $nearest_template_path);
//Define a dataset to be displayed when that menu item is selected
$nearest_dataset = new Dataset("geoencoder_nearest", 'PostDAO', "getRelatedPosts",
array($post->post_id, $post->network, !Session::isLoggedIn()));
//Associate dataset with menu item
$nearest_menu_item->addDataset($nearest_dataset);
$nearest_dataset_2 = new Dataset("geoencoder_options", 'PluginOptionDAO', 'getOptionsHash',
array('geoencoder', true));
$nearest_menu_item->addDataset($nearest_dataset_2);
//Add menu item to menu
$menus["geoencoder_nearest"] = $nearest_menu_item;
return $menus;
}
示例3: getPostDetailMenuItems
public function getPostDetailMenuItems($post) {
$template_path = Utils::getPluginViewDirectory('hellothinkup').'hellothinkup.inline.view.tpl';
$menu_items = array();
//Define a menu item
$hello_menu_item_1 = new MenuItem("Data vis 1", "First data visualization", $template_path,
'Hello ThinkUp Plugin Menu Header');
//Define a dataset to be displayed when that menu item is selected
$hello_menu_item_dataset_1 = new Dataset("replies_1", 'PostDAO', "getRepliesToPost",
array($post->post_id, $post->network, 'location') );
//Associate dataset with menu item
$hello_menu_item_1->addDataset($hello_menu_item_dataset_1);
//Add menu item to menu items array
$menu_items['data_vis_1'] = $hello_menu_item_1;
//Define a menu item
$hello_menu_item_2 = new MenuItem("Data vis 2", "Second data visualization", $template_path);
//Define a dataset to be displayed when that menu item is selected
$hello_menu_item_dataset_2 = new Dataset("replies_2", 'PostDAO', "getRepliesToPost",
array($post->post_id, $post->network, 'location') );
//Associate dataset with menu item
$hello_menu_item_2->addDataset($hello_menu_item_dataset_2);
//Add menu item to menu items array
$menu_items['data_vis_2'] = $hello_menu_item_2;
return $menu_items;
}
示例4: getPostDetailMenuItems
public function getPostDetailMenuItems($post){
$data_tpl = Utils::getPluginViewDirectory('embedthread').'embedthread.inline.view.tpl';
$menus = array();
$embed_menu_item = new MenuItem("Embed Thread", '', $data_tpl, 'Share and Publish');
$menus["embed_thread"] = $embed_menu_item;
return $menus;
}
示例5: testgetPluginViewDirectory
function testgetPluginViewDirectory()
{
global $THINKTANK_CFG;
$path = Utils::getPluginViewDirectory('twitter');
$this->assertEqual($path, $THINKTANK_CFG['source_root_path'] . 'webapp/plugins/twitter/view/');
$path = Utils::getPluginViewDirectory('sweetmaryjane');
$this->assertEqual($path, $THINKTANK_CFG['source_root_path'] . 'webapp/plugins/sweetmaryjane/view/');
}
示例6: testgetPluginViewDirectory
public function testgetPluginViewDirectory()
{
$config = Config::getInstance();
$path = Utils::getPluginViewDirectory('twitter');
$this->assertEqual(realpath($path), realpath(THINKUP_WEBAPP_PATH . 'plugins/twitter/view'));
$path = Utils::getPluginViewDirectory('sweetmaryjane');
$this->assertEqual(realpath($path), realpath($config->getValue('source_root_path') . '/webapp/plugins/sweetmaryjane/view/'));
}
示例7: testgetPluginViewDirectory
public function testgetPluginViewDirectory()
{
$config = Config::getInstance();
$path = Utils::getPluginViewDirectory('twitter');
$this->assertEqual($path, $config->getValue('source_root_path') . 'webapp/plugins/twitter/view/');
$path = Utils::getPluginViewDirectory('sweetmaryjane');
$this->assertEqual($path, $config->getValue('source_root_path') . 'webapp/plugins/sweetmaryjane/view/');
}
示例8: testGetTab
/**
* Test getTab
*/
public function testGetTab()
{
$webapp = Webapp::getInstance();
$config = Config::getInstance();
$webapp->registerPlugin('twitter', "TwitterPlugin");
$webapp->setActivePlugin('twitter');
$instance = new Instance();
$instance->network_user_id = 930061;
$tab = $webapp->getTab('tweets-all', $instance);
$this->assertIsA($tab, 'WebappTab');
$this->assertEqual($tab->view_template, Utils::getPluginViewDirectory('twitter') . 'twitter.inline.view.tpl', "Template ");
$this->assertEqual($tab->short_name, 'tweets-all', "Short name");
$this->assertEqual($tab->name, 'All', "Name");
$this->assertEqual($tab->description, 'All tweets', "Description");
$this->assertIsA($tab->datasets, 'array');
$this->assertEqual(sizeOf($tab->datasets), 1);
$tab = $webapp->getTab('nonexistent', $instance);
$this->assertEqual($tab, null);
}
示例9: sendDigestSinceWithTemplate
/**
* Send out insight email digest for a given time period.
* @param Owner $owner Owner to send for
* @param str $start When to start insight lookup
* @param str $template Email view template to use
* @param array $options Plugin options
* return bool Whether email was sent
*/
private function sendDigestSinceWithTemplate($owner, $start, $template, &$options)
{
$insights_dao = DAOFactory::GetDAO('InsightDAO');
$start_time = date('Y-m-d H:i:s', strtotime($start, $this->current_timestamp));
$insights = $insights_dao->getAllOwnerInstanceInsightsSince($owner->id, $start_time);
if (count($insights) == 0) {
return false;
}
$config = Config::getInstance();
$view = new ViewManager();
$view->caching = false;
// If we've got a Mandrill key and template, send HTML
if ($config->getValue('mandrill_api_key') != null && !empty($options['mandrill_template'])) {
$view->assign('insights', $insights);
$insights = $view->fetch(Utils::getPluginViewDirectory($this->folder_name) . '_email.insights_html.tpl');
$parameters = array();
$parameters['insights'] = $insights;
$parameters['app_title'] = $config->getValue('app_title_prefix') . "ThinkUp";
$parameters['app_url'] = Utils::getApplicationURL();
$parameters['unsub_url'] = Utils::getApplicationURL() . 'account/index.php?m=manage#instances';
// It's a weekly digest if we're going back more than a day or two.
$days_ago = ($this->current_timestamp - strtotime($start)) / (60 * 60 * 24);
$parameters['weekly_or_daily'] = $days_ago > 2 ? 'Weekly' : 'Daily';
try {
Mailer::mailHTMLViaMandrillTemplate($owner->email, 'ThinkUp has new insights for you!', $options['mandrill_template']->option_value, $parameters);
return true;
} catch (Mandrill_Unknown_Template $e) {
// In this case, we'll fall back to plain text sending and warn the user in the log
$logger = Logger::getInstance();
$logger->logUserError("Invalid mandrill template configured:" . $options['mandrill_template']->option_value . ".", __METHOD__ . ',' . __LINE__);
unset($options['mandrill_template']);
}
}
$view->assign('apptitle', $config->getValue('app_title_prefix') . "ThinkUp");
$view->assign('application_url', Utils::getApplicationURL());
$view->assign('insights', $insights);
$message = $view->fetch(Utils::getPluginViewDirectory($this->folder_name) . $template);
list($subject, $message) = explode("\n", $message, 2);
Mailer::mail($owner->email, $subject, $message);
return true;
}
示例10: sendInvalidOAuthEmailAlert
/**
* Send user email alert about invalid OAuth tokens, at most one message per week.
* In test mode, this will only write the message body to a file in the application data directory.
* @param str $email
* @param str $username
*/
private function sendInvalidOAuthEmailAlert($email, $username)
{
//Determine whether or not an email about invalid tokens was sent in the past 7 days
$should_send_email = true;
$option_dao = DAOFactory::getDAO('OptionDAO');
$plugin_dao = DAOFactory::getDAO('PluginDAO');
$plugin_id = $plugin_dao->getPluginId('instagram');
$last_email_timestamp = $option_dao->getOptionByName(OptionDAO::PLUGIN_OPTIONS . '-' . $plugin_id, 'invalid_oauth_email_sent_timestamp');
if (isset($last_email_timestamp)) {
//option exists, a message was sent
//a message was sent in the past week
if ($last_email_timestamp->option_value > strtotime('-1 week')) {
$should_send_email = false;
} else {
$option_dao->updateOption($last_email_timestamp->option_id, time());
}
} else {
$option_dao->insertOption(OptionDAO::PLUGIN_OPTIONS . '-' . $plugin_id, 'invalid_oauth_email_sent_timestamp', time());
}
if ($should_send_email) {
$mailer_view_mgr = new ViewManager();
$mailer_view_mgr->caching = false;
$mailer_view_mgr->assign('thinkup_site_url', Utils::getApplicationURL());
$mailer_view_mgr->assign('email', $email);
$mailer_view_mgr->assign('faceboook_user_name', $username);
$message = $mailer_view_mgr->fetch(Utils::getPluginViewDirectory('instagram') . '_email.invalidtoken.tpl');
Mailer::mail($email, "Please re-authorize ThinkUp to access " . $username . " on Instagram", $message);
}
}
示例11: getPostDetailMenuItems
/**
* @param Post $post
* @return array MenuItems
*/
public function getPostDetailMenuItems($post)
{
$twitter_data_tpl = Utils::getPluginViewDirectory('twitter') . 'twitter.post.retweets.tpl';
$menus = array();
if ($post->network == 'twitter') {
$retweets_menu_item = new MenuItem("Retweets", "Retweets of this tweet", $twitter_data_tpl, 'Twitter');
//if not logged in, show only public retweets
$retweets_dataset = new Dataset("retweets", 'PostDAO', "getRetweetsOfPost", array($post->post_id, 'twitter', 'default', 'km', !Session::isLoggedIn()));
$retweets_menu_item->addDataset($retweets_dataset);
$menus['fwds'] = $retweets_menu_item;
// aju
$favd_menu_item = new MenuItem("Favorited", "Those who favorited this tweet", $twitter_data_tpl);
//if not logged in, show only public fav'd info
$favd_dataset = new Dataset("favds", 'FavoritePostDAO', "getFavdsOfPost", array($post->post_id, 'twitter', !Session::isLoggedIn()));
$favd_menu_item->addDataset($favd_dataset);
$menus['favs'] = $favd_menu_item;
}
return $menus;
}
示例12: getDashboardMenuItems
/**
* Get Dashboard menu
* @param $instance Instance
* @return array of MenuItem objects (Tweets, Friends, Followers, etc)
*/
public function getDashboardMenuItems($instance)
{
// An array to store our list of menu items in
$menus = array();
// Set the view template to checkins.tpl
$checkins_data_tpl = Utils::getPluginViewDirectory('foursquare') . 'checkins.tpl';
// Add a checkins link to the list of pages on the left
$checkins_menu_item = new MenuItem("Checkins", "Your checkins", $checkins_data_tpl);
// Get the data for our checkins link
$checkins_menu_ds_1 = new Dataset("all_checkins", 'PostDAO', "getAllCheckins", array($instance->network_user_id, $instance->network, 15, "#page_number#"));
$checkins_menu_ds_1->addHelp('userguide/listings/foursquare/dashboard_posts');
$checkins_menu_item->addDataset($checkins_menu_ds_1);
// Add the checkins to our array of items
$menus['posts'] = $checkins_menu_item;
// Return the list of items we want to display
return $menus;
}
示例13: getPostDetailMenuItems
/**
* @param Post $post
* @return array MenuItems
*/
public function getPostDetailMenuItems($post)
{
$twitter_data_tpl = Utils::getPluginViewDirectory('twitter') . 'twitter.post.retweets.tpl';
$menus = array();
$rt_plugin_active = false;
$plugin_dao = DAOFactory::getDAO('PluginDAO');
$plugin_id = $plugin_dao->getPluginId('twitterrealtime');
if (isset($plugin_id)) {
$rt_plugin_active = $plugin_dao->isPluginActive($plugin_id);
}
if ($post->network == 'twitter') {
$retweets_menu_item = new MenuItem("Retweets", "Retweets of this tweet", $twitter_data_tpl);
//if not logged in, show only public retweets
$retweets_dataset = new Dataset("retweets", 'PostDAO', "getRetweetsOfPost", array($post->post_id, 'twitter', 'default', 'km', !Session::isLoggedIn()));
$retweets_menu_item->addDataset($retweets_dataset);
$menus['fwds'] = $retweets_menu_item;
if ($rt_plugin_active) {
$favd_menu_item = new MenuItem("Favorited", "Those who favorited this tweet", $twitter_data_tpl);
//if not logged in, show only public fav'd info
$favd_dataset = new Dataset("favds", 'FavoritePostDAO', "getUsersWhoFavedPost", array($post->post_id, 'twitter', !Session::isLoggedIn()));
$favd_menu_item->addDataset($favd_dataset);
$menus['favs'] = $favd_menu_item;
}
}
return $menus;
}
示例14: getDashboardMenuItems
public function getDashboardMenuItems($instance) {
$fb_data_tpl = Utils::getPluginViewDirectory('facebook').'facebook.inline.view.tpl';
$menus = array();
//All tab
$alltab = new MenuItem("All", '', $fb_data_tpl, 'Posts');
$alltabds = new Dataset("all_facebook_posts", 'PostDAO', "getAllPosts",
array($instance->network_user_id, $instance->network, 15, "#page_number#"),
'getAllPostsIterator', array($instance->network_user_id, $instance->network, GridController::MAX_ROWS), false );
$alltab->addDataset($alltabds);
$menus["all_facebook_posts"] = $alltab;
// Most replied-to tab
$mrttab = new MenuItem("Most replied-to", "Posts with most replies", $fb_data_tpl);
$mrttabds = new Dataset("most_replied_to_posts", 'PostDAO', "getMostRepliedToPosts",
array($instance->network_user_id, $instance->network, 15, '#page_number#'));
$mrttab->addDataset($mrttabds);
$menus["mostreplies"] = $mrttab;
//Questions tab
$qtab = new MenuItem("Inquiries", "Inquiries, or posts with a question mark in them",
$fb_data_tpl);
$qtabds = new Dataset("all_facebook_posts", 'PostDAO', "getAllQuestionPosts",
array($instance->network_user_id, $instance->network, 15, "#page_number#"));
$qtab->addDataset($qtabds);
$menus["questions"] = $qtab;
return $menus;
}
示例15: testGetPostDetailMenuItem
public function testGetPostDetailMenuItem()
{
$webapp = Webapp::getInstance();
$config = Config::getInstance();
$webapp->registerPlugin('twitter', "TwitterPlugin");
$webapp->setActivePlugin('twitter');
$post = new Post(array('id' => 1, 'author_user_id' => 10, 'author_username' => 'no one', 'author_fullname' => "No One", 'author_avatar' => 'yo.jpg', 'source' => 'TweetDeck', 'pub_date' => '', 'adj_pub_date' => '', 'in_reply_to_user_id' => '', 'in_reply_to_post_id' => '', 'reply_count_cache' => '', 'in_retweet_of_post_id' => '', 'retweet_count_cache' => '', 'retweet_count_api' => '', 'old_retweet_count_cache' => '', 'in_rt_of_user_id' => '', 'post_id' => 9021481076.0, 'is_protected' => 0, 'place_id' => 'ece7b97d252718cc', 'favlike_count_cache' => 0, 'post_text' => 'I look cookies', 'network' => 'twitter', 'geo' => '', 'place' => '', 'location' => '', 'is_geo_encoded' => 0, 'is_reply_by_friend' => 0, 'is_retweet_by_friend' => 0, 'reply_retweet_distance' => 0));
$menu_item = $webapp->getPostDetailMenuItem('fwds', $post);
$this->assertIsA($menu_item, 'MenuItem');
$this->assertEqual($menu_item->view_template, Utils::getPluginViewDirectory('twitter') . 'twitter.post.retweets.tpl', "Template ");
$this->assertEqual($menu_item->name, 'Retweets', "Name");
$this->assertEqual($menu_item->description, 'Retweets of this tweet', "Description");
$this->assertIsA($menu_item->datasets, 'array');
$this->assertEqual(sizeOf($menu_item->datasets), 1);
$menu_item = $webapp->getPostDetailMenuItem('nonexistent', $post);
$this->assertEqual($menu_item, null);
}