Changeset 16309
- Timestamp:
- Jul 2, 2012, 11:53:27 PM (12 years ago)
- Location:
- extensions/TweetThis
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/TweetThis/main.inc.php
r16049 r16309 28 28 ); 29 29 30 // urls and position for index 31 if (script_basename() == 'picture') 32 { 33 $template->assign('TWEET_URL', get_absolute_root_url().duplicate_picture_url()); 34 } 35 else if (script_basename() == 'index') 36 { 37 $conf['TweetThis']['position'] = 'index'; 38 $template->assign('TWEET_URL', get_absolute_root_url().duplicate_index_url()); 39 } 40 41 // config 30 42 $template->assign(array( 43 'TWEET_POSITION' => $conf['TweetThis']['position'], 31 44 'TWEET_SIZE' => $conf['TweetThis']['size'], 32 45 'TWEET_COUNT' => $conf['TweetThis']['count'], 33 46 'TWEET_VIA' => $conf['TweetThis']['via'], 34 47 )); 35 36 if (script_basename() == 'picture')37 {38 $template->assign('TWEET_POSITON', $conf['TweetThis']['position']);39 $template->assign('TWEET_URL', get_absolute_root_url().duplicate_picture_url());40 $template->set_prefilter('picture', 'tweet_add_button_prefilter');41 }42 else if (script_basename() == 'index')43 {44 $template->assign('TWEET_POSITON', 'index');45 $template->assign('TWEET_URL', get_absolute_root_url().duplicate_index_url());46 $template->set_prefilter('index', 'tweet_add_button_prefilter');47 }48 48 49 49 // button language … … 60 60 $template->assign('TWEET_LANG', 'en'); 61 61 } 62 63 64 $template->set_filename('tweet_button', dirname(__FILE__).'/button.tpl'); 65 $button = $template->parse('tweet_button', true); 66 67 switch ($conf['TweetThis']['position']) 68 { 69 case 'index': 70 $template->concat('PLUGIN_INDEX_ACTIONS', '<li>'.$button.'</li>'); 71 break; 72 case 'toolbar': 73 $template->concat('PLUGIN_PICTURE_ACTIONS', $button); 74 break; 75 default; 76 $template->assign('TWEET_BUTTON', $button); 77 $template->set_prefilter('picture', 'tweet_add_button_prefilter'); 78 } 62 79 } 63 80 … … 66 83 global $template; 67 84 68 $replace = '{combine_script id=\'twitter_widgets\' path=\'http://platform.twitter.com/widgets.js}69 <a href="https://twitter.com/share" class="twitter-share-button"70 data-url="{$TWEET_URL}" data-lang="{$TWEET_LANG}" {if not empty($TWEET_VIA)}data-via="{$TWEET_VIA}"{/if}71 {if $TWEET_SIZE=="large"}data-size="large"{/if} {if not $TWEET_COUNT}data-count="none"{/if}>Tweet</a>';72 85 switch ($template->get_template_vars('TWEET_POSITON')) 73 86 { 74 87 case 'top': 75 88 $search = '<div id="theImage">'; 76 $replace = '<div> '.$replace.'</div>';89 $replace = '<div>{$TWEET_BUTTON}</div>'; 77 90 break; 78 91 79 92 case 'bottom': 80 93 $search = '{$ELEMENT_CONTENT}'; 81 break; 82 83 case 'toolbar': 84 $search = '<div class="actionButtons">'; 85 break; 86 87 case 'index': 88 $search = '<ul class="categoryActions">'; 89 $replace = '<li>'.$replace.'</li>'; 94 $replace = '{$TWEET_BUTTON}'; 90 95 break; 91 96 }
Note: See TracChangeset
for help on using the changeset viewer.