";
return $html;
}
/**
* Sort a multidimensional array on a array kay (found on http://php.net/manual/en/function.sort.php)
* @array array the array
* @key str the field to use as key to sort
* @order str sort method: "ASC", "DESC"
*/
function alo_em_msort ($array, $key, $order = "ASC") {
$tmp = array();
foreach($array as $akey => $array2) {
$tmp[$akey] = $array2[$key];
}
if ($order == "DESC") {
arsort($tmp , SORT_NUMERIC );
} else {
asort($tmp , SORT_NUMERIC );
}
$tmp2 = array();
foreach($tmp as $key => $value) {
$tmp2[$key] = $array[$key];
}
return $tmp2;
}
/**
* Remove HTML tags, including invisible text such as style and
* script code, and embedded objects. Add line breaks around
* block-level tags to prevent word joining after tag removal.
* (based on http://nadeausoftware.com/articles/2007/09/php_tip_how_strip_html_tags_web_page )
*/
function alo_em_html2plain ( $text ) {
// transform in utf-8 if not yet
//$text = utf8_encode($text);
if ( function_exists( 'mb_detect_encoding' ) && mb_detect_encoding($text, "UTF-8") != "UTF-8" ) $text = utf8_encode($text);
$text = preg_replace(
array(
// Remove invisible content
'@
If you are interested in buying original WP themes I would recommend ThemeFuse.
Do you need SMTP? SMTP2GO provides a complete outgoing email infrastructure allowing you to send your emails through a professional SMTP service.
0 ) ? number_format ( ( $number * 100 / $total ), $float ) : 0;
}
/**
* Get IP address: useful if you like to filter it
*/
function alo_em_ip_address() {
if ( get_option('alo_em_collect_ip_address') == 'yes' ){
$ip_address = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
} else {
$ip_address = '';
}
return apply_filters ( 'alo_easymail_ip_address', $ip_address );
}
/**
* Get a checkbox list of WP roles, useful in options
*
* @param str name field
* @param arr the caps to search in roles
* @param str more attributes
* @return html
*
* echo alo_em_role_checkboxes( 'roles', 'publish_posts' );
*/
function alo_em_role_checkboxes ( $name='roles', $search_caps=array(), $attrs='' ) {
settype( $search_caps, 'array' );
if ( empty($search_caps[0]) ) return '';
$get_editable_roles = get_editable_roles();
$html = '';
foreach ($get_editable_roles as $role => $val )
{
// Search the req caps in role caps
$has_caps = array_intersect( array_keys($val['capabilities']), $search_caps );
// Compare the reordered arrays: must be identical
sort( $search_caps );
sort( $has_caps );
$checked = ( $search_caps == $has_caps )? 'checked="checked"' : '';
// Admin always checked
$disabled = ( $role == 'administrator' ) ? 'disabled="disabled"' : '';
$html .= ' ';
$html .= ' ';
}
return $html;
}
/**
* Wrapper of a filter to return if the subscription form is enabled and must be shown.
* Default is true, but it's possible to disable form from page and widget at all and use the plugin only to
* send newsletters, whereas the subscribers are collected using other tools.
*
* @return boolean
*/
function alo_em_subscription_form_is_enabled () {
return apply_filters ( 'alo_easymail_subscription_form_is_enabled', true );
}
/* EOF */