';
};
} else {
$o = (( ($masonry == '6') || ($masonry == '5') ) ? '' : '');
}
if( $echo ) {
echo esc_attr( $o );
} else {
return esc_attr( $o );
}
}
}
if( ! function_exists('articled_footer_widget_cols') ){
function articled_footer_widget_cols(){
$get_widget_cols = get_theme_mod('articled_footer_widget_cols', '4');
$e_widget_cols = '';
switch($get_widget_cols) {
case 2 :
$e_widget_cols = 'two';
break;
case 3 :
$e_widget_cols = 'three';
break;
case 4 :
$e_widget_cols = 'four';
break;
default:
$e_widget_cols = 'four';
}
return $e_widget_cols;
}
}
if( ! function_exists('articled_insert_contents') ){
function articled_insert_contents($id = null, $echo = true){
$o = '';
$o .= '
' . articled_options( $id ) . '
';
if( $echo ) {
echo $o ;
} else {
return esc_attr( $o );
}
}
}
// the_content() data imageg out tags
if( ! function_exists('articled_content_img_out_from_p') ){
function articled_content_img_out_from_p($content){
return preg_replace('/
\s*()?\s*(
)\s*(\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
}
add_filter('the_content', 'articled_content_img_out_from_p');
}
if( ! function_exists('articled_google_fonts') ){
function articled_google_fonts(){
global $articled_control_arrays_fonts;
$boths = array();
foreach ($articled_control_arrays_fonts as $key => $value) {
$family = get_theme_mod($key.'_font_family');
$varie = get_theme_mod($key.'_font_variets');
if(empty($family)) continue;
$boths[] .= $family.':'.$varie;
}
return $boths;
}
}
if( ! function_exists('articled_current_file_name') ) {
function articled_current_file_name() {
if( is_admin() || !current_user_can( 'administrator' ) ) {
return;
}
if(ABU_CURRENT_FILE) {
global $template;
function articled_file_title($t){
$t = basename( $template );
return $t;
}
add_filter( 'wp_title', 'articled_file_title' );
}
}
add_action( 'wp_head' , 'articled_current_file_name', -1000 );
}
// init actions
if ( current_user_can('edit_others_posts') ) {
if( !function_exists('articled_delete_post_url') ):
function articled_delete_post_url() {
// run only for single post page
if (is_single() && in_the_loop() && is_main_query() || is_home() || is_author() ) {
// add query arguments: action, post, nonce
$url = add_query_arg(array(
'action' => 'articled_delete_post',
'post' => get_the_ID(),
'nonce' => wp_create_nonce('articled_delete_post_nonce'),
),
home_url()
);
return esc_url($url);
}
return null;
}
endif;
/**
* Request handler
*/
function artiled_delete_post() {
if ( isset($_GET['action']) && isset($_GET['nonce']) &&
$_GET['action'] === 'articled_delete_post' &&
wp_verify_nonce($_GET['nonce'], 'articled_delete_post_nonce')
) {
// verify we have a post id
$post_id = (isset($_GET['post'])) ? ($_GET['post']) : (null);
// verify there is a post with such a number
$post = get_post((int)$post_id);
if ( empty($post) ) {
return;
}
// Moving the post to trash
wp_trash_post($post_id);
// redirect to admin page
$current_url = home_url(add_query_arg(array(),$wp->request));
wp_safe_redirect($current_url);
die;
}
}
add_action('init', 'artiled_delete_post');
}
if( ! function_exists('articled_minify') ) {
function articled_minify( $content = '', $tpye = 'css' ) {
if( $tpye == 'css' ) {
$content = str_replace(array("\n","\r"),'', $content);
$content = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $content);
$content = str_replace(': ', ':', $content);
$content = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $content);
}
return $content;
}
}
/* License Notice */
function articled_license_notice() {
if ( empty(articled_mod('articled_license_notice')) && (articled_mod('articled_license_notice') == false) ) { ?>