| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Returns Facebook ID |
| 5 |
* |
| 6 |
* @deprecated 3.0.0 |
| 7 |
* @since 1.0 |
| 8 |
* |
| 9 |
* @param int $user_id |
| 10 |
* |
| 11 |
* @return string |
| 12 |
*/ |
| 13 |
function get_facebook_id( $user_id ) { |
| 14 |
_deprecated_function( __FUNCTION__, '3.0.0', 'gianism_get_facebook_id' ); |
| 15 |
|
| 16 |
return gianism_get_facebook_id( $user_id ); |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
/** |
| 21 |
* Save message to specified user |
| 22 |
* |
| 23 |
* If user's email is pseudo one(e.g. example@pseudo.twitter.com), |
| 24 |
* WordPress's mail function <code>wp_mail</code> fails. |
| 25 |
* This function is originally used for <code>wp_mail</code> fallback. |
| 26 |
* But you can use this function to send message which will be |
| 27 |
* displayed on admin screen. |
| 28 |
* |
| 29 |
* @deprecated 3.0.0 |
| 30 |
* |
| 31 |
* @param int $user_id |
| 32 |
* @param string $body |
| 33 |
* @param int $from |
| 34 |
* @param string $subject |
| 35 |
* |
| 36 |
* @return bool |
| 37 |
*/ |
| 38 |
function gianism_message( $user_id, $body, $from = 0, $subject = '' ) { |
| 39 |
_deprecated_function( __FUNCTION__, '3.0.0' ); |
| 40 |
|
| 41 |
return false; |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
/** |
| 46 |
* Returns url to get Publish stream permission |
| 47 |
* |
| 48 |
* This function itself has no effect without action hook. |
| 49 |
* See example below: |
| 50 |
* |
| 51 |
* <pre> |
| 52 |
* // In some template, display button. |
| 53 |
* get_facebook_publish_permission_link(get_permalink(), 'my_favorite_action', array('post_id' => get_the_ID())); |
| 54 |
* |
| 55 |
* // Then, hook action in functions.php in your theme. |
| 56 |
* add_action('my_favorite_action', 'my_publish_action'); |
| 57 |
* |
| 58 |
* function my_publish_action($facebook, $args){ |
| 59 |
* $post = get_post($args['post_id']); |
| 60 |
* try{ |
| 61 |
* $facebook->api("/me/feed", "POST", array( |
| 62 |
* "message" => "I read this article!", |
| 63 |
* "link" => get_permalink($post->ID), |
| 64 |
* "name" => get_the_title($post->ID), |
| 65 |
* "description" => strip_tags($post->post_content), |
| 66 |
* "action" => json_encode(array( |
| 67 |
* "name" => get_bloginfo('name'), |
| 68 |
* "link" => home_url('/'))) |
| 69 |
* )); |
| 70 |
* }catch(FacebookApiException $e){ |
| 71 |
* // Error |
| 72 |
* wp_die($e->getMessage()); |
| 73 |
* } |
| 74 |
* } |
| 75 |
* </pre> |
| 76 |
* |
| 77 |
* @since 1.3 |
| 78 |
* @deprecated 3.0.0 |
| 79 |
* @param string $redirect_url URL where user will be redirect afeter authentication |
| 80 |
* @param string $action Action name which will be fired after authenticaction |
| 81 |
* @param array $args Array which will be passed to action hook |
| 82 |
* |
| 83 |
* @return string |
| 84 |
*/ |
| 85 |
function get_facebook_publish_permission_link( $redirect_url = null, $action = '', $args = array() ) { |
| 86 |
_deprecated_function( __FUNCTION__, '3.0.0', 'gianism_get_facebook_publish_permission_link' ); |
| 87 |
return gianism_get_facebook_publish_permission_link( $redirect_url, $action, $args ); |
| 88 |
} |
| 89 |
|
| 90 |
/** |
| 91 |
* Returns if user is connected with particular web service. |
| 92 |
* |
| 93 |
* @since 1.0 |
| 94 |
* @deprecated 3.0.0 |
| 95 |
* @param string $service One of facebook, mixi, yahoo, twitter or google. |
| 96 |
* @param int $user_id If not specified, current user id will be used. |
| 97 |
* |
| 98 |
* @return boolean |
| 99 |
*/ |
| 100 |
function is_user_connected_with( $service, $user_id = 0 ) { |
| 101 |
_deprecated_function( __FUNCTION__, '3.0.0', 'gianism_is_user_connected_with' ); |
| 102 |
return gianism_is_user_connected_with( $service, $user_id ); |
| 103 |
} |
| 104 |
|
| 105 |
/** |
| 106 |
* Get user object by credential |
| 107 |
* |
| 108 |
* Only facebook is supported. |
| 109 |
* |
| 110 |
* @todo Make other services to work. |
| 111 |
* @global \wpdb $wpdb |
| 112 |
* @since 1.0 |
| 113 |
* @deprecated 3.0.0 |
| 114 |
* @param string $service |
| 115 |
* @param mixed $credential |
| 116 |
* |
| 117 |
* @return \WP_User |
| 118 |
*/ |
| 119 |
function get_user_by_service( $service, $credential ) { |
| 120 |
_deprecated_function( __FUNCTION__, '3.0.0', 'gianism_get_user_by_service' ); |
| 121 |
return gianism_get_user_by_service( $service, $credential ); |
| 122 |
} |
| 123 |
|
| 124 |
/** |
| 125 |
* Returns if current user liked or not. |
| 126 |
* |
| 127 |
* You can use this function only on Facebook fan page tab. |
| 128 |
* |
| 129 |
* @deprecated 3.0.0 |
| 130 |
* @since 1.0 |
| 131 |
* @return boolean |
| 132 |
*/ |
| 133 |
function is_user_like_fangate() { |
| 134 |
_deprecated_function( __FILE__, '3.0.0' ); |
| 135 |
return false; |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
/** |
| 141 |
* Returns if current user is guest. |
| 142 |
* |
| 143 |
* Valid only on facebook fan gate. |
| 144 |
* |
| 145 |
* @deprecated 3.0.0 |
| 146 |
* @since 1.0 |
| 147 |
* @return boolean |
| 148 |
*/ |
| 149 |
function is_guest_on_fangate() { |
| 150 |
_deprecated_function( __FILE__, '3.0.0' ); |
| 151 |
return false; |
| 152 |
} |
| 153 |
|
| 154 |
|
| 155 |
/** |
| 156 |
* Returns if current user has wordpress account. |
| 157 |
* |
| 158 |
* You can this function only on Facebook fan page tab. |
| 159 |
* |
| 160 |
* @deprecated 3.0.0 |
| 161 |
* @global \wpdb $wpdb |
| 162 |
* @param string $service |
| 163 |
* |
| 164 |
* @return boolean |
| 165 |
*/ |
| 166 |
function is_user_registered_with( $service ) { |
| 167 |
_deprecated_function( __FUNCTION__, '3.0.0' ); |
| 168 |
return false; |
| 169 |
} |
| 170 |
|
| 171 |
|
| 172 |
/** |
| 173 |
* Returns facebook id on fan gate. |
| 174 |
* |
| 175 |
* @since 1.0 |
| 176 |
* @deprecated 3.0.0 |
| 177 |
* @return string|boolean |
| 178 |
*/ |
| 179 |
function get_user_id_on_fangate() { |
| 180 |
_deprecated_function( __FILE__, '3.0.0' ); |
| 181 |
return false; |
| 182 |
} |
| 183 |
|
| 184 |
/** |
| 185 |
* Get Twitter Screen Name |
| 186 |
* |
| 187 |
* @since 1.2 |
| 188 |
* @deprecated 3.0.0 |
| 189 |
* @param int $user_id |
| 190 |
* |
| 191 |
* @return string|false |
| 192 |
*/ |
| 193 |
function get_twitter_screen_name( $user_id ) { |
| 194 |
_deprecated_function( __FILE__, '3.0.0', 'gianism_get_twitter_screen_name' ); |
| 195 |
return gianism_get_twitter_screen_name( $user_id ); |
| 196 |
} |
| 197 |
|
| 198 |
/** |
| 199 |
* Update Twitter timeline |
| 200 |
* |
| 201 |
* @since 1.3 |
| 202 |
* @deprecated 3.0.0 |
| 203 |
* @param string $string |
| 204 |
*/ |
| 205 |
function update_twitter_status( $string ) { |
| 206 |
_deprecated_function( __FILE__, '3.0.0', 'gianism_update_twitter_status' ); |
| 207 |
gianism_update_twitter_status( $string ); |
| 208 |
} |
| 209 |
|
| 210 |
|
| 211 |
/** |
| 212 |
* Reply to specified user by Owner Account |
| 213 |
* |
| 214 |
* @since 1.0 |
| 215 |
* @deprecated 3.0.0 |
| 216 |
* @param int $user_id |
| 217 |
* @param string $string |
| 218 |
* |
| 219 |
* @return boolean |
| 220 |
*/ |
| 221 |
function twitter_reply_to( $user_id, $string ) { |
| 222 |
_deprecated_function( __FILE__, '3.0.0', 'gianism_twitter_reply_to' ); |
| 223 |
return gianism_twitter_reply_to( $user_id, $string ); |
| 224 |
} |
| 225 |
|
| 226 |
/** |
| 227 |
* Get twitter time line in JSON format object |
| 228 |
* |
| 229 |
* Caching is recommended. |
| 230 |
* |
| 231 |
* <pre> |
| 232 |
* $timeline = get_transient('twitter_timeline'); |
| 233 |
* if( false === $timeline){ |
| 234 |
* $timeline = twitter_get_timeline('my_screen_name'); |
| 235 |
* set_transient('twitter_timeline', $timeline, 3600); |
| 236 |
* } |
| 237 |
* foreach($timeline as $status){ |
| 238 |
* // Echo status |
| 239 |
* } |
| 240 |
* </pre> |
| 241 |
* |
| 242 |
* @since 1.3 |
| 243 |
* @deprecated 3.0.0 |
| 244 |
* |
| 245 |
* @param string $screen_name If not specified, admin user's screen name will be used. |
| 246 |
* @param array $additional_data |
| 247 |
* |
| 248 |
* @return object JSON format object. |
| 249 |
*/ |
| 250 |
function twitter_get_timeline( $screen_name = null, array $additional_data = array() ) { |
| 251 |
_deprecated_function( __FILE__, '3.0.0', 'gianism_twitter_get_timeline' ); |
| 252 |
gianism_twitter_get_timeline( $screen_name, $additional_data ); |
| 253 |
} |
| 254 |
|
| 255 |
|
| 256 |
/** |
| 257 |
* Detect if user is geek |
| 258 |
* |
| 259 |
* Geek means user is connected with Github. |
| 260 |
* |
| 261 |
* @since 2.0.0 |
| 262 |
* @deprecated 3.0.0 |
| 263 |
* @param int $user_id |
| 264 |
* |
| 265 |
* @return bool |
| 266 |
*/ |
| 267 |
function is_geek( $user_id ) { |
| 268 |
/** @var \Gianism\Service\Github $github */ |
| 269 |
$github = \Gianism\Service\Github::get_instance(); |
| 270 |
|
| 271 |
return (bool) get_user_meta( $user_id, $github->umeta_id ); |
| 272 |
} |
| 273 |
|
| 274 |
/** |
| 275 |
* Detect if current user is geek |
| 276 |
* |
| 277 |
* @since 2.0.0 |
| 278 |
* @deprecated 3.0.0 |
| 279 |
* @see is_geek |
| 280 |
* @return bool |
| 281 |
*/ |
| 282 |
function is_current_user_geek() { |
| 283 |
return is_geek( get_current_user_id() ); |
| 284 |
} |