' . ' ';
$output .= '' . ' ';
$output .= '' . ' ';
$output .= '' . ' ';
if (has_post_thumbnail( )) {
$imgsrc = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
$output .= '' . ' ';
}
echo $output;
}
}
function add_query_vars($aVars) {
$aVars[] = 'domain';
return $aVars;
}
function add_rewrite_rules($aRules) {
$aNewRules = array( 'source/([^/]+)/?$' => 'index.php?pagename=source&domain=$matches[1]' );
$aRules = $aNewRules + $aRules;
return $aRules;
}
function add_source_to_title($title) {
global $wp_query;
return __( 'Pins from', 'pinclone' ) . ' ' . $wp_query->query_vars['domain'] . str_replace( 'Source ', ' ', $title
);
}
function rewrite_source_title() {
if (( class_exists( 'All_in_One_SEO_Pack' ) and& is_page( 'source' ) )) {
add_filter( 'aioseop_title_page', 'add_source_to_title' );
}
}
function pinclone_restrict_admin() {
if (( ( ( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) and& !current_user_can( 'administrator' ) ) and&
!current_user_can( 'editor' ) )) {
wp_redirect( home_url( ) );
exit( );
}
}
function pinclone_login_url($login_url, $redirect) {
$login_url = home_url( '/login/' );
if (!empty( $redirect )) {
$duplicate_redirect = substr_count( $redirect, 'redirect_to' );
if (1 <= $duplicate_redirect) {
$redirect = substr( $redirect, 0, strrpos( $redirect, '?' ) );
}
$login_url = add_query_arg( 'redirect_to', rawurlencode( $redirect ), $login_url );
}
else {
$login_url = add_query_arg( 'redirect_to', rawurlencode( home_url( '/' ) ), $login_url );
}
if ($force_reauth) {
$login_url = add_query_arg( 'reauth', '1', $login_url );
}
return $login_url;
}
function pinclone_login_fail($username) {
$referrer = $_SERVER['HTTP_REFERER'];
if (( ( !empty( $referrer ) and& !strstr( $referrer, 'wp-login' ) ) and& !strstr( $referrer, 'wp-admin' ) )) {
$userdata = get_user_by( 'login', $username );
$verify = get_user_meta( $userdata->ID, '_Verify Email', true );
if ($verify != '') {
$verify = '&email=unverified';
}
if (strpos( $referrer, '&login=failed' )) {
wp_redirect( $referrer . $verify );
}
else {
wp_redirect( $referrer . $verify . '&login=failed' );
}
exit( );
}
}
function pinclone_verify_email($userdata) {
// $verify = get_user_meta( $userdata->ID, '_Verify Email', true );
// if ($verify != '') {
// WP_Error;
// return new ( 'email_unverified', $verify . __( 'Email not verified. Please check your email for
//verification link.', 'pinclone' ) );
// }
// return $userdata;
}
function pinclone_user_register($user_id) {
$board_id = wp_insert_term( $user_id, 'board' );
update_user_meta( $user_id, '_Board Parent ID', $board_id['term_id'] );
update_user_meta( $user_id, 'pinclone_user_notify_likes', '1' );
update_user_meta( $user_id, 'pinclone_user_notify_repins', '1' );
update_user_meta( $user_id, 'pinclone_user_notify_follows', '1' );
update_user_meta( $user_id, 'pinclone_user_notify_comments', '1' );
if (function_exists( 'wsl_activate' )) {
wp_update_user( array( 'ID' => $user_id, 'user_url' => '' ) );
}
}
function pinclone_wp_login($user_login, $user) {
$board_parent_id = get_user_meta( $user->ID, '_Board Parent ID', true );
if ($board_parent_id == '') {
$board_id = wp_insert_term( $user->ID, 'board' );
update_user_meta( $user->ID, '_Board Parent ID', $board_id['term_id'] );
}
}
function pinclone_exclude_category($query) {
if (!is_admin( )) {
$blog_cat_id = of_get_option( 'blog_cat_id' );
if (!$query->is_category( $blog_cat_id )) {
$query->set( 'cat', '-' . $blog_cat_id );
}
if ($query->is_search) {
$query->set( 'post_type', 'post' );
}
}
return $query;
}
function pinclone_add_custom_taxonomies() {
register_taxonomy( 'board', 'post', array( 'hierarchical' => true, 'public' => false, 'labels' => array( 'name' =>
'Boards', 'singular_name' => 'Board', 'search_items' => 'Search Boards', 'all_items' => 'All Boards', 'parent_item' =>
'Parent Board', 'parent_item_colon' => 'Parent Board:', 'edit_item' => 'Edit Board', 'update_item' => 'Update Board',
'add_new_item' => 'Add New Board', 'new_item_name' => 'New Board Name', 'menu_name' => 'Boards' ), 'rewrite' => array(
'slug' => 'board', 'with_front' => false, 'hierarchical' => true ) ) );
}
function pinclone_board_permalink($termlink, $term, $taxonomy) {
if ($taxonomy == 'board') {
return home_url( '/board/' ) . $term->term_id . '/';
}
return $termlink;
}
function pinclone_board_query($query) {
if (isset( $query->query_vars['board'] )) {
if ($board = get_term_by( 'id', $query->query_vars['board'], 'board' )) {
$query->query_vars['board'] = $board->slug;
}
}
}
function pinclone_scripts() {
global $user_login;
global $user_ID;
global $user_identity;
if (!is_single( )) {
wp_enqueue_script( 'pinclone_masonry', get_template_directory_uri( ) . '/js/jquery.masonry.min.js', array(
'jquery' ), null, true );
wp_enqueue_script( 'pinclone_infinitescroll', get_template_directory_uri( ) .
'/js/jquery.infinitescroll.min.js', array( 'jquery' ), null, true );
if (function_exists( 'wp_pagenavi' )) {
$nextSelector = '#navigation a:nth-child(3)';
}
else {
$nextSelector = '#navigation #navigation-next a';
}
}
if (( ( ( is_singular( ) and& comments_open( ) ) and& get_option( 'thread_comments' ) ) and& is_user_logged_in( ) )) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script( 'pinclone_bootstrap', get_template_directory_uri( ) . '/js/bootstrap.min.js', array( 'jquery'
), null, true );
wp_enqueue_script( 'pinclone_custom', get_template_directory_uri( ) . '/js/pinclone.custom.js', array( 'jquery' ),
null, true );
$translation_array = array( '__allitemsloaded' => __( 'All items loaded', 'pinclone' ), '__addanotherpin' => __(
'Add Another Pin', 'pinclone' ), '__addnewboard' => __( 'Add new board...', 'pinclone' ), '__boardalreadyexists' => __(
'Board already exists. Please try another title.', 'pinclone' ), '__errorpleasetryagain' => __( 'Error. Please try
again.', 'pinclone' ), '__cancel' => __( 'Cancel', 'pinclone' ), '__close' => __( 'Close', 'pinclone' ), '__comment' =>
__( 'comment', 'pinclone' ), '__comments' => __( 'comments', 'pinclone' ), '__enternewboardtitle' => __( 'Enter new board
title', 'pinclone' ), '__invalidimagefile' => __( 'Invalid image file. Please choose a JPG/GIF/PNG file.', 'pinclone' ),
'__like' => __( 'like', 'pinclone' ), '__likes' => __( 'likes', 'pinclone' ), '__Likes' => __( 'Likes', 'pinclone' ),
'__loading' => __( 'Loading...', 'pinclone' ), '__pinit' => __( 'Pin It', 'pinclone' ), '__pinnedto' => __( 'Pinned to',
'pinclone' ), '__pleaseenteratitle' => __( 'Please enter a title', 'pinclone' ), '__pleaseenterbothusernameandpassword' =>
__( 'Please enter both username and password.', 'pinclone' ), '__pleaseenterurl' => __( 'Please enter url', 'pinclone' ),
'__repin' => __( 'repin', 'pinclone' ), '__repins' => __( 'repins', 'pinclone' ), '__Repins' => __( 'Repins', 'pinclone'
), '__repinnedto' => __( 'Repinned to', 'pinclone' ), '__seethispin' => __( 'See This Pin', 'pinclone' ),
'__sorryunbaletofindanypinnableitems' => __( 'Sorry, unable to find any pinnable items.', 'pinclone' ), '__Video' => __(
'Video', 'pinclone' ), '__yourpinispendingreview' => __( 'Your pin is pending review', 'pinclone' ), 'ajaxurl' =>
admin_url( 'admin-ajax.php' ), 'avatar30' => get_avatar( $user_ID, '30' ), 'avatar48' => get_avatar( $user_ID, '48' ),
'blogname' => get_bloginfo( 'name' ), 'categories' => wp_dropdown_categories( array( 'show_option_none' => __( 'Category
for New Board', 'pinclone' ), 'exclude' => of_get_option( 'blog_cat_id' ) . ',1', 'hide_empty' => 0, 'name' =>
'board-add-new-category', 'orderby' => 'name', 'echo' => 0 ) ), 'current_date' => date( 'j M Y g:ia', current_time(
'timestamp' ) ), 'home_url' => home_url( ), 'infinitescroll' => of_get_option( 'infinitescroll' ), 'login_url' =>
wp_login_url( $_SERVER['REQUEST_URI'] ), 'nextselector' => $nextSelector, 'nonce' => wp_create_nonce( 'ajax-nonce' ),
'stylesheet_directory_uri' => get_template_directory_uri( ), 'u' => $user_ID, 'ui' => $user_identity, 'ul' => $user_login
);
wp_localize_script( 'pinclone_custom', 'obj_pinclone', $translation_array );
wp_enqueue_script( 'twitter', 'http://platform.twitter.com/widgets.js', array( ), null, true );
}
function is_element_empty($element) {
$element = trim( $element );
return (empty( $element ) ? false : true);
}
/**
* Remove the id="" on nav menu items
* Return 'menu-slug' for nav menu classes
*/ function roots_nav_menu_css_class($classes, $item) {
$slug = sanitize_title( $item->title );
$classes = preg_replace( '/(current(-menu-|[-_]page[-_])(item|parent|ancestor))/', 'active', $classes );
$classes = preg_replace( '/^((menu|page)[-_\w+]+)+/', '', $classes );
$classes[] = 'menu-' . $slug;
$classes = array_unique( $classes );
return array_filter( $classes, 'is_element_empty' );
}
/**
* Clean up wp_nav_menu_args
*
* Remove the container
* Use Roots_Nav_Walker() by default
*/ function roots_nav_menu_args($args = '') {
$roots_nav_menu_args['container'] = false;
if (!$args['items_wrap']) {
$roots_nav_menu_args['items_wrap'] = '%3$s';
}
if (current_theme_supports( 'bootstrap-top-navbar' )) {
$roots_nav_menu_args['depth'] = 3;
}
if (!$args['walker']) {
Roots_Nav_Walker;
// $roots_nav_menu_args['walker'] = new ( );
}
return array_merge( $args, $roots_nav_menu_args );
}
function pinclone_human_time_diff($from, $to = '') {
if (empty( $to )) {
$to = time( );
}
$diff = (int)abs( $to - $from );
if ($diff <= 3600) {
$mins = round( $diff / 60 );
if ($mins <= 1) {
$mins = 1;
}
if ($mins == 1) {
$since = sprintf( __( '%s min ago', 'pinclone' ), $mins );
}
else {
$since = sprintf( __( '%s mins ago', 'pinclone' ), $mins );
}
}
else {
if (( $diff <= 86400 and& 3600 < $diff )) {
$hours = round( $diff / 3600 );
if ($hours <= 1) {
$hours = 1;
}
if ($hours == 1) {
$since = sprintf( __( '%s hour ago', 'pinclone' ), $hours );
}
else {
$since = sprintf( __( '%s hours ago', 'pinclone' ), $hours );
}
}
else {
if (( 86400 <= $diff and& $diff <= 31536000 )) {
$days = round( $diff / 86400 );
if ($days <= 1) {
$days = 1;
}
if ($days == 1) {
$since = sprintf( __( '%s day ago', 'pinclone' ), $days );
}
else {
$since = sprintf( __( '%s days ago', 'pinclone' ), $days );
}
}
else {
$since = get_the_date( );
}
}
}
return $since;
}
function pinclone_feed_content($content) {
global $post;
$boards = get_the_terms( $post->ID, 'board' );
if ($boards) {
foreach ($boards as $board) {
$board_name = $board->name;
$board_slug = $board->slug;
}
$board_link = get_term_link( $board_slug, 'board' );
$imgsrc = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
if ($imgsrc[0] == '') {
$imgsrc[0] = get_template_directory_uri( ) . '/img/blank.gif';
}
$content_before = '';
$content_before .= '
' . __( 'Pinned onto', 'pinclone' ) . ' ' .
$board_name . '';
}
return $content_before . $content;
}
function pinclone_list_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
echo '
';
if ($comment_author) {
echo '
';
}
echo ' ';
echo get_avatar( $comment->user_id, '48' );
echo ' ';
if ($comment_author) {
echo '
';
}
echo '
';
comment_reply_link( array( 'reply_text' => __( 'Reply', 'pinclone' ), 'login_text' => __( 'Reply', 'pinclone' ),
'depth' => $depth, 'max_depth' => $args['max_depth'] ) );
echo '
';
echo '
';
}
echo ' ';
echo $comment->comment_author;
echo ' ';
if ($comment_author) {
echo '
';
}
echo '
/ ';
comment_date( 'j M Y g:ia' );
echo ' # ';
edit_comment_link( 'e', '', '' );
echo ' ';
if ($comment->comment_approved == '0') {
echo '
';
_e( 'Your comment is awaiting moderation.', 'pinclone' );
echo '
';
}
echo '
';
comment_text( );
echo '
';
}
function pinclone_repin() {
$nonce = $_POST['nonce'];
if (!wp_verify_nonce( $nonce, 'ajax-nonce' )) {
exit( );
}
global $user_ID;
global $user_identity;
$original_id = $_POST['repin_post_id'];
$duplicate = get_post( $original_id, 'ARRAY_A' );
$original_post_author = $duplicate['post_author'];
$duplicate['post_author'] = $user_ID;
$duplicate['post_title'] = sanitize_text_field( $_POST['repin_title'] );
unset( $duplicate[ID] );
unset( $duplicate[post_date] );
unset( $duplicate[post_date_gmt] );
unset( $duplicate[post_modified] );
unset( $duplicate[post_modified_gmt] );
unset( $duplicate[post_name] );
unset( $duplicate[guid] );
unset( $duplicate[comment_count] );
$duplicate_id = wp_insert_post( $duplicate );
$board_add_new = sanitize_text_field( $_POST['repin_board_add_new'] );
$board_add_new_category = $_POST['repin_board_add_new_category'];
$board_parent_id = get_user_meta( $user_ID, '_Board Parent ID', true );
if ($board_add_new !== '') {
$board_children = get_term_children( $board_parent_id, 'board' );
$found = '0';
foreach ($board_children as $board_child) {
$board_child_term = get_term_by( 'id', $board_child, 'board' );
if (stripslashes( htmlspecialchars( $board_add_new, ENT_NOQUOTES, 'UTF-8' ) ) ==
$board_child_term->name) {
$found = '1';
$found_board_id = $board_child_term->term_id;
break;
}
}
if ($found == '0') {
$slug = wp_unique_term_slug( $board_add_new . '__pincloneboard', 'board' );
if ($board_add_new_category == '-1') {
$board_add_new_category = '1';
}
$new_board_id = wp_insert_term( $board_add_new, 'board', array( 'description' =>
$board_add_new_category, 'parent' => $board_parent_id, 'slug' => $slug ) );
$repin_board = $new_board_id['term_id'];
}
else {
$repin_board = $found_board_id;
}
}
else {
$repin_board = $_POST['repin_board'];
}
wp_set_post_terms( $duplicate_id, array( $repin_board ), 'board' );
$category_id = get_term_by( 'id', $repin_board, 'board' );
wp_set_post_terms( $duplicate_id, array( $category_id->description ), 'category' );
if ('' == $repin_of_repin = get_post_meta( $original_id, '_Original Post ID', true )) {
add_post_meta( $duplicate_id, '_Original Post ID', $original_id );
}
else {
add_post_meta( $duplicate_id, '_Original Post ID', $original_id );
add_post_meta( $duplicate_id, '_Earliest Post ID', $repin_of_repin );
}
add_post_meta( $duplicate_id, '_Photo Source', get_post_meta( $original_id, '_Photo Source', true ) );
add_post_meta( $duplicate_id, '_Photo Source Domain', get_post_meta( $original_id, '_Photo Source Domain', true )
);
add_post_meta( $duplicate_id, '_thumbnail_id', get_post_meta( $original_id, '_thumbnail_id', true ) );
$postmeta_repin_count = get_post_meta( $original_id, '_Repin Count', true );
$postmeta_repin_post_id = get_post_meta( $original_id, '_Repin Post ID' );
$repin_post_id = $postmeta_repin_post_id[0];
if (!is_array( $repin_post_id )) {
$repin_post_id = array( );
}
array_push( $repin_post_id, $duplicate_id );
update_post_meta( $original_id, '_Repin Post ID', $repin_post_id );
update_post_meta( $original_id, '_Repin Count', ++$postmeta_repin_count );
if (( get_user_meta( $original_post_author, 'pinclone_user_notify_repins', true ) != '' and& $user_ID !=
$original_post_author )) {
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
$message = sprintf( __( '%s repinned your "%s" pin at %s', 'pinclone' ), $user_identity,
html_entity_decode( get_the_title( $original_id ), ENT_QUOTES, 'UTF-8' ), get_permalink( $duplicate_id ) ) . ' ';
$message .= '------------------------------------------- ';
$message .= sprintf( __( 'To change your notification settings, visit %s', 'pinclone' ), home_url(
'/settings/' ) );
wp_mail( get_the_author_meta( 'user_email', $original_post_author ), sprintf( __( '[%s] Someone repinned
your pin', 'pinclone' ), $blogname ), $message );
}
if (( $new_board_id and& !is_wp_error( $new_board_id ) )) {
$usermeta_followers_id_allboards = get_user_meta( $user_ID, '_Followers User ID All Boards' );
$followers_id_allboards = $usermeta_followers_id_allboards[0];
if (!empty( $followers_id_allboards )) {
foreach ($followers_id_allboards as $followers_id_allboard) {
$usermeta_following_board_id = get_user_meta( $followers_id_allboard, '_Following Board
ID' );
$following_board_id = $usermeta_following_board_id[0];
array_unshift( $following_board_id, $new_board_id['term_id'] );
update_user_meta( $followers_id_allboard, '_Following Board ID', $following_board_id );
}
}
}
echo get_permalink( $duplicate_id );
exit( );
}
function pinclone_repin_board_populate() {
global $user_ID;
$board_parent_id = get_user_meta( $user_ID, '_Board Parent ID', true );
$board_children_count = wp_count_terms( 'board', array( 'parent' => $board_parent_id ) );
if (( is_array( $board_children_count ) || $board_children_count == 0 )) {
echo '' . wp_dropdown_categories( array( 'echo' => 0, 'show_option_none' => __( 'Add a
new board first...', 'pinclone' ), 'taxonomy' => 'board', 'parent' => $board_parent_id, 'hide_empty' => 0, 'name' =>
'board', 'hierarchical' => true ) );
echo '';
}
else {
echo wp_dropdown_categories( array( 'echo' => 0, 'taxonomy' => 'board', 'parent' => $board_parent_id,
'hide_empty' => 0, 'name' => 'board', 'hierarchical' => true, 'order' => 'DESC' ) );
}
exit( );
}
function pinclone_like() {
$nonce = $_POST['nonce'];
if (!wp_verify_nonce( $nonce, 'ajax-nonce' )) {
exit( );
}
global $user_ID;
global $user_identity;
$post_id = $_POST['post_id'];
if ($_POST['pinclone_like'] == 'like') {
$postmeta_count = get_post_meta( $post_id, '_Likes Count', true );
$postmeta_user_id = get_post_meta( $post_id, '_Likes User ID' );
$likes_user_id = $postmeta_user_id[0];
if (!is_array( $likes_user_id )) {
$likes_user_id = array( );
}
array_push( $likes_user_id, $user_ID );
update_post_meta( $post_id, '_Likes User ID', $likes_user_id );
update_post_meta( $post_id, '_Likes Count', ++$postmeta_count );
$usermeta_count = get_user_meta( $user_ID, '_Likes Count', true );
$usermeta_post_id = get_user_meta( $user_ID, '_Likes Post ID' );
$likes_post_id = $usermeta_post_id[0];
if (!is_array( $likes_post_id )) {
$likes_post_id = array( );
}
array_unshift( $likes_post_id, $post_id );
update_user_meta( $user_ID, '_Likes Post ID', $likes_post_id );
update_user_meta( $user_ID, '_Likes Count', ++$usermeta_count );
if (get_user_meta( $_POST['post_author'], 'pinclone_user_notify_likes', true ) != '') {
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
$message = sprintf( __( '%s likes your "%s" pin at %s', 'pinclone' ), $user_identity,
html_entity_decode( get_the_title( $post_id ), ENT_QUOTES, 'UTF-8' ), get_permalink( $post_id ) ) . ' ';
$message .= '------------------------------------------- ';
$message .= sprintf( __( 'To change your notification settings, visit %s', 'pinclone' ), home_url(
'/settings/' ) );
wp_mail( get_the_author_meta( 'user_email', $_POST['post_author'] ), sprintf( __( '[%s] Someone
likes your pin', 'pinclone' ), $blogname ), $message );
}
echo $postmeta_count;
}
else {
if ($_POST['pinclone_like'] == 'unlike') {
$postmeta_count = get_post_meta( $post_id, '_Likes Count', true );
$postmeta_user_id = get_post_meta( $post_id, '_Likes User ID' );
$likes_user_id = $postmeta_user_id[0];
unset( $likes_user_id[array_search( $user_ID, $likes_user_id )] );
$likes_user_id = array_values( $likes_user_id );
update_post_meta( $post_id, '_Likes User ID', $likes_user_id );
update_post_meta( $post_id, '_Likes Count', --$postmeta_count );
$usermeta_count = get_user_meta( $user_ID, '_Likes Count', true );
$usermeta_post_id = get_user_meta( $user_ID, '_Likes Post ID' );
$likes_post_id = $usermeta_post_id[0];
unset( $likes_post_id[array_search( $post_id, $likes_post_id )] );
$likes_post_id = array_values( $likes_post_id );
update_user_meta( $user_ID, '_Likes Post ID', $likes_post_id );
update_user_meta( $user_ID, '_Likes Count', --$usermeta_count );
echo $postmeta_count;
}
}
exit( );
}
function pinclone_liked($post_id) {
global $user_ID;
$postmeta_user_id = get_post_meta( $post_id, '_Likes User ID' );
$likes_user_id = $postmeta_user_id[0];
if (!is_array( $likes_user_id )) {
$likes_user_id = array( );
}
if (in_array( $user_ID, $likes_user_id )) {
return true;
}
return false;
}
function pinclone_follow() {
$nonce = $_POST['nonce'];
if (!wp_verify_nonce( $nonce, 'ajax-nonce' )) {
exit( );
}
global $user_ID;
global $user_identity;
$board_parent_id = $_POST['board_parent_id'];
$board_id = $_POST['board_id'];
$author_id = $_POST['author_id'];
if ($_POST['pinclone_follow'] == 'follow') {
$usermeta_following_count = get_user_meta( $user_ID, '_Following Count', true );
$usermeta_following_user_id = get_user_meta( $user_ID, '_Following User ID' );
$following_user_id = $usermeta_following_user_id[0];
$usermeta_following_board_id = get_user_meta( $user_ID, '_Following Board ID' );
$following_board_id = $usermeta_following_board_id[0];
if (!is_array( $following_user_id )) {
$following_user_id = array( );
}
if (!is_array( $following_board_id )) {
$following_board_id = array( );
}
if ($board_parent_id == '0') {
$author_boards = get_term_children( $board_id, 'board' );
foreach ($author_boards as $author_board) {
if (!in_array( $author_board, $following_board_id )) {
array_unshift( $following_board_id, $author_board );
continue;
}
}
$usermeta_followers_id_allboards = get_user_meta( $author_id, '_Followers User ID All Boards' );
$followers_id_allboards = $usermeta_followers_id_allboards[0];
if (!is_array( $followers_id_allboards )) {
$followers_id_allboards = array( );
}
if (!in_array( $user_ID, $followers_id_allboards )) {
array_unshift( $followers_id_allboards, $user_ID );
update_user_meta( $author_id, '_Followers User ID All Boards', $followers_id_allboards );
}
}
array_unshift( $following_board_id, $board_id );
update_user_meta( $user_ID, '_Following Board ID', $following_board_id );
if (!in_array( $author_id, $following_user_id )) {
array_unshift( $following_user_id, $author_id );
update_user_meta( $user_ID, '_Following User ID', $following_user_id );
update_user_meta( $user_ID, '_Following Count', ++$usermeta_following_count );
}
$usermeta_followers_count = get_user_meta( $author_id, '_Followers Count', true );
$usermeta_followers_id = get_user_meta( $author_id, '_Followers User ID' );
$followers_id = $usermeta_followers_id[0];
if (!is_array( $followers_id )) {
$followers_id = array( );
}
if (!in_array( $user_ID, $followers_id )) {
array_unshift( $followers_id, $user_ID );
update_user_meta( $author_id, '_Followers User ID', $followers_id );
update_user_meta( $author_id, '_Followers Count', ++$usermeta_followers_count );
}
if (get_user_meta( $author_id, 'pinclone_user_notify_follows', true ) != '') {
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
$message = sprintf( __( '%s is now following you. View %s\'s profile at %s', 'pinclone' ),
$user_identity, $user_identity, get_author_posts_url( $user_ID ) ) . ' ';
$message .= '------------------------------------------- ';
$message .= sprintf( __( 'To change your notification settings, visit %s', 'pinclone' ), home_url(
'/settings/' ) );
wp_mail( get_the_author_meta( 'user_email', $author_id ), sprintf( __( '[%s] Someone is following
you', 'pinclone' ), $blogname ), $message );
}
}
else {
if ($_POST['pinclone_follow'] == 'unfollow') {
$usermeta_following_count = get_user_meta( $user_ID, '_Following Count', true );
$usermeta_following_user_id = get_user_meta( $user_ID, '_Following User ID' );
$following_user_id = $usermeta_following_user_id[0];
$usermeta_following_board_id = get_user_meta( $user_ID, '_Following Board ID' );
$following_board_id = $usermeta_following_board_id[0];
if ($board_parent_id == '0') {
$author_boards = get_term_children( $board_id, 'board' );
foreach ($author_boards as $author_board) {
if (in_array( $author_board, $following_board_id )) {
unset( $following_board_id[array_search( $author_board,
$following_board_id )] );
$following_board_id = array_values( $following_board_id );
continue;
}
}
unset( $following_board_id[array_search( $board_id, $following_board_id )] );
$following_board_id = array_values( $following_board_id );
unset( $following_user_id[array_search( $author_id, $following_user_id )] );
$following_user_id = array_values( $following_user_id );
update_user_meta( $user_ID, '_Following Board ID', $following_board_id );
update_user_meta( $user_ID, '_Following User ID', $following_user_id );
update_user_meta( $user_ID, '_Following Count', --$usermeta_following_count );
$usermeta_followers_count = get_user_meta( $author_id, '_Followers Count', true );
$usermeta_followers_id = get_user_meta( $author_id, '_Followers User ID' );
$followers_id = $usermeta_followers_id[0];
unset( $followers_id[array_search( $user_ID, $followers_id )] );
$followers_id = array_values( $followers_id );
$usermeta_followers_id_allboards = get_user_meta( $author_id, '_Followers User ID All
Boards' );
$followers_id_allboards = $usermeta_followers_id_allboards[0];
unset( $followers_id_allboards[array_search( $user_ID, $followers_id_allboards )] );
$followers_id_allboards = array_values( $followers_id_allboards );
update_user_meta( $author_id, '_Followers User ID', $followers_id );
update_user_meta( $author_id, '_Followers User ID All Boards', $followers_id_allboards );
update_user_meta( $author_id, '_Followers Count', --$usermeta_followers_count );
echo 'unfollow_all';
}
else {
unset( $following_board_id[array_search( $board_id, $following_board_id )] );
$following_board_id = array_values( $following_board_id );
$author_boards = get_term_children( $board_parent_id, 'board' );
$board_following_others = 'no';
foreach ($following_board_id as $following_board) {
if (in_array( $following_board, $author_boards )) {
$board_following_others = 'yes';
break;
}
}
if ($board_following_others == 'no') {
unset( $following_board_id[array_search( $board_parent_id, $following_board_id )]
);
$following_board_id = array_values( $following_board_id );
unset( $following_user_id[array_search( $author_id, $following_user_id )] );
$following_user_id = array_values( $following_user_id );
update_user_meta( $user_ID, '_Following User ID', $following_user_id );
update_user_meta( $user_ID, '_Following Count', --$usermeta_following_count );
$usermeta_followers_count = get_user_meta( $author_id, '_Followers Count', true );
$usermeta_followers_id = get_user_meta( $author_id, '_Followers User ID' );
$followers_id = $usermeta_followers_id[0];
unset( $followers_id[array_search( $user_ID, $followers_id )] );
$followers_id = array_values( $followers_id );
$usermeta_followers_id_allboards = get_user_meta( $author_id, '_Followers User ID
All Boards' );
$followers_id_allboards = $usermeta_followers_id_allboards[0];
unset( $followers_id_allboards[array_search( $user_ID, $followers_id_allboards )]
);
$followers_id_allboards = array_values( $followers_id_allboards );
update_user_meta( $author_id, '_Followers User ID', $followers_id );
update_user_meta( $author_id, '_Followers User ID All Boards',
$followers_id_allboards );
update_user_meta( $author_id, '_Followers Count', --$usermeta_followers_count );
echo 'unfollow_all';
}
update_user_meta( $user_ID, '_Following Board ID', $following_board_id );
}
}
}
exit( );
}
function pinclone_followed($board_id) {
global $user_ID;
$usermeta_board_id = get_user_meta( $user_ID, '_Following Board ID' );
$follow_board_id = $usermeta_board_id[0];
if (!is_array( $follow_board_id )) {
$follow_board_id = array( );
}
if (in_array( $board_id, $follow_board_id )) {
return true;
}
return false;
}
function pinclone_ajaxify_comments($comment_ID, $comment_status) {
if (( !empty( $_SERVER['HTTP_X_REQUESTED_WITH'] ) and& strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ==
'xmlhttprequest' )) {
if ('spam' !== $comment_status) {
if ('0' == $comment_status) {
wp_notify_moderator( $comment_ID );
}
else {
if ('1' == $comment_status) {
global $user_ID;
global $user_identity;
$commentdata = get_comment( $comment_ID, 'ARRAY_A' );
$postdata = get_post( $commentdata['comment_post_ID'], 'ARRAY_A' );
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
if (( get_user_meta( $postdata['post_author'], 'pinclone_user_notify_comments',
true ) != '' and& $user_ID != $postdata['post_author'] )) {
$message = sprintf( __( '%s commented on your "%s" pin at %s', 'pinclone'
), $user_identity, html_entity_decode( $postdata['post_title'], ENT_QUOTES, 'UTF-8' ), get_permalink( $postdata['ID'] ) )
. ' ';
$message .= '------------------------------------------- ';
$message .= sprintf( __( 'To change your notification settings, visit %s',
'pinclone' ), home_url( '/settings/' ) );
wp_mail( get_the_author_meta( 'user_email', $postdata['post_author'] ),
sprintf( __( '[%s] Someone commented on your pin', 'pinclone' ), $blogname ), $message );
}
$comment_author_domain = @gethostbyaddr( $commentdata['comment_author_IP'] );
if (( get_option( 'comments_notify' ) and& $user_ID != $postdata['post_author'] )) {
$admin_message = sprintf( __( 'New comment on the post "%s"', 'pinclone'
), html_entity_decode( $postdata['post_title'], ENT_QUOTES, 'UTF-8' ) ) . ' ';
$admin_message .= sprintf( __( 'Author : %1$s (IP: %2$s , %3$s)',
'pinclone' ), $commentdata['comment_author'], $commentdata['comment_author_IP'], $comment_author_domain ) . ' ';
$admin_message .= sprintf( __( 'E-mail : %s', 'pinclone' ),
$commentdata['comment_author_email'] ) . ' ';
$admin_message .= sprintf( __( 'URL : %s', 'pinclone' ),
$commentdata['comment_author_url'] ) . ' ';
$admin_message .= sprintf( __( 'Whois : http://whois.arin.net/rest/ip/%s',
'pinclone' ), $commentdata['comment_author_IP'] ) . ' ';
$admin_message .= __( 'Comment: ', 'pinclone' ) . ' ' .
$commentdata['comment_content'] . ' ';
$admin_message .= __( 'You can see all comments on this post here: ',
'pinclone' ) . ' ';
$admin_message .= get_permalink( $postdata['ID'] ) . '#comments ';
$admin_message .= sprintf( __( 'Permalink: %s', 'pinclone' ),
get_permalink( $postdata['ID'] ) . '#comment-' . $comment_ID ) . ' ';
$admin_message .= sprintf( __( 'Delete it: %s', 'pinclone' ), admin_url(
'comment.php?action=delete&c=' . $comment_ID ) ) . ' ';
$admin_message .= sprintf( __( 'Spam it: %s', 'pinclone' ), admin_url(
'comment.php?action=spam&c=' . $comment_ID ) ) . ' ';
$admin_subject = sprintf( __( '[%1$s] Comment: "%2$s"', 'pinclone' ),
$blogname, html_entity_decode( $postdata['post_title'], ENT_QUOTES, 'UTF-8' ) );
wp_mail( get_option( 'admin_email' ), $admin_subject, $admin_message );
}
echo 'success';
}
}
}
exit( );
}
}
function pinclone_delete_post_clean($post_id) {
global $wpdb;
$original_id = get_post_meta( $post_id, '_Original Post ID', true );
if ($original_id == '') {
$wpdb->query( $wpdb->prepare( 'UPDATE ' . $wpdb->postmeta . '
SET meta_value = \'deleted\'
WHERE meta_key = \'_Original Post ID\'
AND meta_value = %s
', $post_id ) );
$wpdb->query( $wpdb->prepare( 'UPDATE ' . $wpdb->postmeta . '
SET meta_value = \'deleted\'
WHERE meta_key = \'_Earliest Post ID\'
AND meta_value = %s
', $post_id ) );
$postmeta_likes_user_ids = get_post_meta( $post_id, '_Likes User ID' );
$likes_user_ids = $postmeta_likes_user_ids[0];
if (is_array( $likes_user_ids )) {
foreach ($likes_user_ids as $likes_user_id) {
$usermeta_count = get_user_meta( $likes_user_id, '_Likes Count', true );
$usermeta_post_id = get_user_meta( $likes_user_id, '_Likes Post ID' );
$likes_post_id = $usermeta_post_id[0];
unset( $likes_post_id[array_search( $post_id, $likes_post_id )] );
$likes_post_id = array_values( $likes_post_id );
update_user_meta( $likes_user_id, '_Likes Post ID', $likes_post_id );
update_user_meta( $likes_user_id, '_Likes Count', --$usermeta_count );
}
return null;
}
}
else {
$wpdb->query( $wpdb->prepare( 'UPDATE ' . $wpdb->postmeta . '
SET meta_value = \'deleted\'
WHERE meta_key = \'_Original Post ID\'
AND meta_value = %s
', $post_id ) );
$postmeta_repin_count = get_post_meta( $original_id, '_Repin Count', true );
$postmeta_repin_post_id = get_post_meta( $original_id, '_Repin Post ID' );
$repin_post_id = $postmeta_repin_post_id[0];
unset( $repin_post_id[array_search( $post_id, $repin_post_id )] );
$repin_post_id = array_values( $repin_post_id );
update_post_meta( $original_id, '_Repin Post ID', $repin_post_id );
update_post_meta( $original_id, '_Repin Count', --$postmeta_repin_count );
$postmeta_likes_user_ids = get_post_meta( $post_id, '_Likes User ID' );
$likes_user_ids = $postmeta_likes_user_ids[0];
if (is_array( $likes_user_ids )) {
foreach ($likes_user_ids as $likes_user_id) {
$usermeta_count = get_user_meta( $likes_user_id, '_Likes Count', true );
$usermeta_post_id = get_user_meta( $likes_user_id, '_Likes Post ID' );
$likes_post_id = $usermeta_post_id[0];
unset( $likes_post_id[array_search( $post_id, $likes_post_id )] );
$likes_post_id = array_values( $likes_post_id );
update_user_meta( $likes_user_id, '_Likes Post ID', $likes_post_id );
update_user_meta( $likes_user_id, '_Likes Count', --$usermeta_count );
}
}
}
}
function pinclone_delete_user_clean($id) {
global $wpdb;
$board_parent_id = get_user_meta( $id, '_Board Parent ID', true );
$child_boards = get_term_children( $board_parent_id, 'board' );
array_push( $child_boards, $board_parent_id );
$usermeta_likes_post_ids = get_user_meta( $id, '_Likes Post ID' );
if (!empty( $usermeta_likes_post_ids[0] )) {
foreach ($usermeta_likes_post_ids[0] as $likes_post_id) {
$postmeta_likes_count = get_post_meta( $likes_post_id, '_Likes Count', true );
$postmeta_likes_user_id = get_post_meta( $likes_post_id, '_Likes User ID' );
$likes_user_id = $postmeta_likes_user_id[0];
unset( $likes_user_id[array_search( $id, $likes_user_id )] );
$likes_user_id = array_values( $likes_user_id );
update_post_meta( $likes_post_id, '_Likes User ID', $likes_user_id );
update_post_meta( $likes_post_id, '_Likes Count', --$postmeta_likes_count );
}
}
$followers = get_user_meta( $id, '_Followers User ID' );
if (!empty( $followers[0] )) {
foreach ($followers[0] as $follower) {
$usermeta_following_count = get_user_meta( $follower, '_Following Count', true );
$usermeta_following_user_id = get_user_meta( $follower, '_Following User ID' );
$following_user_id = $usermeta_following_user_id[0];
unset( $following_user_id[array_search( $id, $following_user_id )] );
$following_user_id = array_values( $following_user_id );
update_user_meta( $follower, '_Following User ID', $following_user_id );
update_user_meta( $follower, '_Following Count', --$usermeta_following_count );
foreach ($child_boards as $child_board) {
$usermeta_following_board_id = get_user_meta( $follower, '_Following Board ID' );
$following_board_id = $usermeta_following_board_id[0];
unset( $following_board_id[array_search( $child_board, $following_board_id )] );
$following_board_id = array_values( $following_board_id );
update_user_meta( $follower, '_Following Board ID', $following_board_id );
}
}
}
$following = get_user_meta( $id, '_Following User ID' );
if (!empty( $following[0] )) {
foreach ($following[0] as $following) {
$usermeta_followers_count = get_user_meta( $following, '_Followers Count', true );
$usermeta_followers_user_id = get_user_meta( $following, '_Followers User ID' );
$followers_user_id = $usermeta_followers_user_id[0];
$usermeta_followers_user_id_all_boards = get_user_meta( $following, '_Followers User ID All
Boards' );
$followers_user_id_all_boards = $usermeta_followers_user_id_all_boards[0];
unset( $followers_user_id[array_search( $id, $followers_user_id )] );
$followers_user_id = array_values( $followers_user_id );
unset( $followers_user_id_all_boards[array_search( $id, $followers_user_id_all_boards )] );
$followers_user_id_all_boards = array_values( $followers_user_id_all_boards );
update_user_meta( $following, '_Followers User ID', $followers_user_id );
update_user_meta( $following, '_Followers Count', --$usermeta_followers_count );
update_user_meta( $following, '_Followers User ID All Boards', $followers_user_id_all_boards );
}
}
foreach ($child_boards as $child_board) {
wp_delete_term( $child_board, 'board' );
}
}
function pinclone_add_cron_schedule($schedules) {
$prune_duration = of_get_option( 'prune_duration' ) * 60;
$schedules['pinclone_prune'] = array( 'interval' => $prune_duration, 'display' => 'Prune Duration' );
return $schedules;
}
function pinclone_cron_function() {
global $wpdb;
$prune_postnumber = of_get_option( 'prune_postnumber' );
$posts = $wpdb->get_results( '
SELECT ID FROM ' . $wpdb->posts . '
WHERE post_status = \'pinclone_prune\'
LIMIT ' . $prune_postnumber . '
' );
if ($posts) {
foreach ($posts as $post) {
wp_delete_post( $post->ID, true );
}
}
}
function pinclone_mail_from($email) {
if ('' != $outgoing_email = of_get_option( 'outgoing_email' )) {
return $outgoing_email;
}
return $email;
}
function pinclone_mail_from_name($name) {
if ('' != $outgoing_email_name = of_get_option( 'outgoing_email_name' )) {
return $outgoing_email_name;
}
return $name;
}
function pinclone_local_avatar($avatar, $id_or_email, $size, $default, $alt) {
if (!is_admin( )) {
$avatar_id = get_user_meta( $id_or_email, 'pinclone_user_avatar', true );
if ($avatar_id != '') {
if (intval( $size ) <= 48) {
$imgsrc = wp_get_attachment_image_src( $avatar_id, 'avatar48' );
return '';
}
$avatar = 'Thank you for using Pinclone! Please click ' . 'HERE to start your Pinclone customization.' . '';
}
function pinclone_setup_guide() {
if (function_exists( 'add_options_page' )) {
add_theme_page( 'Pinclone Installation', 'Pinclone Installation', 'edit_theme_options',
'theme_installation', 'pinclone_setup_guide_page' );
}
}
function pinclone_setup_guide_page() {
echo 'Pinclone Installation
Go to ';
echo 'Settings > General and set
Membership = Anyone can register (ticked)
New User Default Role = Author
Go to ';
echo 'Settings > Reading and set
Blog pages show at most = 20 (or as you like. 20 for a good start)
Go to ';
echo 'Settings > Media and set
Medium size: Max Width = 250, Max Height = 600
Large size: Max Width = 520, Max Height = 600
Go to ';
echo 'Settings > Permalinks and set
Custom Structure = /pin/%post_id%/
Go to ';
echo 'Posts > Categories
Add your categories e.g. Celebrities, Food, Technology
Go to ';
echo 'Appearance > Menus
From the “Categories” box, select the categories you created earlier and
click “Add to Menu”. Drag the newly added items slightly to the right, such that they are indented from the Categories
menu item (see pic).
Go to ';
echo 'Appearance > Theme Options
Tweak to your liking
Go to ';
echo '';
echo home_url( '/user/admin/' );
echo '
If you see a 404 error, go to Settings > Permalinks and simply click “Save Changes” again
Edit ';
echo '
Find the wp-config.php file on your wordpress server directory and add
define(\'EMPTY_TRASH_DAYS\', 0);
';
echo '
Go to ';
echo 'Posts > Categories
Add a new category e.g Blog
Go to ';
echo 'Appearance > Theme Options
Under “Category For Blog”, select the blog category you just created
Go to ';
echo 'Appearance > Menus
From the “Categories” box, select the blog category you just created and
click “Add to Menu”
Go to ';
echo 'Posts > Add New
Create your post and make sure to select "Blog" under “Categories”
';
}
load_theme_textdomain( 'pinclone', get_template_directory( ) . '/languages' ); register_nav_menus( array( 'top_nav' => __(
'Top Navigation', 'pinclone' ) ) ); register_sidebar( array( 'id' => 'sidebar-l', 'name' => 'sidebar-left',
'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '' ) ); register_sidebar(
array( 'id' => 'sidebar-r', 'name' => 'sidebar-right', 'before_widget' => '', 'after_widget' => '', 'before_title' =>
'', 'after_title' => '' ) ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'post-thumbnails' );
add_theme_support( 'custom-background', array( 'default-color' => 'f2f2f2' ) ); add_editor_style( ); show_admin_bar( false
); if (!isset( $content_width )) {
$content_width = 518;
}
if (!function_exists( 'optionsframework_init' )) {
define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri( ) . '/inc/' );
require_once( dirname( __FILE__ ) . '/inc/options-framework.php' );
}
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 ); remove_action( 'wp_head', 'wp_generator' );
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 ); add_action( 'wp_head', 'pinclone_opengraph' ); add_filter(
'init', create_function( '$a', 'global $wp_rewrite;
$wp_rewrite->author_base = "user";
$wp_rewrite->author_structure = "/" . $wp_rewrite->author_base . "/%author%/";
' ) ); add_filter( 'query_vars', 'add_query_vars' ); add_filter( 'rewrite_rules_array', 'add_rewrite_rules' );
add_action( 'wp', 'rewrite_source_title' ); add_action( 'admin_init', 'pinclone_restrict_admin', 1 ); add_filter(
'login_url', 'pinclone_login_url', 10, 2 ); add_action( 'wp_login_failed', 'pinclone_login_fail' ); add_filter(
'wp_authenticate_user', 'pinclone_verify_email', 1 ); add_action( 'user_register', 'pinclone_user_register' ); add_action(
'wp_login', 'pinclone_wp_login', 10, 2 ); add_action( 'pre_get_posts', 'pinclone_exclude_category' ); add_action( 'init',
'pinclone_add_custom_taxonomies', 0 ); add_filter( 'term_link', 'pinclone_board_permalink', 10, 3 ); add_action(
'parse_query', 'pinclone_board_query' ); add_action( 'wp_enqueue_scripts', 'pinclone_scripts' ); class Roots_Nav_Walker
extends Walker_Nav_Menu {
function check_current($classes) {
return preg_match( '/(current[-_])|active|dropdown/', $classes );
}
function start_lvl($output, $depth = 0, $args = array( )) {
$output .= ' ';
}
function start_el($output, $item, $depth = 0, $args = array( ), $id = 0) {
$item_html = '';
parent::start_el( $item_html, $item, $depth, $args );
if (( $item->is_dropdown and& $depth === 0 )) {
$item_html = str_replace( '', $item_html );
}
else {
if (stristr( $item_html, 'li class="divider' )) {
$item_html = preg_replace( '/]*>.*?<\/a>/iU', '', $item_html );
}
else {
if (stristr( $item_html, 'li class="nav-header' )) {
$item_html = preg_replace( '/]*>(.*)<\/a>/iU', '$1', $item_html );
}
}
}
$output .= $item_html;
}
function display_element(and$element, $children_elements, $max_depth, $depth = 0, and$args, $output) {
$element->is_dropdown = !empty( $children_elements[$element->ID] );
if ($element->is_dropdown) {
if ($depth === 0) {
$element->classes[] = 'dropdown';
}
else {
if ($depth === 1) {
$element->classes[] = 'dropdown-submenu';
}
}
}
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
}
}
add_filter( 'nav_menu_css_class', 'roots_nav_menu_css_class', 10, 2 ); add_filter( 'nav_menu_item_id', '__return_null' );
add_filter( 'wp_nav_menu_args', 'roots_nav_menu_args' ); add_filter( 'the_excerpt_rss', 'pinclone_feed_content' );
add_filter( 'the_content_feed', 'pinclone_feed_content' ); add_action( 'wp_ajax_pinclone-repin', 'pinclone_repin' );
add_action( 'wp_ajax_pinclone-repin-board-populate', 'pinclone_repin_board_populate' );
add_action( 'wp_ajax_pinclone-like', 'pinclone_like' ); add_action( 'wp_ajax_pinclone-follow', 'pinclone_follow' );
add_action( 'comment_post', 'pinclone_ajaxify_comments', 20, 2 ); add_action( 'before_delete_post',
'pinclone_delete_post_clean' ); add_action( 'delete_user', 'pinclone_delete_user_clean' ); add_filter( 'cron_schedules',
'pinclone_add_cron_schedule' ); if (!wp_next_scheduled( 'pinclone_cron_action' )) {
wp_schedule_event( time( ), 'pinclone_prune', 'pinclone_cron_action' );
}
add_action( 'pinclone_cron_action', 'pinclone_cron_function' ); add_filter( 'wp_mail_from', 'pinclone_mail_from' );
add_filter( 'wp_mail_from_name', 'pinclone_mail_from_name' ); add_filter( 'get_avatar', 'pinclone_local_avatar', 10, 5 );
add_action( 'wp_ajax_pinclone-delete-avatar', 'pinclone_delete_avatar' ); add_action( 'wp_ajax_pinclone-add-board',
'pinclone_add_board' ); add_action( 'wp_ajax_pinclone-delete-board', 'pinclone_delete_board' ); add_action(
'wp_ajax_pinclone-upload-pin', 'pinclone_upload_pin' ); add_filter( 'sanitize_file_name', 'pinclone_clean_filename', 1, 2
); add_action( 'wp_ajax_pinclone-postdata', 'pinclone_postdata' ); add_action( 'wp_ajax_pinclone-pin-edit',
'pinclone_edit' ); add_action( 'wp_ajax_pinclone-delete-pin', 'pinclone_delete_pin' ); add_action( 'admin_init',
'pinclone_setup' ); if (EMPTY_TRASH_DAYS != 0) {
add_action( 'admin_notices', 'pinclone_setup_notice' );
}
add_action( 'admin_menu', 'pinclone_setup_guide' ); ?>