|
|
|
@ -37,7 +37,7 @@ public class Utils {
|
|
|
|
|
* @param preview
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
protected static String convertFileNameAnchorHTML(String url) {
|
|
|
|
|
public static String convertFileNameAnchorHTML(String url) {
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
sb.append("<span style=\"color:gray; font-size:12px;\">shared </span><a class=\"link\" href=\"").append(url).append("\" target=\"_blank\">").append("a file.").append("</a> ").toString();
|
|
|
|
|
return sb.toString();
|
|
|
|
@ -99,7 +99,7 @@ public class Utils {
|
|
|
|
|
* @param postText
|
|
|
|
|
* @return the list of hashtags present in the text
|
|
|
|
|
*/
|
|
|
|
|
protected static List<String> getHashTags(String postText) {
|
|
|
|
|
public static List<String> getHashTags(String postText) {
|
|
|
|
|
List<String> hashtags = new ArrayList<>();
|
|
|
|
|
Pattern MY_PATTERN = Pattern.compile("^#\\w+|\\s#\\w+");
|
|
|
|
|
Matcher matcher = MY_PATTERN.matcher(postText);
|
|
|
|
@ -114,7 +114,7 @@ public class Utils {
|
|
|
|
|
* @param feedText
|
|
|
|
|
* @return the text with the clickable url in it
|
|
|
|
|
*/
|
|
|
|
|
protected static String extractURL(String feedText) {
|
|
|
|
|
public static String extractURL(String feedText) {
|
|
|
|
|
// separate input by spaces ( URLs have no spaces )
|
|
|
|
|
feedText = feedText.replaceAll("(\r\n|\n)"," <br/> ");
|
|
|
|
|
String [] parts = feedText.split("\\s");
|
|
|
|
@ -142,7 +142,7 @@ public class Utils {
|
|
|
|
|
* @param html the html string to escape
|
|
|
|
|
* @return the escaped string
|
|
|
|
|
*/
|
|
|
|
|
protected static String escapeHtmlAndTransformUrl(String html) {
|
|
|
|
|
public static String escapeHtmlAndTransformUrl(String html) {
|
|
|
|
|
if (html == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
@ -164,7 +164,7 @@ public class Utils {
|
|
|
|
|
* @param html the html string to escape
|
|
|
|
|
* @return the escaped string
|
|
|
|
|
*/
|
|
|
|
|
protected static String escapeHtml(String html) {
|
|
|
|
|
public static String escapeHtml(String html) {
|
|
|
|
|
return html.replaceAll("&", "&").replaceAll("<", "<")
|
|
|
|
|
.replaceAll(">", ">");
|
|
|
|
|
}
|
|
|
|
@ -175,7 +175,7 @@ public class Utils {
|
|
|
|
|
* @param feedText
|
|
|
|
|
* @return the text with the clickable url in it
|
|
|
|
|
*/
|
|
|
|
|
protected static String transformUrls(String feedText) {
|
|
|
|
|
public static String transformUrls(String feedText) {
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
// separate input by spaces ( URLs have no spaces )
|
|
|
|
|
String [] parts = feedText.split("\\s");
|
|
|
|
@ -206,7 +206,7 @@ public class Utils {
|
|
|
|
|
* @param item a text token
|
|
|
|
|
* @return the actual http link
|
|
|
|
|
*/
|
|
|
|
|
private static String getHttpToken(String item) {
|
|
|
|
|
public static String getHttpToken(String item) {
|
|
|
|
|
if (item.startsWith("http") || item.startsWith("www") || item.startsWith("(www") || item.startsWith("(http")) {
|
|
|
|
|
if (item.startsWith("("))
|
|
|
|
|
item = item.substring(1, item.length());
|
|
|
|
@ -225,7 +225,7 @@ public class Utils {
|
|
|
|
|
* @param taggedPeople
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
protected static String convertMentionPeopleAnchorHTML(String escapedFeedText, ArrayList<ItemBean> taggedPeople, HttpServletRequest request) {
|
|
|
|
|
public static String convertMentionPeopleAnchorHTML(String escapedFeedText, ArrayList<ItemBean> taggedPeople, HttpServletRequest request) {
|
|
|
|
|
String userProfilePageURL = "";
|
|
|
|
|
userProfilePageURL = PortalContext.getConfiguration().getSiteLandingPagePath(request)+GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
|
|
|
|
|
for (ItemBean tagged : taggedPeople) {
|
|
|
|
@ -244,7 +244,7 @@ public class Utils {
|
|
|
|
|
* @param hashtags
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
protected static String convertHashtagsAnchorHTML(String escapedFeedText, List<String> hashtags) {
|
|
|
|
|
public static String convertHashtagsAnchorHTML(String escapedFeedText, List<String> hashtags) {
|
|
|
|
|
for (String hashtag : hashtags) {
|
|
|
|
|
String taggedHTML = "<a class=\"link\" style=\"font-size:14px;\" href=\"?"+
|
|
|
|
|
new String(Base64.encodeBase64(GCubeSocialNetworking.HASHTAG_OID.getBytes()))+"="+
|
|
|
|
@ -265,7 +265,7 @@ public class Utils {
|
|
|
|
|
* @param link the link to check
|
|
|
|
|
* @return the description guessed
|
|
|
|
|
*/
|
|
|
|
|
private static String createDescriptionFromContent(String link) {
|
|
|
|
|
public static String createDescriptionFromContent(String link) {
|
|
|
|
|
StringBean sb = new StringBean();
|
|
|
|
|
sb.setURL(link);
|
|
|
|
|
sb.setLinks(false);
|
|
|
|
|