/** * Strips the macro delimiters from the given input, * for example <code>%(key)</code> or <code>${key}</code> becomes <code>key</code>.<p> * * In case the input is not a macro, <code>null</code> is returned.<p> * * @param input the input to strip * * @return the macro stripped from the input, or <code>null</code> */ public static String stripMacro(String input) { if (isMacro(input)) { return input.substring(2, input.length() - 1); } return null; }
/** * Returns <code>true</code> if the given input String is a macro equal to the given macro name.<p> * * @param input the input to check for a macro * @param macroName the macro name to check for * * @return <code>true</code> if the given input String is a macro equal to the given macro name */ public static boolean isMacro(String input, String macroName) { if (isMacro(input)) { return input.substring(2, input.length() - 1).equals(macroName); } return false; }
/** * Returns <code>true</code> if the given input String is a macro equal to the given macro name.<p> * * @param input the input to check for a macro * @param macroName the macro name to check for * * @return <code>true</code> if the given input String is a macro equal to the given macro name */ public static boolean isMacro(String input, String macroName) { if (isMacro(input)) { return input.substring(2, input.length() - 1).equals(macroName); } return false; }
/** * Strips the macro delimiters from the given input, * for example <code>%(key)</code> or <code>${key}</code> becomes <code>key</code>.<p> * * In case the input is not a macro, <code>null</code> is returned.<p> * * @param input the input to strip * * @return the macro stripped from the input, or <code>null</code> */ public static String stripMacro(String input) { if (isMacro(input)) { return input.substring(2, input.length() - 1); } return null; }
/** * @see org.opencms.widgets.A_CmsWidget#getWidgetStringValue(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter) */ @Override public String getWidgetStringValue(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) { String result = param.getStringValue(cms); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(result) && !"0".equals(result)) { try { result = getCalendarLocalizedTime( widgetDialog.getLocale(), widgetDialog.getMessages(), Long.parseLong(result)); } catch (NumberFormatException e) { if (!CmsMacroResolver.isMacro(result, CmsMacroResolver.KEY_CURRENT_TIME)) { // neither long nor macro, show empty value result = ""; } } } else { result = ""; } return result; }
/** * @see org.opencms.widgets.A_CmsWidget#getWidgetStringValue(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter) */ @Override public String getWidgetStringValue(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) { String result = param.getStringValue(cms); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(result) && !"0".equals(result)) { try { result = getCalendarLocalizedTime( widgetDialog.getLocale(), widgetDialog.getMessages(), Long.parseLong(result)); } catch (NumberFormatException e) { if (!CmsMacroResolver.isMacro(result, CmsMacroResolver.KEY_CURRENT_TIME)) { // neither long nor macro, show empty value result = ""; } } } else { result = ""; } return result; }
if ((values != null) && (values.length > 0)) { String dateTimeValue = values[0].trim(); if (CmsMacroResolver.isMacro(dateTimeValue, CmsMacroResolver.KEY_CURRENT_TIME)) {
if ((values != null) && (values.length > 0)) { String dateTimeValue = values[0].trim(); if (CmsMacroResolver.isMacro(dateTimeValue, CmsMacroResolver.KEY_CURRENT_TIME)) {
if (CmsStringUtil.isNotEmpty(targetUri)) { String internalUri = null; if (!CmsMacroResolver.isMacro(targetUri)) { internalUri = OpenCms.getLinkManager().getRootPath(m_cms, targetUri, m_relativePath);
if (CmsStringUtil.isNotEmpty(targetUri)) { String internalUri = null; if (!CmsMacroResolver.isMacro(targetUri)) { m_cms.getRequestContext().setAttribute( CmsDefaultLinkSubstitutionHandler.DONT_USE_CURRENT_SITE_FOR_WORKPLACE_REQUESTS,
if (CmsMacroResolver.isMacro(element)) {
if (CmsMacroResolver.isMacro(element)) {