'; $p = ' ' . get_the_date('M') . ''; $p = ' ' . get_the_date('j') . ','; $p = ' ' . get_the_date('Y') . ''; $o .= get_the_date(); $o .= ''; return $o; } } if( !function_exists('_html_decode') ) { function _html_decode($string) { return htmlspecialchars_decode( stripslashes_deep($string) ); } } if( !function_exists('_html_encode') ) { function _html_encode($string) { return htmlspecialchars( $string ); } } if ( !function_exists('articled_meta')): function articled_meta( $metaID ) { global $post; $get_value = get_post_meta($post->ID, $metaID, true); if ( $get_value == 'default' || $get_value == 'show' || $get_value == '') { $get_value = true; } elseif( $get_value == 'hide' ) { $get_value = false; } else{ $get_value = $get_value; } return $get_value; } endif; $get_articled_options = get_option('articled_options'); if ( ! function_exists('articled_options')): function articled_options($id) { global $get_articled_options; $output = _html_decode( articled_ekey( $id , $get_articled_options, false )); return $output; } endif; if ( !function_exists('articled_mod')): function articled_mod($name, $default = false, $echo = false) { $output = get_theme_mod( $name, $default ); if($echo) { echo $output; } else { return $output; } } endif; if( !function_exists('articled_post_type')): function articled_post_type($post_id) { return get_post_format( $post_id ); } endif; if( !function_exists('articled_video_attachments') ) : function articled_video_attachments($videoID, $echo){ $video_url = wp_get_attachment_url($videoID); $video_e = ''; if($echo) { echo $video_e; } else { return $video_e; } } endif; if( !function_exists('articled_edit_delete_post') ) : function articled_edit_delete_post(){ if( is_user_logged_in() && current_user_can( 'edit_posts' ) ) { echo '['; edit_post_link( __( 'Edit', 'articled' ), '', '', null, 'edit-post-link' ); echo ''.__( 'Delete', 'articled' ).']' ; }; } endif; if( ! function_exists('articled_remove_extr_space') ){ function articled_remove_extr_space($str, $echo = false){ if( $echo ) { echo trim( preg_replace( '/\s+/', ' ', $str ) ); } else { return trim( preg_replace( '/\s+/', ' ', $str ) ); } } } if( ! function_exists('articled_blog_post_layout') ){ function articled_blog_post_layout($type = null, $echo = true) { $is_sidebar = (intval(get_theme_mod('articled_blog_post_layout', '2')) % 2) == 0 ? true : false; if( $type == 'main' ) { if( $is_sidebar == 'even' ) { $o = 'col-md-9'; } else { $o = 'col-md-12'; } } elseif( $type == 'sidebar' ) { if ( $is_sidebar ) { $o = true; } else { $o = false; } } else { $o = ''; } if( $echo ) { echo esc_attr( $o ); } else { return $o ; } } } if( ! function_exists('articled_is_masonry') ){ function articled_is_masonry($place = null, $echo = true){ $o = null; $masonry = get_theme_mod('articled_blog_post_layout', '2'); if( $place == 'top' ) { if( $masonry == '6' || $masonry == '5' ) { $o = '
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;
}
}
if( ! function_exists('articled_file_exists') ) {
function articled_file_exists( $url = '' ) {
if( ! file_exists( $url ) ) {
return $url;
} else {
$url = str_replace( '.min', '', $url );
return $url;
}
}
}
/* License Notice */
function articled_license_notice() {
if ( ( articled_mod('articled_license_notice') == false ) && ( articled_mod('articled_license_notice') == false ) ) { ?>