Commit 3ee9020f authored by haystack's avatar haystack

externalise markup for multiple shortcode to template file

parent 90d6cc1a
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.5 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2013
*
*/
?>
<div class="crm-container crm-public<?php echo $class; ?>">
<?php if ( $show_title ) { ?>
<h2><?php echo $title; ?></h2>
<?php } ?>
<?php if ( $description ) { ?>
<div class="civi-description"><?php echo $description; ?></div>
<?php } ?>
<p><?php echo $more_link; ?></p>
<div class="crm-public-footer">
<?php echo $footer; ?>
</div>
</div>
......@@ -393,44 +393,38 @@ class CiviCRM_For_WordPress_Shortcodes {
'link' => $link,
) );
*/
// init markup with a container
$markup = '<div class="crm-container crm-public' . $class . '">';
if ( $show_title ) {
$markup .= '<h2>' . $title . '</h2>';
}
// set some template variables
// do we have some descriptive text?
// description
$description = FALSE;
if ( isset( $data['text'] ) AND ! empty( $data['text'] ) ) {
// add it
$markup .= '<div class="civi-description">' . $data['text'] . '</div>';
$description = $data['text'];
}
// provide an enticing link
$markup .= '<p>' . sprintf(
$more_link = sprintf(
'<a href="%s">%s</a>',
$link,
apply_filters( 'civicrm_shortcode_more_link', __( 'Find out more...', 'civicrm' ) )
) . '</p>';
);
// let's have a footer
$markup .= '<div class="crm-public-footer">';
$civi = __( 'CiviCRM.org - Growing and Sustaining Relationships', 'civicrm' );
$logo = '<div class="empowered-by-logo"><span>CiviCRM</span></div>';
$footer = sprintf(
__( 'Empowered by <a href="http://civicrm.org/" title="%s" target="_blank" class="empowered-by-link">%s</a>', 'civicrm' ),
$civi,
$logo
);
$markup .= apply_filters( 'civicrm_shortcode_footer', $footer );
$markup .= '</div>';
$logo = '<div class="empowered-by-logo"><span>' . __( 'CiviCRM', 'civicrm' ) . '</span></div>';
$civi_link = '<a href="http://civicrm.org/" title="' . $civi . '" target="_blank" class="empowered-by-link">' . $logo . '</a>';
$empowered = sprintf( __( 'Empowered by %s', 'civicrm' ), $civi_link );
$footer = apply_filters( 'civicrm_shortcode_footer', $empowered );
// close container
$markup .= '</div>';
// start buffering
ob_start();
// include template
include( CIVICRM_PLUGIN_DIR . 'assets/templates/civicrm.shortcode.php' );
// save the output and flush the buffer
$markup = ob_get_clean();
// allow plugins to override
return apply_filters( 'civicrm_shortcode_render_multiple', $markup, $post_id, $shortcode );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment