Changeset 539681
- Timestamp:
- 05/03/2012 09:44:33 PM (14 years ago)
- File:
-
- 1 edited
-
sociable/trunk/sociable.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sociable/trunk/sociable.php
r536915 r539681 1 1 <?php 2 2 3 /* 3 4 5 6 4 7 Plugin Name: Sociable 5 8 9 10 6 11 Plugin URI: http://blogplay.com/plugin 7 12 13 14 8 15 Description: Automatically add links on your posts, pages and RSS feed to your favorite social bookmarking sites. 9 16 17 18 10 19 Version: 4.2.7 11 20 21 22 12 23 Author: Blogplay 13 24 25 26 14 27 Author URI: http://blogplay.com/ 15 28 29 30 16 31 Copyright 2006 Peter Harkins ([email protected]) 17 32 33 34 18 35 Copyright 2008-2009 Joost de Valk ([email protected]) 19 36 37 38 20 39 Copyright 2009-Present Blogplay.com ([email protected]) 21 40 41 42 22 43 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 23 44 45 46 24 47 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 25 48 49 50 26 51 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 52 27 53 */ 28 54 55 56 29 57 /* 58 30 59 * Define Some Paths 60 31 61 */ 32 62 63 64 33 65 define( 'SOCIABLE_HTTP_PATH' , WP_PLUGIN_URL . '/' . str_replace(basename( __FILE__) , "" , plugin_basename(__FILE__) ) ); 66 34 67 define( 'SOCIABLE_ABSPATH' , WP_PLUGIN_DIR . '/' . str_replace(basename( __FILE__) , "" , plugin_basename(__FILE__) ) ); 68 35 69 /* 36 70 71 72 37 73 * Includes 38 74 75 76 39 77 */ 40 78 79 80 41 81 include 'includes/class-sociable_Admin_Options.php'; 42 82 83 84 43 85 include("includes/skyscraper_output.php"); 44 86 87 88 45 89 include 'includes/class-Sociable_Globals.php'; 46 90 91 92 47 93 include 'includes/sociable_output.php'; 48 94 95 96 49 97 /* 50 98 99 100 51 101 * Global Variables 52 102 103 104 53 105 */ 106 54 107 //$sociable_known_sites = Sociable_Globals::default_sites(); 55 108 109 110 56 111 $sociable_options = get_option( 'sociable_options' ); 57 112 113 114 58 115 $skyscraper_options = get_option( 'skyscraper_options' ); 59 116 117 118 60 119 $skyscraper_latest = get_option( 'skyscraper_latest' ); 61 120 121 122 62 123 $skyscraper_mentions = get_option( 'skyscraper_mentions' ); 63 124 125 126 64 127 //$sociable_post_types = array(); //Set This blank here, won't work before init 65 128 129 130 66 131 //$sociable_taxonomies = array(); //Same Here 132 67 133 /* 68 134 135 136 69 137 * General Init Function 70 138 139 140 71 141 */ 142 72 143 function sociable_init(){ 73 144 145 146 74 147 wp_enqueue_script('jquery'); 75 148 149 150 76 151 global $sociable_post_types, $sociable_taxonomies, $sociable_options, $skyscraper_options; 77 152 153 154 78 155 $import_call_asyn = true; 79 156 157 158 80 159 $url_shares = $_SERVER["REQUEST_URI"]; 160 81 161 if (strpos($url_shares, "wp-admin")){ 82 162 163 164 83 165 if (strpos($url_shares, "wp-admin") && !strpos($url_shares, "page=skyscraper_options")){ 166 84 167 $import_call_asyn = false; 85 168 169 170 86 171 } 87 172 173 174 88 175 } 89 176 177 178 90 179 else{ 180 91 181 if (!isset($skyscraper_options["active"])){ 182 92 183 $import_call_asyn = false; 93 184 185 186 94 187 } 95 188 189 190 96 191 } 97 192 193 194 98 195 if ($import_call_asyn){ 196 99 197 wp_enqueue_script( 'async_call' , SOCIABLE_HTTP_PATH . 'js/async_call.js' ); 100 198 199 200 101 201 wp_enqueue_script( 'oplugin' , SOCIABLE_HTTP_PATH . 'js/oPlugin.js' ); 102 202 203 204 103 205 wp_enqueue_style( "skyscraper_style_shape",SOCIABLE_HTTP_PATH."css/shape.css"); 104 206 207 208 105 209 wp_enqueue_style( "skyscraper_style_toolbar", SOCIABLE_HTTP_PATH."css/toolbar.css"); 106 210 211 212 107 213 108 214 215 216 109 217 } 110 218 219 220 111 221 if (!isset($sociable_options['icon_size']) || $sociable_options['icon_size'] == "" || !isset($sociable_options['version'])) sociable_reset(); 222 112 223 224 113 225 if (!isset($skyscraper_options['accept_read_twitter'])){ 114 226 227 228 115 229 //skyscraper_reset(); 230 116 231 } 232 117 233 234 118 235 236 119 237 load_plugin_textdomain( 'sociable', false, dirname( plugin_basename( __FILE__ ) )."/languages" ); 120 238 239 240 121 241 $active_sites = ( isset( $sociable_options['active_sites'] ) ) ? $sociable_options['active_sites'] : array() ; 122 242 243 244 123 245 //Set The Post Types 246 124 247 $sociable_post_types = Sociable_Globals::sociable_get_post_types(); 248 125 249 //Set The Custom Taxonomies 250 126 251 $sociable_taxonomies = Sociable_Globals::sociable_get_taxonomies(); 252 127 253 wp_enqueue_script( 'sociable' , SOCIABLE_HTTP_PATH . 'js/sociable.js' ); 128 254 255 256 129 257 wp_enqueue_script( 'addtofavourites' , SOCIABLE_HTTP_PATH . 'js/addtofavorites.js' ); 130 258 259 260 131 261 if( ! is_admin() ){ 262 132 263 //Load Up The Front Of Site CSS And JS 264 133 265 if( array_key_exists( 'Add to favorites' , $active_sites ) ){ 266 134 267 // wp_enqueue_script( 'addtofavourites' , SOCIABLE_HTTP_PATH . 'js/addtofavorites.js' ); 135 268 269 270 136 271 } 137 272 273 274 138 275 if( isset( $sociable_options['use_stylesheet'] ) ){ 276 139 277 wp_enqueue_style( 'sociablecss' , SOCIABLE_HTTP_PATH . 'css/sociable.css' ); 140 278 279 280 141 281 } 142 282 283 284 143 285 } 144 286 287 288 145 289 } 290 146 291 /* 147 292 293 294 148 295 * Hooks And Filters 149 296 297 298 150 299 */ 300 151 301 add_action( 'admin_init' , array( 'sociable_Admin_Options' , 'init' ) ); 152 302 303 304 153 305 add_action( 'admin_menu' , array( 'sociable_Admin_Options' , 'add_menu_pages' ) ); 154 306 307 308 155 309 add_action( 'save_post' , array( 'sociable_Admin_Options' , 'save_post' ) ); 156 310 311 312 157 313 add_action( 'init' , 'sociable_init' ); 158 314 315 316 159 317 add_action( 'wp_head' , 'sociable_init_async' ); 160 318 319 320 161 321 function sociable_init_async(){ 322 162 323 echo "<script type='text/javascript'>"; 163 324 325 326 164 327 echo "var base_url_sociable = '".SOCIABLE_HTTP_PATH."'"; 165 328 329 330 166 331 echo "</script><script type='text/javascript' src='http://apis.google.com/js/plusone.js'></script>"; 167 332 333 334 168 335 } 336 169 337 add_filter( 'the_content', 'auto_sociable' ); 338 170 339 //add_filter( 'get_pages', 'auto_skyscraper' ); 171 340 341 342 172 343 //add_filter( 'the_excerpt', 'auto_skyscraper' ); 173 344 345 346 174 347 add_filter( 'the_excerpt', 'auto_sociable' ); 175 348 349 350 176 351 register_activation_hook(__FILE__, 'sociable_activate' ); 177 352 353 354 178 355 register_deactivation_hook( __FILE__, 'sociable_deactivate' ); 179 356 357 358 180 359 /* 181 360 361 362 182 363 * Activation Function 183 364 365 366 184 367 */ 368 185 369 function sociable_activate(){ 186 370 371 372 187 373 if( ! get_option( 'sociable_options' ) ){ 374 188 375 return sociable_reset(); 189 376 377 378 190 379 } 191 380 381 382 192 383 } 384 193 385 /* 194 386 387 388 195 389 * Reset Function 196 390 391 392 197 393 */ 394 198 395 function sociable_reset(){ 396 199 397 global $wpdb; 398 200 399 //reset all data to factory defaults, install if is there. 201 400 401 402 202 403 //Delete All Metadata From The Database ? 404 203 405 $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '_sociableoff'"); 406 204 407 $sociable_options = array( 408 205 409 'version' =>'4.2.7', 206 410 411 412 207 413 'automatic_mode' => 'on', 208 414 415 416 209 417 'tagline' => 'Be Sociable, Share!', 210 418 419 420 211 421 'custom_image_directory' => '', 212 422 423 424 213 425 'use_stylesheet' => 'on', 214 426 427 428 215 429 'use_images' => 'on', 216 430 431 432 217 433 'use_alphamask' => 'on', 218 434 435 436 219 437 'new_window' => 'on', 220 438 221 'help_grow' => 'on', 439 440 441 'help_grow' => '', 442 443 222 444 223 445 'locations' => array( 224 446 447 448 225 449 'is_single' => 'on', 226 450 451 452 227 453 'is_page' => 'on' 228 454 455 456 229 457 ), 230 458 459 460 231 461 'active_sites' => array( 232 462 463 464 233 465 'Twitter' => 'on', 234 466 467 468 235 469 'Facebook' => 'on', 236 470 471 472 237 473 'email'=>'on', 238 474 475 476 239 477 'Add to favorites'=>'on', 240 478 479 480 241 481 'StumbleUpon' =>'on', 242 482 483 484 243 485 'Delicious' =>'on', 244 486 487 488 245 489 'Google Reader' =>'on', 246 490 491 492 247 493 'LinkedIn' => 'on', 248 494 495 496 249 497 'BlinkList' =>'on', 250 498 499 500 251 501 'More' => 'on', 252 502 503 504 253 505 'Twitter Counter' =>'on', 254 506 507 508 255 509 'Facebook Counter' =>'on', 256 510 511 512 257 513 'Google +' =>'on', 258 514 515 516 259 517 'LinkedIn Counter' =>'on', 260 518 519 520 261 521 'StumbleUpon Counter' =>'on' 262 522 523 524 263 525 ), 264 526 527 528 265 529 'icon_size' => '32', 266 530 531 532 267 533 'icon_option' => 'option1', 268 534 269 "active" => 1 535 536 537 "active" => 1, 538 539 'linksoptions' => '' 270 540 271 541 ); 542 272 543 $sociable_known_sites = array( 544 273 545 'Facebook' => array( 274 546 547 548 275 549 'favicon' => 'facebook.png', 276 550 551 552 277 553 'url' => 'http://www.facebook.com/share.php?u=PERMALINK&t=TITLE', 278 554 555 556 279 557 'spriteCoordinates' => Array( 280 558 559 560 281 561 '16' => array("-48px","0px"), 282 562 563 564 283 565 '32' => array("-96px","0px"), 284 566 567 568 285 569 '48' => array("-144px","0px"), 286 570 571 572 287 573 '64' => array("-192px","0px") 288 574 575 576 289 577 ) 290 578 579 580 291 581 ), 292 582 583 584 293 585 'Facebook Counter' => array( 294 586 587 588 295 589 'counter' =>1, 296 590 591 592 297 593 'favicon' => 'likecounter.png', 298 594 595 596 299 597 'url' => '<iframe src="http://www.facebook.com/plugins/like.php?href=PERMALINKCOUNT&send=false&layout=button_count&show_faces=false&action=like&colorscheme=light&font" scrolling="no" frameborder="0" style="border:none; overflow:hidden;height:32px;width:100px" allowTransparency="true"></iframe>', 300 598 599 600 301 601 'spriteCoordinates' => Array( 302 602 603 604 303 605 '16' => array("-48px","0px"), 304 606 607 608 305 609 '32' => array("-96px","0px"), 306 610 611 612 307 613 '48' => array("-144px","0px"), 308 614 615 616 309 617 '64' => array("-192px","0px") 310 618 619 620 311 621 ) 312 622 623 624 313 625 ), 626 314 627 'Myspace' => array( 315 628 629 630 316 631 'favicon' => 'myspace.png', 317 632 633 634 318 635 'url' => 'http://www.myspace.com/Modules/PostTo/Pages/?u=PERMALINK&t=TITLE', 319 636 637 638 320 639 'spriteCoordinates' => Array( 321 640 641 642 322 643 '16' => array("0px","-16px"), 323 644 645 646 324 647 '32' => array("0px","-32px"), 325 648 649 650 326 651 '48' => array("0px","-48px"), 327 652 653 654 328 655 '64' => array("0px","-64px") 329 656 657 658 330 659 ) 331 660 661 662 332 663 ), 664 333 665 'Twitter' => array( 334 666 667 668 335 669 'favicon' => 'twitter.png', 336 670 337 'url' => 'http://twitter.com/intent/tweet?text=TITLE%20-%20PERMALINK%20(via%20@sociablesite)%20/blogplay.com/%20blogplay.com', 671 672 673 'url' => 'http://twitter.com/intent/tweet?text=TITLE%20-%20PERMALINK%20 SHARETAG', 674 675 338 676 339 677 'spriteCoordinates' => Array( 340 678 679 680 341 681 '16' => array("-144px","-16px"), 342 682 683 684 343 685 '32' => array("-288px","-32px"), 344 686 687 688 345 689 '48' => array("-432px","-48px"), 346 690 691 692 347 693 '64' => array("-576px","-64px") 348 694 695 696 349 697 ) 350 698 699 700 351 701 ), 702 352 703 'Twitter Counter' => array( 353 704 705 706 354 707 'counter' =>1, 355 708 709 710 356 711 'favicon' => 'twitter.png', 357 712 358 'url' => '<a href="https://twitter.com/share" data-text="TITLECOUNT - PERMALINKCOUNT *blogplay.com* blogplay.com" data-url="PERMALINKCOUNT" class="twitter-share-button" data-count="horizontal">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>', 713 714 715 'url' => '<a href="https://twitter.com/share" data-text="TITLECOUNT - PERMALINKCOUNT" data-url="PERMALINKCOUNT" class="twitter-share-button" data-count="horizontal">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>', 716 717 359 718 360 719 'spriteCoordinates' => Array( 361 720 721 722 362 723 '16' => array("-144px","-16px"), 363 724 725 726 364 727 '32' => array("-288px","-32px"), 365 728 729 730 366 731 '48' => array("-432px","-48px"), 367 732 733 734 368 735 '64' => array("-576px","-64px") 369 736 737 738 370 739 ) 371 740 741 742 372 743 ), 373 744 745 746 374 747 'LinkedIn' => array( 375 748 749 750 376 751 'favicon' => 'linkedin.png', 377 752 753 754 378 755 'url' => 'http://www.linkedin.com/shareArticle?mini=true&url=PERMALINK&title=TITLE&source=BLOGNAME&summary=EXCERPT', 379 756 757 758 380 759 'spriteCoordinates' => Array( 381 760 761 762 382 763 '16' => array("-144px","0px"), 383 764 765 766 384 767 '32' => array("-288px","0px"), 385 768 769 770 386 771 '48' => array("-432px","0px"), 387 772 773 774 388 775 '64' => array("-576px","0px") 389 776 777 778 390 779 ) 391 780 781 782 392 783 ), 784 393 785 'LinkedIn Counter' => array( 394 786 787 788 395 789 'counter'=>1, 396 790 791 792 397 793 'favicon' => 'linkedin.png', 398 794 795 796 399 797 'url' => '<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script><script type="IN/Share" data-url="PERMALINKCOUNT" data-counter="right"></script>', 400 798 799 800 401 801 'spriteCoordinates' => Array( 802 402 803 '16' => array("-144px","0px"), 403 804 805 806 404 807 '32' => array("-288px","0px"), 405 808 809 810 406 811 '48' => array("-432px","0px"), 407 812 813 814 408 815 '64' => array("-576px","0px") 409 816 817 818 410 819 ) 411 820 821 822 412 823 ), 824 413 825 'Delicious' => array( 826 414 827 'favicon' => 'delicious.png', 415 828 829 830 416 831 'url' => 'http://delicious.com/post?url=PERMALINK&title=TITLE&notes=EXCERPT', 417 832 833 834 418 835 'spriteCoordinates' => Array( 419 836 837 838 420 839 '16' => array("-16px","0px"), 421 840 841 842 422 843 '32' => array("-32px","0px"), 423 844 845 846 424 847 '48' => array("-48px","0px"), 425 848 849 850 426 851 '64' => array("-64px","0px") 427 852 853 854 428 855 ) 429 856 857 858 430 859 ), 860 431 861 'Digg' => array( 862 432 863 'favicon' => 'digg.png', 433 864 865 866 434 867 'url' => 'http://digg.com/submit?phase=2&url=PERMALINK&title=TITLE&bodytext=EXCERPT', 435 868 869 870 436 871 'spriteCoordinates' => Array( 437 872 873 874 438 875 '16' => array("-32px","0px"), 439 876 877 878 440 879 '32' => array("-64px","0px"), 441 880 881 882 442 883 '48' => array("-96px","0px"), 443 884 885 886 444 887 '64' => array("-128px","0px") 445 888 889 890 446 891 ) 447 892 893 894 448 895 ), 449 896 897 898 450 899 'Digg Counter' => array( 451 900 901 902 452 903 'counter' =>1, 453 904 905 906 454 907 'favicon' => 'digg.png', 455 908 909 910 456 911 'url' => "<script type='text/javascript'>(function() {var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];s.type = 'text/javascript';s.async = true;s.src = 'http://widgets.digg.com/buttons.js';s1.parentNode.insertBefore(s, s1);})();</script><a href='http://digg.com/submit?url=PERMALINK&title=TITLE' class='DiggThisButton DiggCompact'></a>", 912 457 913 'spriteCoordinates' => Array( 458 914 915 916 459 917 '16' => array("-32px","0px"), 460 918 919 920 461 921 '32' => array("-64px","0px"), 462 922 923 924 463 925 '48' => array("-96px","0px"), 464 926 927 928 465 929 '64' => array("-128px","0px") 466 930 931 932 467 933 ) 468 934 935 936 469 937 ), 938 470 939 'Reddit' => array( 940 471 941 'favicon' => 'reddit.png', 472 942 943 944 473 945 474 946 947 948 475 949 'url' => 'http://reddit.com/submit?url=PERMALINK&title=TITLE', 476 950 951 952 477 953 'spriteCoordinates' => Array( 478 954 955 956 479 957 '16' => array("-64px","-16px"), 480 958 959 960 481 961 '32' => array("-128px","-32px"), 482 962 963 964 483 965 '48' => array("-192px","-48px"), 484 966 967 968 485 969 '64' => array("-256px","-64px") 486 970 971 972 487 973 ) 488 974 975 976 489 977 ), 490 978 979 980 491 981 492 982 983 984 493 985 'StumbleUpon' => array( 494 986 987 988 495 989 'favicon' => 'stumbleupon.png', 496 990 991 992 497 993 'url' => 'http://www.stumbleupon.com/submit?url=PERMALINK&title=TITLE', 498 994 995 996 499 997 'spriteCoordinates' => Array( 500 998 999 1000 501 1001 '16' => array("-112px","-16px"), 502 1002 1003 1004 503 1005 '32' => array("-224px","-32px"), 504 1006 1007 1008 505 1009 '48' => array("-336px","-48px"), 506 1010 1011 1012 507 1013 '64' => array("-448px","-64px") 508 1014 1015 1016 509 1017 )), 510 1018 1019 1020 511 1021 512 1022 1023 1024 513 1025 'StumbleUpon Counter' => array( 514 1026 1027 1028 515 1029 'counter' =>1, 516 1030 1031 1032 517 1033 'favicon' => 'stumbleupon.png', 518 1034 1035 1036 519 1037 'url' => '<script src="http://www.stumbleupon.com/hostedbadge.php?s=2&r=PERMALINKCOUNT"></script>', 520 1038 1039 1040 521 1041 'spriteCoordinates' => Array( 522 1042 1043 1044 523 1045 '16' => array("-112px","-16px"), 524 1046 1047 1048 525 1049 '32' => array("-224px","-32px"), 526 1050 1051 1052 527 1053 '48' => array("-336px","-48px"), 528 1054 1055 1056 529 1057 '64' => array("-448px","-64px") 530 1058 1059 1060 531 1061 ) 532 1062 1063 1064 533 1065 ), 534 1066 1067 1068 535 1069 'Google Bookmarks' => Array ( 536 1070 1071 1072 537 1073 'favicon' => 'google.png', 538 1074 1075 1076 539 1077 'url' => 'http://www.google.com/bookmarks/mark?op=edit&bkmk=PERMALINK&title=TITLE&annotation=EXCERPT', 540 1078 1079 1080 541 1081 'description' => 'Google Bookmarks', 542 1082 1083 1084 543 1085 'spriteCoordinates' => Array( 544 1086 1087 1088 545 1089 '16' => array("-96px","0px"), 546 1090 1091 1092 547 1093 '32' => array("-192px","0px"), 548 1094 1095 1096 549 1097 '48' => array("-288px","0px"), 550 1098 1099 1100 551 1101 '64' => array("-384px","0px") 552 1102 1103 1104 553 1105 ) 554 1106 1107 1108 555 1109 ), 556 1110 1111 1112 557 1113 558 1114 1115 1116 559 1117 'Google +' => Array ( 560 1118 1119 1120 561 1121 562 1122 1123 1124 563 1125 'counter' =>1, 564 1126 1127 1128 565 1129 'favicon' => 'google.png', 566 1130 1131 1132 567 1133 /* 'url' => '<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> 568 1134 1135 1136 569 1137 <g:plusone annotation="bubble" size="medium"></g:plusone>',*/ 570 1138 1139 1140 571 1141 'url' => '<g:plusone annotation="bubble" href="PERMALINKCOUNT" size="medium"></g:plusone>', 572 1142 1143 1144 573 1145 /* 574 1146 1147 1148 575 1149 <script type="text/javascript"> 576 1150 1151 1152 577 1153 window.___gcfg = { 578 1154 1155 1156 579 1157 lang: \'en-US\' 580 1158 1159 1160 581 1161 }; 582 1162 1163 1164 583 1165 (function() { 584 1166 1167 1168 585 1169 var po = document.createElement(\'script\'); po.type = \'text/javascript\'; po.async = true; 586 1170 1171 1172 587 1173 po.src = \'https://apis.google.com/js/plusone.js\'; 588 1174 1175 1176 589 1177 var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s); 590 1178 1179 1180 591 1181 })(); 592 1182 1183 1184 593 1185 </script> 594 1186 1187 1188 595 1189 ',*/ 596 1190 1191 1192 597 1193 'description' => 'Google Bookmarks', 598 1194 1195 1196 599 1197 'spriteCoordinates' => Array( 600 1198 1199 1200 601 1201 '16' => array("-96px","0px"), 602 1202 1203 1204 603 1205 '32' => array("-192px","0px"), 604 1206 1207 1208 605 1209 '48' => array("-288px","0px"), 606 1210 1211 1212 607 1213 '64' => array("-384px","0px") 608 1214 1215 1216 609 1217 ) 610 1218 1219 1220 611 1221 ), 612 1222 1223 1224 613 1225 614 1226 1227 1228 615 1229 'HackerNews' => Array( 616 1230 1231 1232 617 1233 'favicon' => 'hacker_news.png', 618 1234 1235 1236 619 1237 'url' => 'http://news.ycombinator.com/submitlink?u=PERMALINK&t=TITLE', 620 1238 1239 1240 621 1241 'spriteCoordinates' => Array( 622 1242 1243 1244 623 1245 '16' => array("-128px","0px"), 624 1246 1247 1248 625 1249 '32' => array("-256px","0px"), 626 1250 1251 1252 627 1253 '48' => array("-384px","0px"), 628 1254 1255 1256 629 1257 '64' => array("-512px","0px") 630 1258 1259 1260 631 1261 ) 632 1262 1263 1264 633 1265 ), 634 1266 1267 1268 635 1269 'MSNReporter' => Array( 636 1270 1271 1272 637 1273 'favicon' => 'msn.png', 638 1274 1275 1276 639 1277 'url' => 'http://reporter.es.msn.com/?fn=contribute&Title=TITLE&URL=PERMALINK&cat_id=6&tag_id=31&Remark=EXCERPT', 640 1278 1279 1280 641 1281 'description' => 'MSN Reporter', 642 1282 1283 1284 643 1285 'spriteCoordinates' => Array( 644 1286 1287 1288 645 1289 '16' => array("-176px","0px"), 646 1290 1291 1292 647 1293 '32' => array("-352px","0px"), 648 1294 1295 1296 649 1297 '48' => array("-528px","0px"), 650 1298 1299 1300 651 1301 '64' => array("-704px","0px") 652 1302 1303 1304 653 1305 ) 654 1306 1307 1308 655 1309 ), 656 1310 1311 1312 657 1313 658 1314 1315 1316 659 1317 'BlinkList' => Array( 660 1318 1319 1320 661 1321 'favicon' => 'blinklist.png', 662 1322 1323 1324 663 1325 'url' => 'http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url=PERMALINK&Title=TITLE', 664 1326 1327 1328 665 1329 'spriteCoordinates' => Array( 666 1330 1331 1332 667 1333 '16' => array("0px","0px"), 668 1334 1335 1336 669 1337 '32' => array("0px","0px"), 670 1338 1339 1340 671 1341 '48' => array("0px","0px"), 672 1342 1343 1344 673 1345 '64' => array("0px","0px") 674 1346 1347 1348 675 1349 ), 676 1350 1351 1352 677 1353 'supportsIframe' => false, 678 1354 1355 1356 679 1357 ), 680 1358 1359 1360 681 1361 'Sphinn' => Array( 682 1362 1363 1364 683 1365 'favicon' => 'sphinn.png', 684 1366 1367 1368 685 1369 'url' => 'http://sphinn.com/index.php?c=post&m=submit&link=PERMALINK', 686 1370 1371 1372 687 1373 'spriteCoordinates' => Array( 688 1374 1375 1376 689 1377 '16' => array("-96px","-16px"), 690 1378 1379 1380 691 1381 '32' => array("-192px","-32px"), 692 1382 1383 1384 693 1385 '48' => array("-288px","-48px"), 694 1386 1387 1388 695 1389 '64' => array("-384px","-64px") 696 1390 1391 1392 697 1393 ) 698 1394 1395 1396 699 1397 ), 700 1398 1399 1400 701 1401 702 1402 1403 1404 703 1405 'Posterous' => Array( 704 1406 1407 1408 705 1409 'favicon' => 'posterous.png', 706 1410 1411 1412 707 1413 'url' => 'http://posterous.com/share?linkto=PERMALINK&title=TITLE&selection=EXCERPT', 708 1414 1415 1416 709 1417 'spriteCoordinates' => Array( 710 1418 1419 1420 711 1421 '16' => array("-32px","-16px"), 712 1422 1423 1424 713 1425 '32' => array("-64px","-32px"), 714 1426 1427 1428 715 1429 '48' => array("-96px","-48px"), 716 1430 1431 1432 717 1433 '64' => array("-128px","-64px") 718 1434 1435 1436 719 1437 ) 720 1438 1439 1440 721 1441 ), 722 1442 1443 1444 723 1445 'Tumblr' => Array( 724 1446 1447 1448 725 1449 'favicon' => 'tumblr.png', 726 1450 1451 1452 727 1453 'url' => 'http://www.tumblr.com/share?v=3&u=PERMALINK&t=TITLE&s=EXCERPT', 728 1454 1455 1456 729 1457 'spriteCoordinates' => Array( 730 1458 1459 1460 731 1461 '16' => array("-128px","-16px"), 732 1462 1463 1464 733 1465 '32' => array("-256px","-32px"), 734 1466 1467 1468 735 1469 '48' => array("-384px","-48px"), 736 1470 1471 1472 737 1473 '64' => array("-512px","-64px") 738 1474 1475 1476 739 1477 ), 740 1478 1479 1480 741 1481 'supportsIframe' => false 742 1482 1483 1484 743 1485 ), 744 1486 1487 1488 745 1489 'email' => Array( 746 1490 1491 1492 747 1493 'favicon' => 'gmail.png', 748 1494 1495 1496 749 1497 'url' => 'https://mail.google.com/mail/?view=cm&fs=1&to&su=TITLE&body=PERMALINK&ui=2&tf=1&shva=1', 750 1498 1499 1500 751 1501 'spriteCoordinates' => Array( 752 1502 1503 1504 753 1505 '16' => array("-80px","0px"), 754 1506 1507 1508 755 1509 '32' => array("-160px","0px"), 756 1510 1511 1512 757 1513 '48' => array("-240px","0px"), 758 1514 1515 1516 759 1517 '64' => array("-320px","0px") 760 1518 1519 1520 761 1521 ), 762 1522 1523 1524 763 1525 'supportsIframe' => false 764 1526 1527 1528 765 1529 ), 766 1530 1531 1532 767 1533 768 1534 1535 1536 769 1537 'Google Reader' => array ( 770 1538 1539 1540 771 1541 'favicon' => 'googlebuzz.png', 772 1542 1543 1544 773 1545 'url' => 'http://www.google.com/reader/link?url=PERMALINK&title=TITLE&srcURL=PERMALINK&srcTitle=BLOGNAME', 774 1546 1547 1548 775 1549 'spriteCoordinates' => Array( 776 1550 1551 1552 777 1553 '16' => array("-112px","0px"), 778 1554 1555 1556 779 1557 '32' => array("-224px","0px"), 780 1558 1559 1560 781 1561 '48' => array("-336px","0px"), 782 1562 1563 1564 783 1565 '64' => array("-448px","0px") 784 1566 1567 1568 785 1569 ) 786 1570 1571 1572 787 1573 ), 788 1574 1575 1576 789 1577 'Add to favorites' => array( 790 1578 1579 1580 791 1581 'favicon' => 'favorites.png', 792 1582 1583 1584 793 1585 'url' => 'javascript:AddToFavorites();', 794 1586 1587 1588 795 1589 'spriteCoordinates' => Array( 796 1590 1591 1592 797 1593 '16' => array("-64px","0px"), 798 1594 1595 1596 799 1597 '32' => array("-128px","0px"), 800 1598 1599 1600 801 1601 '48' => array("-192px","0px"), 802 1602 1603 1604 803 1605 '64' => array("-256px","0px") 804 1606 1607 1608 805 1609 ) 806 1610 1611 1612 807 1613 ), 808 1614 1615 1616 809 1617 'More' => array( 810 1618 1619 1620 811 1621 'favicon' => 'more.png', 812 1622 1623 1624 813 1625 'url' => 'javascript:more();', 814 1626 1627 1628 815 1629 'spriteCoordinates' => Array( 816 1630 1631 1632 817 1633 '16' => array("0px","0px"), 818 1634 1635 1636 819 1637 '32' => array("0px","0px"), 820 1638 1639 1640 821 1641 '48' => array("0px","0px"), 822 1642 1643 1644 823 1645 '64' => array("0px","0px") 824 1646 1647 1648 825 1649 ) 826 1650 1651 1652 827 1653 ), 828 1654 1655 1656 829 1657 ); 1658 830 1659 1660 831 1661 1662 832 1663 //Update will create if it doesn't exist. 833 1664 1665 1666 834 1667 1668 835 1669 update_option( 'sociable_known_sites' , $sociable_known_sites ); 1670 836 1671 update_option( 'sociable_options' , $sociable_options ); 1672 837 1673 update_option( 'sociable_helpus' , 1); 1674 838 1675 } 839 1676 1677 1678 840 1679 function skyscraper_reset(){ 841 1680 1681 1682 842 1683 $skyscraper_options = array( 1684 843 1685 "version" => "1.0", 1686 844 1687 "widget_width" => "60px", 1688 845 1689 "widget_position" => "1", 1690 846 1691 "background_color" => "#fefefe", 1692 847 1693 "labels_color" => "#f7f7f7", 1694 848 1695 "text_size" => "10px", 1696 849 1697 "counters" => array("check" => "0", 1698 850 1699 "folded" => "0"), 1700 851 1701 "share" => array("check" => "0", 1702 852 1703 "folded" => "0"), 1704 853 1705 "num_tweets" => 3, 1706 854 1707 "num_rss" =>3, 1708 855 1709 "locations" => array("is_front_page" => 1, 1710 856 1711 "is_home" => 1, 1712 857 1713 "is_single" => 1, 1714 858 1715 "is_page" => 1, 1716 859 1717 "is_category" => 1, 1718 860 1719 "is_date" => 1, 1720 861 1721 "is_tag" => 1, 1722 862 1723 "is_author" => 1, 1724 863 1725 "is_search" => 1, 1726 864 1727 "is_rss" => 1 ), 1728 865 1729 1730 866 1731 "counters" => array("check" => 1, 1732 867 1733 "folded" => 1), 1734 868 1735 "share" => array("check" => 1, 1736 869 1737 "folded" => 1), 870 1738 1739 1740 871 1741 "sociable_banner" => "", 872 1742 1743 1744 873 1745 "sociable_banner_timer" => 15, 874 1746 1747 1748 875 1749 "sociable_banner_text" => 'Please spread the word: Be Sociable, Share!', 876 1750 1751 1752 877 1753 "sociable_banner_colorBack" => '#FFFFFF', 878 1754 1755 1756 879 1757 "sociable_banner_fontSize" => '9px', 880 1758 1759 1760 881 1761 "sociable_banner_colorLabel" => '#F7F7F7', 1762 882 1763 1764 883 1765 "sociable_banner_colorFont" => '#6A6A6A', 1766 884 1767 1768 885 1769 "accept_read_twitter" => '', 1770 886 1771 1772 887 1773 "accept_read_rss" => '' 1774 888 1775 ); 889 1776 1777 1778 890 1779 update_option( 'skyscraper_options' , $skyscraper_options ); 1780 891 1781 1782 892 1783 1784 893 1785 $skyscraper_latest = array(); 1786 894 1787 update_option("skyscraper_latest",$skyscraper_latest ); 1788 895 1789 1790 896 1791 $skyscraper_mentions = array(); 1792 897 1793 update_option("skyscraper_mentions",$skyscraper_mentions ); 1794 898 1795 } 899 1796 1797 1798 900 1799 /* 1800 901 1801 * De-Activate Function 1802 902 1803 */ 1804 903 1805 function sociable_deactivate(){ 1806 904 1807 // global $wpdb; 1808 905 1809 // //Delete The Metadata 1810 906 1811 // $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '_sociableoff'"); 1812 907 1813 // //delete The Options 1814 908 1815 // return delete_option( 'sociable_options' ); 1816 909 1817 } 910 1818 1819 1820 911 1821 /* 1822 912 1823 * Function To Completely Remove The Options 1824 913 1825 */ 1826 914 1827 function sociable_2_remove(){ 1828 915 1829 require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); 1830 916 1831 1832 917 1833 global $wpdb; 1834 918 1835 //Delete The Metadata 1836 919 1837 $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '_sociableoff'"); 1838 920 1839 //delete The Options 1840 921 1841 delete_option( 'sociable_options' ); 1842 922 1843 delete_option( 'skyscraper_options' ); 1844 923 1845 1846 924 1847 925 1848 1849 1850 926 1851 deactivate_plugins( array( 'sociable/sociable.php' ) ); 1852 927 1853 wp_redirect( '/wp-admin/plugins.php?deactivate=true' ); 1854 928 1855 } 929 1856 1857 1858 930 1859 /* 1860 931 1861 * Generic Plugin Wide Functions 1862 932 1863 */ 1864 933 1865 function _get_sociable_image_path(){ 934 1866 1867 1868 935 1869 global $sociable_options; 936 1870 1871 1872 937 1873 938 1874 1875 1876 939 1877 if( empty( $sociable_options['custom_icons'] )){ 940 1878 1879 1880 941 1881 if ($sociable_options['icon_option'] !="option6"){ 942 1882 1883 1884 943 1885 $path = trailingslashit( SOCIABLE_HTTP_PATH . 'images/'.$sociable_options['icon_option']."/" . $sociable_options['icon_size'] ); 944 1886 1887 1888 945 1889 }else{ 946 1890 1891 1892 947 1893 948 1894 1895 1896 949 1897 $path = trailingslashit( SOCIABLE_HTTP_PATH . 'images/original/'); 950 1898 1899 1900 951 1901 } 952 1902 1903 1904 953 1905 } else { 954 1906 1907 1908 955 1909 $path = trailingslashit( SOCIABLE_HTTP_PATH . 'images/customIcons/'); 956 1910 1911 1912 957 1913 } 958 1914 1915 1916 959 1917 960 1918 1919 1920 961 1921 962 1922 1923 1924 963 1925 return $path; 964 1926 1927 1928 965 1929 } 966 1930 1931 1932 967 1933 function _get_sociable_image( $site, $description ){ 968 1934 1935 1936 969 1937 global $sociable_options; 970 1938 1939 1940 971 1941 $imageclass = ''; 1942 972 1943 $imagestyle = ''; 1944 973 1945 $imagepath = _get_sociable_image_path(); 1946 974 1947 //Get The Source Of The Image 1948 975 1949 if ( ! isset( $site['spriteCoordinates'] ) || ! isset( $sociable_options['use_sprites'] ) || is_feed() ) { 976 1950 1951 1952 977 1953 if ( strpos( $site['favicon'], 'http' ) === 0 ) { 1954 978 1955 $imagesource = $site['favicon']; 1956 979 1957 } else { 1958 980 1959 $imagesource = $imagepath.$site['favicon']; 1960 981 1961 } 982 1962 1963 1964 983 1965 } else { 984 1966 1967 1968 985 1969 $imagesource = $imagepath . "services-sprite.gif"; 1970 986 1971 $services_sprite_url = $imagepath . "sprite.png"; 987 1972 1973 1974 988 1975 $spriteCoords = $site['spriteCoordinates']; 1976 989 1977 1978 990 1979 $size = $sociable_options['icon_size']; 991 1980 1981 1982 992 1983 $imagestyle = 'width: ' . $size . 'px; height: ' . $size . 'px; background: transparent url(' . $services_sprite_url . ') no-repeat; background-position:' . $spriteCoords[$size] . 'px 0'; 993 1984 1985 1986 994 1987 } 1988 995 1989 996 1990 1991 1992 997 1993 if( isset( $sociable_options['use_alphamask'] ) ){ 1994 998 1995 $imageclass .= 'sociable-hovers'; 1996 999 1997 } 1000 1998 1999 2000 1001 2001 //If A Class Has Been Specified, Ensure It Is Added To The Class Attribute. 2002 1002 2003 if ( isset( $site['class'] ) ) { 2004 1003 2005 $imageclass .= 'sociable_' . $site['class']; 2006 1004 2007 } 2008 1005 2009 2010 1006 2011 if( $imagestyle != '' ){ 2012 1007 2013 $imagestyle = 'style="' . $imagestyle . '"'; 2014 1008 2015 } 2016 1009 2017 if ($sociable_options['icon_option'] !="option6"){ 1010 2018 2019 2020 1011 2021 $image = '<img src="' . $imagesource . '" title="' . $description . '" alt="' . $description . '"' . $imagestyle . ' />' ; 1012 2022 2023 2024 1013 2025 }else{ 1014 2026 2027 2028 1015 2029 $image = '<img class="' . $imageclass . '" src="' . $imagesource . '" title="' . $description . '" alt="' . $description . '"' . $imagestyle . ' />' ; 1016 2030 2031 2032 1017 2033 } 2034 1018 2035 2036 1019 2037 return $image; 2038 1020 2039 } 1021 2040 2041 2042 1022 2043 ?>
Note: See TracChangeset
for help on using the changeset viewer.