Created
June 19, 2012 08:35
-
-
Save rambuvn/2953035 to your computer and use it in GitHub Desktop.
I have a script to process submit, How to recode it (my meand is shorter)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* facebook */ | |
if( isset($_POST['facebook_create_item_wpnonce']) ){ | |
if( wp_verify_nonce($_POST['facebook_create_item_wpnonce'], 'facebook_create_item') ){ | |
$twitter_user = isset( $_POST['facebook_user'] ) ? $_POST['facebook_user'] : ''; | |
if( $twitter_user ){ | |
$wall_social_feed_options['facebook'][$twitter_user] = array( | |
'category' => 1, | |
'limit' => 20, | |
'use_image' => 0 | |
); | |
update_option('wall_social_feed_options', $wall_social_feed_options); | |
} | |
} | |
} | |
if( isset($_POST['remove_facebook_item_nonce']) ){ | |
if( wp_verify_nonce($_POST['remove_facebook_item_nonce'], 'remove_facebook_item') ){ | |
if( isset( $_POST['facebook_item_remove'] ) ){ | |
$item_remove = $_POST['facebook_item_remove']; | |
unset ( $wall_social_feed_options['facebook'][ $item_remove ] ); | |
update_option('wall_social_feed_options',$wall_social_feed_options); | |
} | |
} | |
} | |
if( isset( $_POST['facebook_item_update_nonce'] ) ){ | |
if( wp_verify_nonce( $_POST['facebook_item_update_nonce'], 'facebook_item_update') ){ | |
$twitter_item_id = isset( $_POST['facebook_item_id'] ) ? $_POST['facebook_item_id'] : ''; | |
$twitter_item_category = isset( $_POST['facebook_item_category']) ? $_POST['facebook_item_category'] : 1; | |
$twitter_item_limit = isset( $_POST['facebook_item_limit'] ) ? $_POST['facebook_item_limit'] : 20; | |
$twitter_item_useimage = isset( $_POST['facebook_item_useimage']) ? $_POST['facebook_item_useimage'] : 0; | |
if( !$twitter_item_id ) return false; | |
$wall_social_feed_options['facebook'][$twitter_item_id] = array( | |
'category' => $twitter_item_category, | |
'limit' => $twitter_item_limit, | |
'use_image' => $twitter_item_useimage | |
); | |
update_option('wall_social_feed_options', $wall_social_feed_options); | |
} | |
} | |
/* Twitter */ | |
if( isset($_POST['twitter_create_item_wpnonce']) ){ | |
if( wp_verify_nonce($_POST['twitter_create_item_wpnonce'], 'twitter_create_item') ){ | |
$twitter_user = isset( $_POST['twitter_user'] ) ? $_POST['twitter_user'] : ''; | |
if( $twitter_user ){ | |
$wall_social_feed_options['twitter'][$twitter_user] = array( | |
'category' => 1, | |
'limit' => 20, | |
'use_image' => 0 | |
); | |
update_option('wall_social_feed_options', $wall_social_feed_options); | |
} | |
} | |
} | |
if( isset($_POST['remove_twitter_item_nonce']) ){ | |
if( wp_verify_nonce($_POST['remove_twitter_item_nonce'], 'remove_twitter_item') ){ | |
if( isset( $_POST['twitter_item_remove'] ) ){ | |
$item_remove = $_POST['twitter_item_remove']; | |
unset ( $wall_social_feed_options['twitter'][ $item_remove ] ); | |
update_option('wall_social_feed_options',$wall_social_feed_options); | |
} | |
} | |
} | |
if( isset( $_POST['twitter_item_update_nonce'] ) ){ | |
if( wp_verify_nonce( $_POST['twitter_item_update_nonce'], 'twitter_item_update') ){ | |
$twitter_item_id = isset( $_POST['twitter_item_id'] ) ? $_POST['twitter_item_id'] : ''; | |
$twitter_item_category = isset( $_POST['twitter_item_category']) ? $_POST['twitter_item_category'] : 1; | |
$twitter_item_limit = isset( $_POST['twitter_item_limit'] ) ? $_POST['twitter_item_limit'] : 20; | |
$twitter_item_useimage = isset( $_POST['twitter_item_useimage']) ? $_POST['twitter_item_useimage'] : 0; | |
if( !$twitter_item_id ) return false; | |
$wall_social_feed_options['twitter'][$twitter_item_id] = array( | |
'category' => $twitter_item_category, | |
'limit' => $twitter_item_limit, | |
'use_image' => $twitter_item_useimage | |
); | |
update_option('wall_social_feed_options', $wall_social_feed_options); | |
} | |
} | |
/*Youtubbe*/ | |
if( isset($_POST['youtube_create_item_wpnonce']) ){ | |
if( wp_verify_nonce($_POST['youtube_create_item_wpnonce'], 'youtube_create_item') ){ | |
$twitter_user = isset( $_POST['youtube_user'] ) ? $_POST['youtube_user'] : ''; | |
if( $twitter_user ){ | |
$wall_social_feed_options['youtube'][$twitter_user] = array( | |
'category' => 1, | |
'limit' => 20, | |
'use_image' => 1 | |
); | |
update_option('wall_social_feed_options', $wall_social_feed_options); | |
} | |
} | |
} | |
if( isset($_POST['remove_youtube_item_nonce']) ){ | |
if( wp_verify_nonce($_POST['remove_youtube_item_nonce'], 'remove_youtube_item') ){ | |
if( isset( $_POST['youtube_item_remove'] ) ){ | |
$item_remove = $_POST['youtube_item_remove']; | |
unset ( $wall_social_feed_options['youtube'][ $item_remove ] ); | |
update_option('wall_social_feed_options',$wall_social_feed_options); | |
} | |
} | |
} | |
if( isset( $_POST['youtube_item_update_nonce'] ) ){ | |
if( wp_verify_nonce( $_POST['youtube_item_update_nonce'], 'youtube_item_update') ){ | |
$twitter_item_id = isset( $_POST['youtube_item_id'] ) ? $_POST['youtube_item_id'] : ''; | |
$twitter_item_category = isset( $_POST['youtube_item_category']) ? $_POST['youtube_item_category'] : 1; | |
$twitter_item_limit = isset( $_POST['youtube_item_limit'] ) ? $_POST['youtube_item_limit'] : 20; | |
$twitter_item_useimage = isset( $_POST['youtube_item_useimage']) ? $_POST['youtube_item_useimage'] : 0; | |
if( !$twitter_item_id ) return false; | |
$wall_social_feed_options['youtube'][$twitter_item_id] = array( | |
'category' => $twitter_item_category, | |
'limit' => $twitter_item_limit, | |
'use_image' => $twitter_item_useimage | |
); | |
update_option('wall_social_feed_options', $wall_social_feed_options); | |
} | |
} | |
/*Instagram*/ | |
if( isset($_POST['instagram_create_item_wpnonce']) ){ | |
if( wp_verify_nonce($_POST['instagram_create_item_wpnonce'], 'instagram_create_item') ){ | |
$twitter_user = isset( $_POST['instagram_user'] ) ? $_POST['instagram_user'] : ''; | |
if( $twitter_user ){ | |
$wall_social_feed_options['instagram'][$twitter_user] = array( | |
'category' => 1, | |
'limit' => 20, | |
'use_image' => 1 | |
); | |
update_option('wall_social_feed_options', $wall_social_feed_options); | |
} | |
} | |
} | |
if( isset($_POST['remove_instagram_item_nonce']) ){ | |
if( wp_verify_nonce($_POST['remove_instagram_item_nonce'], 'remove_instagram_item') ){ | |
if( isset( $_POST['instagram_item_remove'] ) ){ | |
$item_remove = $_POST['instagram_item_remove']; | |
unset ( $wall_social_feed_options['instagram'][ $item_remove ] ); | |
update_option('wall_social_feed_options',$wall_social_feed_options); | |
} | |
} | |
} | |
if( isset( $_POST['instagram_item_update_nonce'] ) ){ | |
if( wp_verify_nonce( $_POST['instagram_item_update_nonce'], 'instagram_item_update') ){ | |
$twitter_item_id = isset( $_POST['instagram_item_id'] ) ? $_POST['instagram_item_id'] : ''; | |
$twitter_item_category = isset( $_POST['instagram_item_category']) ? $_POST['instagram_item_category'] : 1; | |
$twitter_item_limit = isset( $_POST['instagram_item_limit'] ) ? $_POST['instagram_item_limit'] : 20; | |
$twitter_item_useimage = isset( $_POST['instagram_item_useimage']) ? $_POST['instagram_item_useimage'] : 0; | |
if( !$twitter_item_id ) return false; | |
$wall_social_feed_options['instagram'][$twitter_item_id] = array( | |
'category' => $twitter_item_category, | |
'limit' => $twitter_item_limit, | |
'use_image' => $twitter_item_useimage | |
); | |
update_option('wall_social_feed_options', $wall_social_feed_options); | |
} | |
} | |
/*Flickr*/ | |
if( isset($_POST['flickr_create_item_wpnonce']) ){ | |
if( wp_verify_nonce($_POST['flickr_create_item_wpnonce'], 'flickr_create_item') ){ | |
$twitter_user = isset( $_POST['flickr_user'] ) ? $_POST['flickr_user'] : ''; | |
if( $twitter_user ){ | |
$wall_social_feed_options['flickr'][$twitter_user] = array( | |
'category' => 1, | |
'limit' => 20, | |
'use_image' => 1 | |
); | |
update_option('wall_social_feed_options', $wall_social_feed_options); | |
} | |
} | |
} | |
if( isset($_POST['remove_flickr_item_nonce']) ){ | |
if( wp_verify_nonce($_POST['remove_flickr_item_nonce'], 'remove_flickr_item') ){ | |
if( isset( $_POST['flickr_item_remove'] ) ){ | |
$item_remove = $_POST['flickr_item_remove']; | |
unset ( $wall_social_feed_options['flickr'][ $item_remove ] ); | |
update_option('wall_social_feed_options',$wall_social_feed_options); | |
} | |
} | |
} | |
if( isset( $_POST['flickr_item_update_nonce'] ) ){ | |
if( wp_verify_nonce( $_POST['flickr_item_update_nonce'], 'flickr_item_update') ){ | |
$twitter_item_id = isset( $_POST['flickr_item_id'] ) ? $_POST['flickr_item_id'] : ''; | |
$twitter_item_category = isset( $_POST['flickr_item_category']) ? $_POST['flickr_item_category'] : 1; | |
$twitter_item_limit = isset( $_POST['flickr_item_limit'] ) ? $_POST['flickr_item_limit'] : 20; | |
$twitter_item_useimage = isset( $_POST['flickr_item_useimage']) ? $_POST['flickr_item_useimage'] : 0; | |
if( !$twitter_item_id ) return false; | |
$wall_social_feed_options['flickr'][$twitter_item_id] = array( | |
'category' => $twitter_item_category, | |
'limit' => $twitter_item_limit, | |
'use_image' => $twitter_item_useimage | |
); | |
update_option('wall_social_feed_options', $wall_social_feed_options); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment