$data_arr['post_id'], 'auto_post' => $data_arr['auto_post'] // 1 or empty ); $post_id = $data_arr['post_id']; $title = ATASWP_Twitter_Tweet::get_post_title( $post_id ); $description = ATASWP_Twitter_Tweet::create_post_description( $post_id ); $url = ATASWP_Twitter_Tweet::get_post_url( $post_id ); $author = ATASWP_Twitter_Tweet::get_post_author( $post_id ); // replace words with defined hashtags $title = ATASWP_Twitter_Tweet::words_to_hashtags( $title ); $description = ATASWP_Twitter_Tweet::words_to_hashtags( $description ); $tweet = array( "title" => $title, "description" => $description, "url" => $url, "author" => '@'.$author ); $tweet = json_encode($tweet); // json encode before send $response = ATASWP_Twitter::tweet( $tweet ); // process tweet if ( !empty($response) ) { // success, show admin notice using transient set_transient( 'ataswp_auto_post_metabox_tweet_result', true, 180 ); // for 180 seconds } return $response; /* echo '
';
		print_r( $tweet );
		echo '
'; echo '
';
		print_r( $twitterdata );
		echo '
'; exit; */ } /** * Display admin notice upon on tweet. * * @since 1.0.0 * @return void $notice */ public function auto_post_metabox_tweet_notice() { if ( ! current_user_can( 'activate_plugins' ) ) return; $notice = ''; // def // If transient exist if ( get_transient( 'ataswp_auto_post_metabox_tweet_result' ) ) { $tweet_button = 'Tweet'; $notice = '

' . __('Tweet successfully posted.', 'ataswp_lang') . '

' . '

' . __('Share your Love by Tweeting to us:     ', 'ataswp_lang') . $tweet_button . '

' . '
'; // delete transient delete_transient( 'ataswp_auto_post_metabox_tweet_result' ); ?> '; print_r( $enabled_post_types ); echo ''; exit; */ } else { $enabled_post_types = ''; } $auto_post_settings = get_option('ataswp_auto_post_settings'); $version = $auto_post_settings['version']; if( trim($version) == false ) $version = ''; $arr = array( 'version' => $version, 'enable_auto_post' => $enable_auto_post, 'enabled_post_types' => $enabled_post_types, 'words_into_hashtags' => $words_into_hashtags // Universal or Local Timezone ); update_option('ataswp_auto_post_settings', $arr); // success message $validation[] = __('Settings has been updated. ', 'ataswp_lang'); // validation echo ATASWP_Admin_Core::displayAjaxFormsValidationResult($validation, $type='success'); } else { // error message $validation[] = __('Form Validation failed!', 'ataswp_lang'); // validation echo ATASWP_Admin_Core::displayAjaxFormsValidationResult($validation, $type='error'); } //echo json_encode(array('success'=>'', 'message'=>'' )); // return json exit; // don't forget to exit! } } ?>