Changeset 2903429
- Timestamp:
- 04/24/2023 04:43:03 PM (16 months ago)
- Location:
- social-planner
- Files:
-
- 22 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
social-planner/assets/banner-1544x500.png
-
Property
svn:mime-type
changed from
application/octet-stream
toimage/png
-
Property
svn:mime-type
changed from
-
social-planner/assets/banner-772x250.png
-
Property
svn:mime-type
changed from
application/octet-stream
toimage/png
-
Property
svn:mime-type
changed from
-
social-planner/assets/icon-128x128.png
-
Property
svn:mime-type
changed from
application/octet-stream
toimage/png
-
Property
svn:mime-type
changed from
-
social-planner/assets/icon-256x256.png
-
Property
svn:mime-type
changed from
application/octet-stream
toimage/png
-
Property
svn:mime-type
changed from
-
social-planner/assets/screenshot-1.png
-
Property
svn:mime-type
changed from
application/octet-stream
toimage/png
-
Property
svn:mime-type
changed from
-
social-planner/assets/screenshot-2.png
-
Property
svn:mime-type
changed from
application/octet-stream
toimage/png
-
Property
svn:mime-type
changed from
-
social-planner/assets/screenshot-3.png
-
Property
svn:mime-type
changed from
application/octet-stream
toimage/png
-
Property
svn:mime-type
changed from
-
social-planner/assets/screenshot-4.png
-
Property
svn:mime-type
changed from
application/octet-stream
toimage/png
-
Property
svn:mime-type
changed from
-
social-planner/tags/1.1.12/networks/class-network-facebook.php
r2699801 r2903429 152 152 $body['message'] = $excerpt; 153 153 154 155 156 157 158 159 160 161 162 163 164 154 165 return self::send_request( $url . '/feed', $body ); 155 166 } … … 270 281 } 271 282 283 284 285 286 287 288 289 290 291 292 293 272 294 return wp_remote_post( $url, $args ); 273 295 } -
social-planner/tags/1.1.12/networks/class-network-ok.php
r2699801 r2903429 185 185 $body['access_token'] = $settings['access_token']; 186 186 187 188 189 190 191 192 193 194 195 196 197 187 198 return self::send_request( $url, $body ); 188 199 } … … 398 409 } 399 410 411 412 413 414 415 416 417 418 419 420 421 400 422 return wp_remote_post( $url, $args ); 401 423 } -
social-planner/tags/1.1.12/networks/class-network-telegram.php
r2699801 r2903429 165 165 $body['text'] = $excerpt; 166 166 167 168 169 170 171 172 173 174 175 176 177 167 178 return self::send_request( $url . '/sendMessage', $body ); 168 179 } … … 196 207 197 208 return self::send_request( $url . '/sendPhoto', $body, $headers ); 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 198 279 } 199 280 … … 216 297 } 217 298 299 300 301 302 303 304 305 306 307 308 309 218 310 return wp_remote_post( $url, $args ); 219 311 } 220 221 /**222 * Create multipart data.223 *224 * @param array $data List of default query params.225 * @param array $files List of files.226 * @param string $boundary Boundary delimiter.227 */228 private static function prepare_multipart_data( $data, $files, $boundary ) {229 $body = array();230 231 foreach ( $data as $key => $value ) {232 $body[] = "--$boundary";233 $body[] = "Content-Disposition: form-data; name=\"$key\"";234 $body[] = "\r\n" . $value;235 }236 237 foreach ( $files as $name => $filename ) {238 $file = basename( $filename );239 $type = wp_check_filetype( $filename )['type'];240 241 // phpcs:ignore WordPress.WP.AlternativeFunctions242 $content = file_get_contents( $filename );243 244 if ( false === $content ) {245 return new WP_Error( 'sending', esc_html__( 'Cannot read poster file' ) );246 }247 248 $body[] = "--$boundary";249 $body[] = "Content-Disposition: form-data; name=\"$name\"; filename=\"$file\"";250 $body[] = "Content-Type: $type";251 $body[] = "\r\n" . $content;252 }253 254 // Add final boundary.255 $body[] = "--$boundary--\r\n";256 257 return implode( "\r\n", $body );258 }259 260 /**261 * Prepare message excerpt.262 *263 * @param array $message List of message args.264 */265 private static function prepare_message_excerpt( $message ) {266 $excerpt = array();267 268 if ( ! empty( $message['excerpt'] ) ) {269 $message['excerpt'] = preg_replace( '/\*(.+?)\*/s', '<b>$1</b>', $message['excerpt'] );270 $message['excerpt'] = preg_replace( '/_(.+?)_/s', '<i>$1</i>', $message['excerpt'] );271 272 $excerpt[] = $message['excerpt'];273 }274 275 if ( ! empty( $message['link'] ) ) {276 $excerpt[] = $message['link'];277 }278 279 $excerpt = implode( "\n\n", $excerpt );280 281 /**282 * Filter message excerpt right before sending.283 *284 * @param string $excerpt Message excerpt.285 * @param array $message Original message array.286 * @param string $network Network name.287 */288 return apply_filters( 'social_planner_prepare_excerpt', $excerpt, $message, self::NETWORK_NAME );289 }290 312 } -
social-planner/tags/1.1.12/networks/class-network-twitter.php
r2699801 r2903429 181 181 ); 182 182 183 184 185 186 187 188 189 190 191 192 193 183 194 return self::send_request( $url, $body, $headers ); 184 195 } … … 233 244 234 245 /** 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 235 338 * Send request to remote server. 236 339 * … … 250 353 } 251 354 355 356 357 358 359 360 361 362 363 364 365 252 366 return wp_remote_post( $url, $args ); 253 367 } 254 255 /**256 * Create multipart data.257 *258 * @param string $path Path to local file.259 * @param string $name Name of body parameter.260 * @param string $boundary Boundary delimiter.261 */262 private static function prepare_multipart_data( $path, $name, $boundary ) {263 $file = basename( $path );264 $type = wp_check_filetype( $path )['type'];265 266 // phpcs:ignore WordPress.WP.AlternativeFunctions267 $content = file_get_contents( $path );268 269 if ( false === $content ) {270 return new WP_Error( 'sending', esc_html__( 'Cannot read poster file', 'social-planner' ) );271 }272 273 $body[] = "--$boundary";274 $body[] = "Content-Disposition: form-data; name=\"$name\"; filename=\"$file\"";275 $body[] = "Content-Type: $type";276 $body[] = "\r\n" . $content;277 $body[] = "--$boundary--\r\n";278 279 return implode( "\r\n", $body );280 }281 282 /**283 * Create status from message object.284 *285 * @param array $message List of message args.286 */287 private static function prepare_message_excerpt( $message ) {288 $excerpt = array();289 290 if ( ! empty( $message['excerpt'] ) ) {291 $excerpt[] = $message['excerpt'];292 }293 294 if ( ! empty( $message['link'] ) ) {295 $excerpt[] = $message['link'];296 }297 298 $excerpt = implode( "\n\n", $excerpt );299 300 /**301 * Filter message excerpt right before sending.302 *303 * @param string $excerpt Message excerpt.304 * @param array $message Original message array.305 * @param string $network Network name.306 */307 return apply_filters( 'social_planner_prepare_excerpt', $excerpt, $message, self::NETWORK_NAME );308 }309 310 /**311 * Generate OAuth signature.312 *313 * @param string $url API endpoint.314 * @param string $secret Generated secret.315 * @param array $fields List of query arguments.316 */317 private static function get_oauth_signature( $url, $secret, $fields ) {318 ksort( $fields );319 320 $values = array();321 322 foreach ( $fields as $key => $value ) {323 $values[] = "$key=" . rawurlencode( $value );324 }325 326 $base = 'POST&' . rawurlencode( $url ) . '&' . rawurlencode( implode( '&', $values ) );327 328 // phpcs:ignore329 return base64_encode( hash_hmac( 'sha1', $base, $secret, true ) );330 }331 332 /**333 * Build OAuth header.334 *335 * @param array $fields List of header arguments.336 */337 private static function build_oauth_header( $fields ) {338 $values = array();339 340 foreach ( $fields as $key => $value ) {341 $values[] = $key . '="' . rawurlencode( $value ) . '"';342 }343 344 return 'OAuth ' . implode( ', ', $values );345 }346 368 } -
social-planner/tags/1.1.12/networks/class-network-vk.php
r2699801 r2903429 159 159 ); 160 160 161 $url = 'https://api.vk.com/method/wall.post'; 161 /** 162 * Filter request body arguments using message data. 163 * 164 * @param string $body Request body arguments. 165 * @param array $message Message data. 166 * @param string $network Network name. 167 * 168 * @since 1.1.12 169 */ 170 $body = apply_filters( 'social_planner_filter_request_body', $body, $message, self::NETWORK_NAME ); 162 171 163 172 // Publish message. 164 return self::send_request( $url, $body );173 return self::send_request( , $body ); 165 174 } 166 175 … … 192 201 } 193 202 194 $url = 'https://api.vk.com/method/photos.saveWallPhoto';195 196 203 // Save image to VK.com wall. 197 $response = self::send_request( $url, array_merge( $body, $options ) );204 $response = self::send_request( , array_merge( $body, $options ) ); 198 205 199 206 if ( is_wp_error( $response ) ) { … … 262 269 */ 263 270 private static function get_upload_server( $body ) { 264 $url = 'https://api.vk.com/method/photos.getWallUploadServer';265 266 271 // Try to get VK wall upload server. 267 $response = self::send_request( $url, $body );272 $response = self::send_request( , $body ); 268 273 269 274 if ( is_wp_error( $response ) ) { … … 369 374 } 370 375 376 377 378 379 380 381 382 383 384 385 386 371 387 return wp_remote_post( $url, $args ); 372 388 } -
social-planner/tags/1.1.12/readme.txt
r2839003 r2903429 4 4 Tags: automation, autopost, auto-post, auto post, socialnetworks, socialnetwork, social networks, social network, facebook, twitter, telegram, vkontakte, vk.com, ok.ru, api, social images, social image, sharing, share, repost, re-post, open graph 5 5 Requires at least: 5.3 6 Tested up to: 6. 17 Stable tag: 1.1.1 16 Tested up to: 6. 7 Stable tag: 1.1.1 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later … … 51 51 == Changelog == 52 52 53 54 55 53 56 = 1.1.11 = 54 57 * Fixing `subscribeOnSaving` error on Post editor while using Classic Editor -
social-planner/tags/1.1.12/social-planner.php
r2839003 r2903429 8 8 * Requires at least: 5.3 9 9 * Tested up to: 5.8 10 * Version: 1.1.1 110 * Version: 1.1.1 11 11 * 12 12 * Text Domain: social-planner … … 29 29 * Plugin version. 30 30 */ 31 define( 'SOCIAL_PLANNER_VERSION', '1.1.1 1' );31 define( 'SOCIAL_PLANNER_VERSION', '1.1.1' ); 32 32 33 33 /** … … 44 44 * Shortcut constant to the path of this file. 45 45 */ 46 define( 'SOCIAL_PLANNER_DIR', dirname( __FILE__ ));46 define( 'SOCIAL_PLANNER_DIR', ); 47 47 48 48 /** -
social-planner/trunk/networks/class-network-facebook.php
r2699801 r2903429 152 152 $body['message'] = $excerpt; 153 153 154 155 156 157 158 159 160 161 162 163 164 154 165 return self::send_request( $url . '/feed', $body ); 155 166 } … … 270 281 } 271 282 283 284 285 286 287 288 289 290 291 292 293 272 294 return wp_remote_post( $url, $args ); 273 295 } -
social-planner/trunk/networks/class-network-ok.php
r2699801 r2903429 185 185 $body['access_token'] = $settings['access_token']; 186 186 187 188 189 190 191 192 193 194 195 196 197 187 198 return self::send_request( $url, $body ); 188 199 } … … 398 409 } 399 410 411 412 413 414 415 416 417 418 419 420 421 400 422 return wp_remote_post( $url, $args ); 401 423 } -
social-planner/trunk/networks/class-network-telegram.php
r2699801 r2903429 165 165 $body['text'] = $excerpt; 166 166 167 168 169 170 171 172 173 174 175 176 177 167 178 return self::send_request( $url . '/sendMessage', $body ); 168 179 } … … 196 207 197 208 return self::send_request( $url . '/sendPhoto', $body, $headers ); 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 198 279 } 199 280 … … 216 297 } 217 298 299 300 301 302 303 304 305 306 307 308 309 218 310 return wp_remote_post( $url, $args ); 219 311 } 220 221 /**222 * Create multipart data.223 *224 * @param array $data List of default query params.225 * @param array $files List of files.226 * @param string $boundary Boundary delimiter.227 */228 private static function prepare_multipart_data( $data, $files, $boundary ) {229 $body = array();230 231 foreach ( $data as $key => $value ) {232 $body[] = "--$boundary";233 $body[] = "Content-Disposition: form-data; name=\"$key\"";234 $body[] = "\r\n" . $value;235 }236 237 foreach ( $files as $name => $filename ) {238 $file = basename( $filename );239 $type = wp_check_filetype( $filename )['type'];240 241 // phpcs:ignore WordPress.WP.AlternativeFunctions242 $content = file_get_contents( $filename );243 244 if ( false === $content ) {245 return new WP_Error( 'sending', esc_html__( 'Cannot read poster file' ) );246 }247 248 $body[] = "--$boundary";249 $body[] = "Content-Disposition: form-data; name=\"$name\"; filename=\"$file\"";250 $body[] = "Content-Type: $type";251 $body[] = "\r\n" . $content;252 }253 254 // Add final boundary.255 $body[] = "--$boundary--\r\n";256 257 return implode( "\r\n", $body );258 }259 260 /**261 * Prepare message excerpt.262 *263 * @param array $message List of message args.264 */265 private static function prepare_message_excerpt( $message ) {266 $excerpt = array();267 268 if ( ! empty( $message['excerpt'] ) ) {269 $message['excerpt'] = preg_replace( '/\*(.+?)\*/s', '<b>$1</b>', $message['excerpt'] );270 $message['excerpt'] = preg_replace( '/_(.+?)_/s', '<i>$1</i>', $message['excerpt'] );271 272 $excerpt[] = $message['excerpt'];273 }274 275 if ( ! empty( $message['link'] ) ) {276 $excerpt[] = $message['link'];277 }278 279 $excerpt = implode( "\n\n", $excerpt );280 281 /**282 * Filter message excerpt right before sending.283 *284 * @param string $excerpt Message excerpt.285 * @param array $message Original message array.286 * @param string $network Network name.287 */288 return apply_filters( 'social_planner_prepare_excerpt', $excerpt, $message, self::NETWORK_NAME );289 }290 312 } -
social-planner/trunk/networks/class-network-twitter.php
r2699801 r2903429 181 181 ); 182 182 183 184 185 186 187 188 189 190 191 192 193 183 194 return self::send_request( $url, $body, $headers ); 184 195 } … … 233 244 234 245 /** 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 235 338 * Send request to remote server. 236 339 * … … 250 353 } 251 354 355 356 357 358 359 360 361 362 363 364 365 252 366 return wp_remote_post( $url, $args ); 253 367 } 254 255 /**256 * Create multipart data.257 *258 * @param string $path Path to local file.259 * @param string $name Name of body parameter.260 * @param string $boundary Boundary delimiter.261 */262 private static function prepare_multipart_data( $path, $name, $boundary ) {263 $file = basename( $path );264 $type = wp_check_filetype( $path )['type'];265 266 // phpcs:ignore WordPress.WP.AlternativeFunctions267 $content = file_get_contents( $path );268 269 if ( false === $content ) {270 return new WP_Error( 'sending', esc_html__( 'Cannot read poster file', 'social-planner' ) );271 }272 273 $body[] = "--$boundary";274 $body[] = "Content-Disposition: form-data; name=\"$name\"; filename=\"$file\"";275 $body[] = "Content-Type: $type";276 $body[] = "\r\n" . $content;277 $body[] = "--$boundary--\r\n";278 279 return implode( "\r\n", $body );280 }281 282 /**283 * Create status from message object.284 *285 * @param array $message List of message args.286 */287 private static function prepare_message_excerpt( $message ) {288 $excerpt = array();289 290 if ( ! empty( $message['excerpt'] ) ) {291 $excerpt[] = $message['excerpt'];292 }293 294 if ( ! empty( $message['link'] ) ) {295 $excerpt[] = $message['link'];296 }297 298 $excerpt = implode( "\n\n", $excerpt );299 300 /**301 * Filter message excerpt right before sending.302 *303 * @param string $excerpt Message excerpt.304 * @param array $message Original message array.305 * @param string $network Network name.306 */307 return apply_filters( 'social_planner_prepare_excerpt', $excerpt, $message, self::NETWORK_NAME );308 }309 310 /**311 * Generate OAuth signature.312 *313 * @param string $url API endpoint.314 * @param string $secret Generated secret.315 * @param array $fields List of query arguments.316 */317 private static function get_oauth_signature( $url, $secret, $fields ) {318 ksort( $fields );319 320 $values = array();321 322 foreach ( $fields as $key => $value ) {323 $values[] = "$key=" . rawurlencode( $value );324 }325 326 $base = 'POST&' . rawurlencode( $url ) . '&' . rawurlencode( implode( '&', $values ) );327 328 // phpcs:ignore329 return base64_encode( hash_hmac( 'sha1', $base, $secret, true ) );330 }331 332 /**333 * Build OAuth header.334 *335 * @param array $fields List of header arguments.336 */337 private static function build_oauth_header( $fields ) {338 $values = array();339 340 foreach ( $fields as $key => $value ) {341 $values[] = $key . '="' . rawurlencode( $value ) . '"';342 }343 344 return 'OAuth ' . implode( ', ', $values );345 }346 368 } -
social-planner/trunk/networks/class-network-vk.php
r2699801 r2903429 159 159 ); 160 160 161 $url = 'https://api.vk.com/method/wall.post'; 161 /** 162 * Filter request body arguments using message data. 163 * 164 * @param string $body Request body arguments. 165 * @param array $message Message data. 166 * @param string $network Network name. 167 * 168 * @since 1.1.12 169 */ 170 $body = apply_filters( 'social_planner_filter_request_body', $body, $message, self::NETWORK_NAME ); 162 171 163 172 // Publish message. 164 return self::send_request( $url, $body );173 return self::send_request( , $body ); 165 174 } 166 175 … … 192 201 } 193 202 194 $url = 'https://api.vk.com/method/photos.saveWallPhoto';195 196 203 // Save image to VK.com wall. 197 $response = self::send_request( $url, array_merge( $body, $options ) );204 $response = self::send_request( , array_merge( $body, $options ) ); 198 205 199 206 if ( is_wp_error( $response ) ) { … … 262 269 */ 263 270 private static function get_upload_server( $body ) { 264 $url = 'https://api.vk.com/method/photos.getWallUploadServer';265 266 271 // Try to get VK wall upload server. 267 $response = self::send_request( $url, $body );272 $response = self::send_request( , $body ); 268 273 269 274 if ( is_wp_error( $response ) ) { … … 369 374 } 370 375 376 377 378 379 380 381 382 383 384 385 386 371 387 return wp_remote_post( $url, $args ); 372 388 } -
social-planner/trunk/readme.txt
r2839003 r2903429 4 4 Tags: automation, autopost, auto-post, auto post, socialnetworks, socialnetwork, social networks, social network, facebook, twitter, telegram, vkontakte, vk.com, ok.ru, api, social images, social image, sharing, share, repost, re-post, open graph 5 5 Requires at least: 5.3 6 Tested up to: 6. 17 Stable tag: 1.1.1 16 Tested up to: 6. 7 Stable tag: 1.1.1 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later … … 51 51 == Changelog == 52 52 53 54 55 53 56 = 1.1.11 = 54 57 * Fixing `subscribeOnSaving` error on Post editor while using Classic Editor -
social-planner/trunk/social-planner.php
r2839003 r2903429 8 8 * Requires at least: 5.3 9 9 * Tested up to: 5.8 10 * Version: 1.1.1 110 * Version: 1.1.1 11 11 * 12 12 * Text Domain: social-planner … … 29 29 * Plugin version. 30 30 */ 31 define( 'SOCIAL_PLANNER_VERSION', '1.1.1 1' );31 define( 'SOCIAL_PLANNER_VERSION', '1.1.1' ); 32 32 33 33 /** … … 44 44 * Shortcut constant to the path of this file. 45 45 */ 46 define( 'SOCIAL_PLANNER_DIR', dirname( __FILE__ ));46 define( 'SOCIAL_PLANNER_DIR', ); 47 47 48 48 /**
Note: See TracChangeset
for help on using the changeset viewer.