summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Chatzimichos <tampakrap@gentoo.org>2013-08-01 08:53:46 +0200
committerTheo Chatzimichos <tampakrap@gentoo.org>2013-08-01 08:53:46 +0200
commitc65f25a29edb6d47fa7d99a69c274f906b61adea (patch)
tree3f85de9f4159f72bb555310a6e4e5da75276a7ff /plugins/jetpack
parentbump kde-graffiti (diff)
downloadblogs-gentoo-c65f25a29edb6d47fa7d99a69c274f906b61adea.tar.gz
blogs-gentoo-c65f25a29edb6d47fa7d99a69c274f906b61adea.tar.bz2
blogs-gentoo-c65f25a29edb6d47fa7d99a69c274f906b61adea.zip
Update jetpack, akismet and wordpress-importer
Diffstat (limited to 'plugins/jetpack')
-rw-r--r--plugins/jetpack/_inc/gallery-settings.js15
-rw-r--r--plugins/jetpack/_inc/images/a8c.pngbin2058 -> 845 bytes
-rw-r--r--plugins/jetpack/_inc/images/alertbox-closeicon-2x.pngbin515 -> 245 bytes
-rw-r--r--plugins/jetpack/_inc/images/alertbox-closeicon.pngbin437 -> 240 bytes
-rw-r--r--plugins/jetpack/_inc/images/alertbox-clouds-2x.pngbin2247 -> 1308 bytes
-rw-r--r--plugins/jetpack/_inc/images/alertbox-clouds.pngbin1088 -> 640 bytes
-rw-r--r--plugins/jetpack/_inc/images/arrow-2x.pngbin460 -> 267 bytes
-rw-r--r--plugins/jetpack/_inc/images/arrow-pointer-blue-2x.pngbin3022 -> 2052 bytes
-rw-r--r--plugins/jetpack/_inc/images/arrow.pngbin296 -> 173 bytes
-rw-r--r--plugins/jetpack/_inc/images/arrows-2x.pngbin1371 -> 978 bytes
-rw-r--r--plugins/jetpack/_inc/images/arrows-dark-2x.pngbin1416 -> 958 bytes
-rw-r--r--plugins/jetpack/_inc/images/arrows-dark-vs-2x.pngbin1287 -> 1093 bytes
-rw-r--r--plugins/jetpack/_inc/images/arrows-vs-2x.pngbin1213 -> 1079 bytes
-rw-r--r--plugins/jetpack/_inc/images/atdbuttontr-2x.pngbin1840 -> 1598 bytes
-rw-r--r--plugins/jetpack/_inc/images/automattic-2x.pngbin5902 -> 3851 bytes
-rw-r--r--plugins/jetpack/_inc/images/automattic.pngbin3056 -> 1904 bytes
-rw-r--r--plugins/jetpack/_inc/images/bubble_bg-2x.pngbin570 -> 532 bytes
-rw-r--r--plugins/jetpack/_inc/images/comment-grey-bubble-2x.pngbin256 -> 175 bytes
-rw-r--r--plugins/jetpack/_inc/images/delete-2x.pngbin4009 -> 3687 bytes
-rw-r--r--plugins/jetpack/_inc/images/footer-clouds-2x.pngbin63998 -> 57101 bytes
-rw-r--r--plugins/jetpack/_inc/images/footer-clouds.pngbin23583 -> 20077 bytes
-rw-r--r--plugins/jetpack/_inc/images/generic-2x.pngbin2166 -> 1826 bytes
-rw-r--r--plugins/jetpack/_inc/images/header-clouds-2x.pngbin78134 -> 50373 bytes
-rw-r--r--plugins/jetpack/_inc/images/header-clouds-small-2x.pngbin29032 -> 18157 bytes
-rw-r--r--plugins/jetpack/_inc/images/header-clouds-small.pngbin12781 -> 7969 bytes
-rw-r--r--plugins/jetpack/_inc/images/header-clouds.pngbin30454 -> 18565 bytes
-rw-r--r--plugins/jetpack/_inc/images/icon-comingsoon-2x.pngbin3096 -> 1960 bytes
-rw-r--r--plugins/jetpack/_inc/images/icon-comingsoon.pngbin1482 -> 896 bytes
-rw-r--r--plugins/jetpack/_inc/images/icon-pointer-flag-2x.pngbin2427 -> 1747 bytes
-rw-r--r--plugins/jetpack/_inc/images/image-2x.pngbin5414 -> 2671 bytes
-rw-r--r--plugins/jetpack/_inc/images/imgedit-icons-2x.pngbin17070 -> 15590 bytes
-rw-r--r--plugins/jetpack/_inc/images/jetpack-closebox-icon.pngbin388 -> 189 bytes
-rw-r--r--plugins/jetpack/_inc/images/list-2x.pngbin2052 -> 2000 bytes
-rw-r--r--plugins/jetpack/_inc/images/logo-2x.pngbin52802 -> 50369 bytes
-rw-r--r--plugins/jetpack/_inc/images/logo-small-2x.pngbin28124 -> 27389 bytes
-rw-r--r--plugins/jetpack/_inc/images/logo-small.pngbin11205 -> 10611 bytes
-rw-r--r--plugins/jetpack/_inc/images/logo.pngbin22543 -> 21731 bytes
-rw-r--r--plugins/jetpack/_inc/images/media-button-2x.pngbin1206 -> 875 bytes
-rw-r--r--plugins/jetpack/_inc/images/menuicon-sprite-2x.pngbin4456 -> 3688 bytes
-rw-r--r--plugins/jetpack/_inc/images/menuicon-sprite.pngbin1652 -> 1351 bytes
-rw-r--r--plugins/jetpack/_inc/images/module-clouds-2x.pngbin5942 -> 5375 bytes
-rw-r--r--plugins/jetpack/_inc/images/module-clouds.pngbin2646 -> 2378 bytes
-rw-r--r--plugins/jetpack/_inc/images/module-icons-sprite-2x.pngbin72735 -> 59781 bytes
-rw-r--r--plugins/jetpack/_inc/images/module-icons-sprite.pngbin31542 -> 28049 bytes
-rw-r--r--plugins/jetpack/_inc/images/press-this-2x.pngbin887 -> 821 bytes
-rw-r--r--plugins/jetpack/_inc/images/publicize.pngbin113219 -> 81768 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/blue-large.pngbin1797 -> 1776 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/blue-medium.pngbin1213 -> 1195 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/blue-small.pngbin618 -> 597 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/green-large.pngbin1665 -> 1644 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/green-medium.pngbin1057 -> 1036 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/green-small.pngbin549 -> 528 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/orange-large.pngbin2570 -> 2545 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/orange-medium.pngbin1718 -> 1697 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/orange-small.pngbin712 -> 672 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/pink-large.pngbin3639 -> 3617 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/pink-medium.pngbin1574 -> 1553 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/purple-large.pngbin3778 -> 3755 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/purple-medium.pngbin1723 -> 1702 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/purple-small.pngbin707 -> 651 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/red-large.pngbin3618 -> 3595 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/red-medium.pngbin1579 -> 1558 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/red-small.pngbin675 -> 609 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/silver-large.pngbin2141 -> 2120 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/silver-medium.pngbin874 -> 853 bytes
-rw-r--r--plugins/jetpack/_inc/images/rss/silver-small.pngbin355 -> 336 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/beautifulmath.pngbin45978 -> 41588 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/carousel.pngbin361672 -> 345257 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/comments.pngbin36696 -> 31650 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/contactform.pngbin40668 -> 33236 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/custom-css.pngbin43048 -> 25789 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/hovercards.pngbin105102 -> 103110 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/likes.pngbin48953 -> 45802 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/mobile-push-notifications.jpgbin29830 -> 29242 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/notes.pngbin27450 -> 24032 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/post-by-email.pngbin28349 -> 25973 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/publicize.pngbin113219 -> 81768 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/sharing.pngbin36342 -> 35544 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/shortcodes.pngbin46029 -> 35980 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/shortlinks.pngbin54587 -> 52873 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/spelling.pngbin59981 -> 56568 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/stats.pngbin80732 -> 74882 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/subscriptions.pngbin52112 -> 43275 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/tiled-gallery.pngbin192182 -> 186121 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/vaultpress.pngbin45517 -> 39774 bytes
-rw-r--r--plugins/jetpack/_inc/images/screenshots/widgets.pngbin107072 -> 106129 bytes
-rw-r--r--plugins/jetpack/_inc/images/stars-2x.pngbin1388 -> 1022 bytes
-rw-r--r--plugins/jetpack/_inc/images/status-light-2x.pngbin2309 -> 1771 bytes
-rw-r--r--plugins/jetpack/_inc/images/status-light.pngbin1006 -> 703 bytes
-rw-r--r--plugins/jetpack/_inc/images/tb-close-2x.pngbin337 -> 197 bytes
-rw-r--r--plugins/jetpack/_inc/jetpack-retina.css191
-rw-r--r--plugins/jetpack/_inc/jetpack-rtl.css238
-rw-r--r--plugins/jetpack/_inc/jetpack.css1728
-rw-r--r--plugins/jetpack/_inc/jetpack.js1
-rw-r--r--plugins/jetpack/_inc/jquery.inview.js8
-rw-r--r--plugins/jetpack/_inc/jquery.jetpack-resize.js17
-rw-r--r--plugins/jetpack/_inc/jquery.spin.js180
-rw-r--r--plugins/jetpack/_inc/postmessage.js6
-rw-r--r--plugins/jetpack/_inc/spin.js642
-rw-r--r--plugins/jetpack/class.jetpack-ixr-client.php2
-rw-r--r--plugins/jetpack/class.jetpack-post-images.php32
-rw-r--r--plugins/jetpack/class.jetpack-signature.php4
-rw-r--r--plugins/jetpack/class.jetpack-user-agent.php158
-rw-r--r--plugins/jetpack/class.jetpack-xmlrpc-server.php6
-rw-r--r--plugins/jetpack/class.json-api-endpoints.php466
-rw-r--r--plugins/jetpack/class.json-api.php81
-rw-r--r--plugins/jetpack/class.photon.php6
-rw-r--r--plugins/jetpack/functions.gallery.php9
-rw-r--r--plugins/jetpack/functions.opengraph.php24
-rw-r--r--plugins/jetpack/functions.photon.php4
-rw-r--r--plugins/jetpack/jetpack.php4488
-rw-r--r--plugins/jetpack/languages/jetpack-ar.mobin14004 -> 132582 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-az.mobin2886 -> 3077 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-bs_BA.mobin76528 -> 76232 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-ca.mobin76602 -> 79877 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-cs_CZ.mobin8242 -> 8967 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-da_DK.mobin44830 -> 44531 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-de_DE.mobin117625 -> 123046 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-el.mobin8337 -> 12312 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-es_ES.mobin49121 -> 73672 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-fa_IR.mobin47862 -> 58196 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-fi.mobin27526 -> 28822 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-fr_FR.mobin113684 -> 127742 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-gl_ES.mobin33955 -> 34697 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-he_IL.mobin75590 -> 75006 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-hr.mobin35895 -> 36776 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-hu_HU.mobin77710 -> 99073 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-id_ID.mobin52347 -> 51973 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-it_IT.mobin50000 -> 62055 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-ja.mobin116549 -> 131786 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-ko_KR.mobin110462 -> 121971 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-lt_LT.mobin12440 -> 14165 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-mk_MK.mobin23594 -> 24002 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-my_MM.mobin11071 -> 12429 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-nb_NO.mobin88203 -> 96717 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-nl_NL.mobin38043 -> 38431 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-nn_NO.mobin14701 -> 16249 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-pl_PL.mobin11997 -> 19309 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-pt_BR.mobin107473 -> 110039 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-pt_PT.mobin46165 -> 46473 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-ro_RO.mobin10652 -> 11212 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-ru_RU.mobin49300 -> 49671 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-sa_IN.mobin1006 -> 1006 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-sk_SK.mobin10517 -> 11359 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-sq.mobin112583 -> 111067 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-sr_RS.mobin44079 -> 54018 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-sv_SE.mobin24534 -> 33308 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-th.mobin18421 -> 20113 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-tr_TR.mobin35311 -> 36876 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-zh_CN.mobin7637 -> 8477 bytes
-rw-r--r--plugins/jetpack/languages/jetpack-zh_TW.mobin93742 -> 91924 bytes
-rw-r--r--plugins/jetpack/locales.php10
-rw-r--r--plugins/jetpack/modules/after-the-deadline.php35
-rw-r--r--plugins/jetpack/modules/after-the-deadline/atd-autoproofread.js6
-rw-r--r--plugins/jetpack/modules/after-the-deadline/atd-nonvis-editor-plugin.js20
-rw-r--r--plugins/jetpack/modules/after-the-deadline/atd.core.js58
-rw-r--r--plugins/jetpack/modules/after-the-deadline/atd.css32
-rw-r--r--plugins/jetpack/modules/after-the-deadline/config-options.php26
-rw-r--r--plugins/jetpack/modules/after-the-deadline/config-unignore.php10
-rw-r--r--plugins/jetpack/modules/after-the-deadline/install_atd_l10n.js4
-rw-r--r--plugins/jetpack/modules/after-the-deadline/jquery.atd.js44
-rw-r--r--plugins/jetpack/modules/after-the-deadline/proxy.php8
-rw-r--r--plugins/jetpack/modules/after-the-deadline/tinymce/editor_plugin.js126
-rw-r--r--plugins/jetpack/modules/carousel.php1
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel.css34
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel.js209
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel.php69
-rw-r--r--plugins/jetpack/modules/carousel/rtl/jetpack-carousel-rtl.css36
-rw-r--r--plugins/jetpack/modules/comments.php1
-rw-r--r--plugins/jetpack/modules/comments/admin.php2
-rw-r--r--plugins/jetpack/modules/comments/base.php14
-rw-r--r--plugins/jetpack/modules/comments/comments.php19
-rw-r--r--plugins/jetpack/modules/contact-form.php3
-rw-r--r--plugins/jetpack/modules/contact-form/admin.php47
-rw-r--r--plugins/jetpack/modules/contact-form/css/grunion.css4
-rw-r--r--plugins/jetpack/modules/contact-form/grunion-contact-form.php414
-rw-r--r--plugins/jetpack/modules/contact-form/grunion-form-view.php22
-rw-r--r--plugins/jetpack/modules/contact-form/js/grunion.js34
-rw-r--r--plugins/jetpack/modules/custom-css.php1
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php7
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php9
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php4
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php8
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/data.inc.php4
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/lang.inc.php8
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css.php425
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/js/ace/ace.js1
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/js/ace/worker-css.js7887
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/js/safecss-ace.js53
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/preprocessors.php2
-rw-r--r--plugins/jetpack/modules/enhanced-distribution.php1
-rw-r--r--plugins/jetpack/modules/featured-content/featured-content.php6
-rw-r--r--plugins/jetpack/modules/gravatar-hovercards.php11
-rw-r--r--plugins/jetpack/modules/holiday-snow.php1
-rw-r--r--plugins/jetpack/modules/infinite-scroll.php1
-rw-r--r--plugins/jetpack/modules/infinite-scroll/infinity.css5
-rw-r--r--plugins/jetpack/modules/infinite-scroll/infinity.js9
-rw-r--r--plugins/jetpack/modules/infinite-scroll/infinity.php134
-rw-r--r--plugins/jetpack/modules/json-api.php1
-rw-r--r--plugins/jetpack/modules/latex.php1
-rw-r--r--plugins/jetpack/modules/likes.php214
-rw-r--r--plugins/jetpack/modules/likes/style.css19
-rw-r--r--plugins/jetpack/modules/minileven.php1
-rw-r--r--plugins/jetpack/modules/minileven/minileven.php17
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/content-gallery.php4
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/content.php13
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/footer.php2
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php56
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/header.php20
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/image.php2
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/inc/custom-header.php36
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/inc/template-tags.php5
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/inc/tweaks.php22
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/index.php2
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/js/small-menu.js64
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/style.css624
-rw-r--r--plugins/jetpack/modules/mobile-push.php3
-rw-r--r--plugins/jetpack/modules/module-extras.php2
-rw-r--r--plugins/jetpack/modules/module-info.php48
-rw-r--r--plugins/jetpack/modules/notes.php82
-rw-r--r--plugins/jetpack/modules/photon.php1
-rw-r--r--plugins/jetpack/modules/post-by-email.php5
-rw-r--r--plugins/jetpack/modules/post-by-email/post-by-email.js2
-rw-r--r--plugins/jetpack/modules/publicize.php1
-rw-r--r--plugins/jetpack/modules/publicize/assets/publicize.css5
-rw-r--r--plugins/jetpack/modules/publicize/assets/publicize.js2
-rw-r--r--plugins/jetpack/modules/publicize/assets/rtl/publicize-rtl.css7
-rw-r--r--plugins/jetpack/modules/publicize/publicize-jetpack.php93
-rw-r--r--plugins/jetpack/modules/publicize/publicize.php45
-rw-r--r--plugins/jetpack/modules/publicize/ui.php39
-rw-r--r--plugins/jetpack/modules/sharedaddy.php3
-rw-r--r--plugins/jetpack/modules/sharedaddy/admin-sharing.css46
-rw-r--r--plugins/jetpack/modules/sharedaddy/admin-sharing.js108
-rw-r--r--plugins/jetpack/modules/sharedaddy/images/facebook.pngbin838 -> 568 bytes
-rw-r--r--plugins/jetpack/modules/sharedaddy/images/facebook@2x.pngbin1533 -> 1036 bytes
-rw-r--r--plugins/jetpack/modules/sharedaddy/images/googleplus1.pngbin574 -> 722 bytes
-rw-r--r--plugins/jetpack/modules/sharedaddy/images/googleplus1@2x.pngbin1815 -> 1333 bytes
-rw-r--r--plugins/jetpack/modules/sharedaddy/images/icon-facebook-2x.pngbin671 -> 1036 bytes
-rw-r--r--plugins/jetpack/modules/sharedaddy/images/icon-facebook.pngbin887 -> 568 bytes
-rw-r--r--plugins/jetpack/modules/sharedaddy/recaptchalib.php14
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharedaddy.php6
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing-service.php42
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing-sources.php91
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing.css71
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing.js11
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing.php1
-rw-r--r--plugins/jetpack/modules/shortcodes.php35
-rw-r--r--plugins/jetpack/modules/shortcodes/archives.php2
-rw-r--r--plugins/jetpack/modules/shortcodes/audio.php31
-rw-r--r--plugins/jetpack/modules/shortcodes/blip.php6
-rw-r--r--plugins/jetpack/modules/shortcodes/css/rtl/slideshow-shortcode-rtl.css4
-rw-r--r--plugins/jetpack/modules/shortcodes/css/slideshow-shortcode.css2
-rw-r--r--plugins/jetpack/modules/shortcodes/dailymotion.php32
-rw-r--r--plugins/jetpack/modules/shortcodes/diggthis.php14
-rw-r--r--plugins/jetpack/modules/shortcodes/flickr.php10
-rw-r--r--plugins/jetpack/modules/shortcodes/googlemaps.php4
-rw-r--r--plugins/jetpack/modules/shortcodes/googlevideo.php4
-rw-r--r--plugins/jetpack/modules/shortcodes/js/audio-shortcode.js12
-rw-r--r--plugins/jetpack/modules/shortcodes/js/jquery.cycle.js40
-rw-r--r--plugins/jetpack/modules/shortcodes/polldaddy.php168
-rw-r--r--plugins/jetpack/modules/shortcodes/slideshare.php4
-rw-r--r--plugins/jetpack/modules/shortcodes/slideshow.php2
-rw-r--r--plugins/jetpack/modules/shortcodes/ted.php4
-rw-r--r--plugins/jetpack/modules/shortcodes/videopress.php18
-rw-r--r--plugins/jetpack/modules/shortcodes/vimeo.php27
-rw-r--r--plugins/jetpack/modules/shortcodes/youtube.php43
-rw-r--r--plugins/jetpack/modules/shortlinks.php1
-rw-r--r--plugins/jetpack/modules/stats.php73
-rw-r--r--plugins/jetpack/modules/subscriptions.php53
-rw-r--r--plugins/jetpack/modules/tiled-gallery.php1
-rw-r--r--plugins/jetpack/modules/tiled-gallery/math/class-constrained-array-rounding.php6
-rw-r--r--plugins/jetpack/modules/tiled-gallery/tiled-gallery.php34
-rw-r--r--plugins/jetpack/modules/tiled-gallery/tiled-gallery/rtl/tiled-gallery-rtl.css15
-rw-r--r--plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.css12
-rw-r--r--plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js15
-rw-r--r--plugins/jetpack/modules/vaultpress.php5
-rw-r--r--plugins/jetpack/modules/widgets.php11
-rw-r--r--plugins/jetpack/modules/widgets/facebook-likebox.php78
-rw-r--r--plugins/jetpack/modules/widgets/gravatar-profile.css2
-rw-r--r--plugins/jetpack/modules/widgets/readmill.php2
-rw-r--r--plugins/jetpack/modules/widgets/rsslinks-widget.php2
-rw-r--r--plugins/jetpack/modules/widgets/top-posts.php16
-rw-r--r--plugins/jetpack/readme.txt210
283 files changed, 13280 insertions, 7720 deletions
diff --git a/plugins/jetpack/_inc/gallery-settings.js b/plugins/jetpack/_inc/gallery-settings.js
index 0ce38f0b..4b5316b8 100644
--- a/plugins/jetpack/_inc/gallery-settings.js
+++ b/plugins/jetpack/_inc/gallery-settings.js
@@ -7,12 +7,25 @@
// Wrap the render() function to append controls.
media.view.Settings.Gallery = media.view.Settings.Gallery.extend({
render: function() {
+ var $el = this.$el;
+
media.view.Settings.prototype.render.apply( this, arguments );
// Append the type template and update the settings.
- this.$el.append( media.template( 'jetpack-gallery-settings' ) );
+ $el.append( media.template( 'jetpack-gallery-settings' ) );
media.gallery.defaults.type = 'default'; // lil hack that lets media know there's a type attribute.
this.update.apply( this, ['type'] );
+
+ // Hide the Columns setting for all types except Default
+ $el.find( 'select[name=type]' ).on( 'change', function () {
+ var columnSetting = $el.find( 'select[name=columns]' ).closest( 'label.setting' );
+
+ if ( 'default' == $( this ).val() )
+ columnSetting.show();
+ else
+ columnSetting.hide();
+ } ).change();
+
return this;
}
});
diff --git a/plugins/jetpack/_inc/images/a8c.png b/plugins/jetpack/_inc/images/a8c.png
index b6c84df9..d31d6e3b 100644
--- a/plugins/jetpack/_inc/images/a8c.png
+++ b/plugins/jetpack/_inc/images/a8c.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/alertbox-closeicon-2x.png b/plugins/jetpack/_inc/images/alertbox-closeicon-2x.png
index 5c64a0e1..e78f4482 100644
--- a/plugins/jetpack/_inc/images/alertbox-closeicon-2x.png
+++ b/plugins/jetpack/_inc/images/alertbox-closeicon-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/alertbox-closeicon.png b/plugins/jetpack/_inc/images/alertbox-closeicon.png
index c293dafa..ad3a3264 100644
--- a/plugins/jetpack/_inc/images/alertbox-closeicon.png
+++ b/plugins/jetpack/_inc/images/alertbox-closeicon.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/alertbox-clouds-2x.png b/plugins/jetpack/_inc/images/alertbox-clouds-2x.png
index 770390f6..bfa71b2a 100644
--- a/plugins/jetpack/_inc/images/alertbox-clouds-2x.png
+++ b/plugins/jetpack/_inc/images/alertbox-clouds-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/alertbox-clouds.png b/plugins/jetpack/_inc/images/alertbox-clouds.png
index 207dd2a3..4a40a7e1 100644
--- a/plugins/jetpack/_inc/images/alertbox-clouds.png
+++ b/plugins/jetpack/_inc/images/alertbox-clouds.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/arrow-2x.png b/plugins/jetpack/_inc/images/arrow-2x.png
index 668bd220..6b83e7cd 100644
--- a/plugins/jetpack/_inc/images/arrow-2x.png
+++ b/plugins/jetpack/_inc/images/arrow-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/arrow-pointer-blue-2x.png b/plugins/jetpack/_inc/images/arrow-pointer-blue-2x.png
index 5c567fad..29c7dcf8 100644
--- a/plugins/jetpack/_inc/images/arrow-pointer-blue-2x.png
+++ b/plugins/jetpack/_inc/images/arrow-pointer-blue-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/arrow.png b/plugins/jetpack/_inc/images/arrow.png
index 995148cb..25d2f027 100644
--- a/plugins/jetpack/_inc/images/arrow.png
+++ b/plugins/jetpack/_inc/images/arrow.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/arrows-2x.png b/plugins/jetpack/_inc/images/arrows-2x.png
index 752f3e2a..5004253b 100644
--- a/plugins/jetpack/_inc/images/arrows-2x.png
+++ b/plugins/jetpack/_inc/images/arrows-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/arrows-dark-2x.png b/plugins/jetpack/_inc/images/arrows-dark-2x.png
index cc665817..9e1b44f2 100644
--- a/plugins/jetpack/_inc/images/arrows-dark-2x.png
+++ b/plugins/jetpack/_inc/images/arrows-dark-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/arrows-dark-vs-2x.png b/plugins/jetpack/_inc/images/arrows-dark-vs-2x.png
index 908daa6b..4b667c4a 100644
--- a/plugins/jetpack/_inc/images/arrows-dark-vs-2x.png
+++ b/plugins/jetpack/_inc/images/arrows-dark-vs-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/arrows-vs-2x.png b/plugins/jetpack/_inc/images/arrows-vs-2x.png
index 50af7389..1ecd8291 100644
--- a/plugins/jetpack/_inc/images/arrows-vs-2x.png
+++ b/plugins/jetpack/_inc/images/arrows-vs-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/atdbuttontr-2x.png b/plugins/jetpack/_inc/images/atdbuttontr-2x.png
index 8d3617e5..5086e088 100644
--- a/plugins/jetpack/_inc/images/atdbuttontr-2x.png
+++ b/plugins/jetpack/_inc/images/atdbuttontr-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/automattic-2x.png b/plugins/jetpack/_inc/images/automattic-2x.png
index 412bee1a..661556a1 100644
--- a/plugins/jetpack/_inc/images/automattic-2x.png
+++ b/plugins/jetpack/_inc/images/automattic-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/automattic.png b/plugins/jetpack/_inc/images/automattic.png
index dc1c3a7e..9c0c3886 100644
--- a/plugins/jetpack/_inc/images/automattic.png
+++ b/plugins/jetpack/_inc/images/automattic.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/bubble_bg-2x.png b/plugins/jetpack/_inc/images/bubble_bg-2x.png
index f5353136..8757def4 100644
--- a/plugins/jetpack/_inc/images/bubble_bg-2x.png
+++ b/plugins/jetpack/_inc/images/bubble_bg-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/comment-grey-bubble-2x.png b/plugins/jetpack/_inc/images/comment-grey-bubble-2x.png
index 72e02404..57fbeacf 100644
--- a/plugins/jetpack/_inc/images/comment-grey-bubble-2x.png
+++ b/plugins/jetpack/_inc/images/comment-grey-bubble-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/delete-2x.png b/plugins/jetpack/_inc/images/delete-2x.png
index 5c869b17..9436624a 100644
--- a/plugins/jetpack/_inc/images/delete-2x.png
+++ b/plugins/jetpack/_inc/images/delete-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/footer-clouds-2x.png b/plugins/jetpack/_inc/images/footer-clouds-2x.png
index f6b7454e..4616c0af 100644
--- a/plugins/jetpack/_inc/images/footer-clouds-2x.png
+++ b/plugins/jetpack/_inc/images/footer-clouds-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/footer-clouds.png b/plugins/jetpack/_inc/images/footer-clouds.png
index e7c8d057..d8dc03a7 100644
--- a/plugins/jetpack/_inc/images/footer-clouds.png
+++ b/plugins/jetpack/_inc/images/footer-clouds.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/generic-2x.png b/plugins/jetpack/_inc/images/generic-2x.png
index 85c6f85b..0f7b28f6 100644
--- a/plugins/jetpack/_inc/images/generic-2x.png
+++ b/plugins/jetpack/_inc/images/generic-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/header-clouds-2x.png b/plugins/jetpack/_inc/images/header-clouds-2x.png
index 0762edfe..2fdf221f 100644
--- a/plugins/jetpack/_inc/images/header-clouds-2x.png
+++ b/plugins/jetpack/_inc/images/header-clouds-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/header-clouds-small-2x.png b/plugins/jetpack/_inc/images/header-clouds-small-2x.png
index a5ab65c1..04387676 100644
--- a/plugins/jetpack/_inc/images/header-clouds-small-2x.png
+++ b/plugins/jetpack/_inc/images/header-clouds-small-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/header-clouds-small.png b/plugins/jetpack/_inc/images/header-clouds-small.png
index c1a6b273..00bbf16f 100644
--- a/plugins/jetpack/_inc/images/header-clouds-small.png
+++ b/plugins/jetpack/_inc/images/header-clouds-small.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/header-clouds.png b/plugins/jetpack/_inc/images/header-clouds.png
index a766222e..ce8fea9f 100644
--- a/plugins/jetpack/_inc/images/header-clouds.png
+++ b/plugins/jetpack/_inc/images/header-clouds.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/icon-comingsoon-2x.png b/plugins/jetpack/_inc/images/icon-comingsoon-2x.png
index baede10f..ea426d49 100644
--- a/plugins/jetpack/_inc/images/icon-comingsoon-2x.png
+++ b/plugins/jetpack/_inc/images/icon-comingsoon-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/icon-comingsoon.png b/plugins/jetpack/_inc/images/icon-comingsoon.png
index 3814c86e..ecfce9ba 100644
--- a/plugins/jetpack/_inc/images/icon-comingsoon.png
+++ b/plugins/jetpack/_inc/images/icon-comingsoon.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/icon-pointer-flag-2x.png b/plugins/jetpack/_inc/images/icon-pointer-flag-2x.png
index 057545a5..b130901b 100644
--- a/plugins/jetpack/_inc/images/icon-pointer-flag-2x.png
+++ b/plugins/jetpack/_inc/images/icon-pointer-flag-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/image-2x.png b/plugins/jetpack/_inc/images/image-2x.png
index a47dd71c..8a5e57a8 100644
--- a/plugins/jetpack/_inc/images/image-2x.png
+++ b/plugins/jetpack/_inc/images/image-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/imgedit-icons-2x.png b/plugins/jetpack/_inc/images/imgedit-icons-2x.png
index 155f5411..c9a0f02d 100644
--- a/plugins/jetpack/_inc/images/imgedit-icons-2x.png
+++ b/plugins/jetpack/_inc/images/imgedit-icons-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/jetpack-closebox-icon.png b/plugins/jetpack/_inc/images/jetpack-closebox-icon.png
index 1c014d9c..5f48b493 100644
--- a/plugins/jetpack/_inc/images/jetpack-closebox-icon.png
+++ b/plugins/jetpack/_inc/images/jetpack-closebox-icon.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/list-2x.png b/plugins/jetpack/_inc/images/list-2x.png
index 27a67b86..043b8695 100644
--- a/plugins/jetpack/_inc/images/list-2x.png
+++ b/plugins/jetpack/_inc/images/list-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/logo-2x.png b/plugins/jetpack/_inc/images/logo-2x.png
index 9f7f693d..80d789ee 100644
--- a/plugins/jetpack/_inc/images/logo-2x.png
+++ b/plugins/jetpack/_inc/images/logo-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/logo-small-2x.png b/plugins/jetpack/_inc/images/logo-small-2x.png
index c39fbf9a..2126ab77 100644
--- a/plugins/jetpack/_inc/images/logo-small-2x.png
+++ b/plugins/jetpack/_inc/images/logo-small-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/logo-small.png b/plugins/jetpack/_inc/images/logo-small.png
index 997dbb13..634b5a99 100644
--- a/plugins/jetpack/_inc/images/logo-small.png
+++ b/plugins/jetpack/_inc/images/logo-small.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/logo.png b/plugins/jetpack/_inc/images/logo.png
index 2d49b671..9882b7ad 100644
--- a/plugins/jetpack/_inc/images/logo.png
+++ b/plugins/jetpack/_inc/images/logo.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/media-button-2x.png b/plugins/jetpack/_inc/images/media-button-2x.png
index 8ad6eb4e..1c6b785c 100644
--- a/plugins/jetpack/_inc/images/media-button-2x.png
+++ b/plugins/jetpack/_inc/images/media-button-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/menuicon-sprite-2x.png b/plugins/jetpack/_inc/images/menuicon-sprite-2x.png
index aa9a3680..302b3369 100644
--- a/plugins/jetpack/_inc/images/menuicon-sprite-2x.png
+++ b/plugins/jetpack/_inc/images/menuicon-sprite-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/menuicon-sprite.png b/plugins/jetpack/_inc/images/menuicon-sprite.png
index 3bebcf1e..15a3351a 100644
--- a/plugins/jetpack/_inc/images/menuicon-sprite.png
+++ b/plugins/jetpack/_inc/images/menuicon-sprite.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/module-clouds-2x.png b/plugins/jetpack/_inc/images/module-clouds-2x.png
index 1bab9fb1..905a4307 100644
--- a/plugins/jetpack/_inc/images/module-clouds-2x.png
+++ b/plugins/jetpack/_inc/images/module-clouds-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/module-clouds.png b/plugins/jetpack/_inc/images/module-clouds.png
index 2414fef9..1e0f72d4 100644
--- a/plugins/jetpack/_inc/images/module-clouds.png
+++ b/plugins/jetpack/_inc/images/module-clouds.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/module-icons-sprite-2x.png b/plugins/jetpack/_inc/images/module-icons-sprite-2x.png
index 11f42042..f73023fe 100644
--- a/plugins/jetpack/_inc/images/module-icons-sprite-2x.png
+++ b/plugins/jetpack/_inc/images/module-icons-sprite-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/module-icons-sprite.png b/plugins/jetpack/_inc/images/module-icons-sprite.png
index c6979f67..90a42f83 100644
--- a/plugins/jetpack/_inc/images/module-icons-sprite.png
+++ b/plugins/jetpack/_inc/images/module-icons-sprite.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/press-this-2x.png b/plugins/jetpack/_inc/images/press-this-2x.png
index a335aecb..be6ee74e 100644
--- a/plugins/jetpack/_inc/images/press-this-2x.png
+++ b/plugins/jetpack/_inc/images/press-this-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/publicize.png b/plugins/jetpack/_inc/images/publicize.png
index 428b886c..8cf9ede5 100644
--- a/plugins/jetpack/_inc/images/publicize.png
+++ b/plugins/jetpack/_inc/images/publicize.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/blue-large.png b/plugins/jetpack/_inc/images/rss/blue-large.png
index b4a6c52f..fd623278 100644
--- a/plugins/jetpack/_inc/images/rss/blue-large.png
+++ b/plugins/jetpack/_inc/images/rss/blue-large.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/blue-medium.png b/plugins/jetpack/_inc/images/rss/blue-medium.png
index f64e3541..94110185 100644
--- a/plugins/jetpack/_inc/images/rss/blue-medium.png
+++ b/plugins/jetpack/_inc/images/rss/blue-medium.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/blue-small.png b/plugins/jetpack/_inc/images/rss/blue-small.png
index c281155e..8e4b053b 100644
--- a/plugins/jetpack/_inc/images/rss/blue-small.png
+++ b/plugins/jetpack/_inc/images/rss/blue-small.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/green-large.png b/plugins/jetpack/_inc/images/rss/green-large.png
index 4bf86435..a9c2c83c 100644
--- a/plugins/jetpack/_inc/images/rss/green-large.png
+++ b/plugins/jetpack/_inc/images/rss/green-large.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/green-medium.png b/plugins/jetpack/_inc/images/rss/green-medium.png
index 13304ce2..f8e8fbc0 100644
--- a/plugins/jetpack/_inc/images/rss/green-medium.png
+++ b/plugins/jetpack/_inc/images/rss/green-medium.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/green-small.png b/plugins/jetpack/_inc/images/rss/green-small.png
index 8833c9e6..299905b8 100644
--- a/plugins/jetpack/_inc/images/rss/green-small.png
+++ b/plugins/jetpack/_inc/images/rss/green-small.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/orange-large.png b/plugins/jetpack/_inc/images/rss/orange-large.png
index 966b1c1a..12503492 100644
--- a/plugins/jetpack/_inc/images/rss/orange-large.png
+++ b/plugins/jetpack/_inc/images/rss/orange-large.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/orange-medium.png b/plugins/jetpack/_inc/images/rss/orange-medium.png
index 8f5aaa24..7c47f764 100644
--- a/plugins/jetpack/_inc/images/rss/orange-medium.png
+++ b/plugins/jetpack/_inc/images/rss/orange-medium.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/orange-small.png b/plugins/jetpack/_inc/images/rss/orange-small.png
index 9e0bf22e..4f326d56 100644
--- a/plugins/jetpack/_inc/images/rss/orange-small.png
+++ b/plugins/jetpack/_inc/images/rss/orange-small.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/pink-large.png b/plugins/jetpack/_inc/images/rss/pink-large.png
index 49b94c77..1273b773 100644
--- a/plugins/jetpack/_inc/images/rss/pink-large.png
+++ b/plugins/jetpack/_inc/images/rss/pink-large.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/pink-medium.png b/plugins/jetpack/_inc/images/rss/pink-medium.png
index cd8e957b..feb154c7 100644
--- a/plugins/jetpack/_inc/images/rss/pink-medium.png
+++ b/plugins/jetpack/_inc/images/rss/pink-medium.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/purple-large.png b/plugins/jetpack/_inc/images/rss/purple-large.png
index 1ddb70f0..704765ee 100644
--- a/plugins/jetpack/_inc/images/rss/purple-large.png
+++ b/plugins/jetpack/_inc/images/rss/purple-large.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/purple-medium.png b/plugins/jetpack/_inc/images/rss/purple-medium.png
index 8d375a5f..f785cbb2 100644
--- a/plugins/jetpack/_inc/images/rss/purple-medium.png
+++ b/plugins/jetpack/_inc/images/rss/purple-medium.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/purple-small.png b/plugins/jetpack/_inc/images/rss/purple-small.png
index 75f3c607..d21d59be 100644
--- a/plugins/jetpack/_inc/images/rss/purple-small.png
+++ b/plugins/jetpack/_inc/images/rss/purple-small.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/red-large.png b/plugins/jetpack/_inc/images/rss/red-large.png
index 88d9bf8d..5e03f141 100644
--- a/plugins/jetpack/_inc/images/rss/red-large.png
+++ b/plugins/jetpack/_inc/images/rss/red-large.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/red-medium.png b/plugins/jetpack/_inc/images/rss/red-medium.png
index 838db55b..d01e0d8d 100644
--- a/plugins/jetpack/_inc/images/rss/red-medium.png
+++ b/plugins/jetpack/_inc/images/rss/red-medium.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/red-small.png b/plugins/jetpack/_inc/images/rss/red-small.png
index 85fd61c6..d42b135d 100644
--- a/plugins/jetpack/_inc/images/rss/red-small.png
+++ b/plugins/jetpack/_inc/images/rss/red-small.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/silver-large.png b/plugins/jetpack/_inc/images/rss/silver-large.png
index af67da9d..d10b8849 100644
--- a/plugins/jetpack/_inc/images/rss/silver-large.png
+++ b/plugins/jetpack/_inc/images/rss/silver-large.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/silver-medium.png b/plugins/jetpack/_inc/images/rss/silver-medium.png
index 5559c8c2..34552319 100644
--- a/plugins/jetpack/_inc/images/rss/silver-medium.png
+++ b/plugins/jetpack/_inc/images/rss/silver-medium.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/rss/silver-small.png b/plugins/jetpack/_inc/images/rss/silver-small.png
index 4a41080d..ef8be0eb 100644
--- a/plugins/jetpack/_inc/images/rss/silver-small.png
+++ b/plugins/jetpack/_inc/images/rss/silver-small.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/beautifulmath.png b/plugins/jetpack/_inc/images/screenshots/beautifulmath.png
index eaf8d1d4..3599a425 100644
--- a/plugins/jetpack/_inc/images/screenshots/beautifulmath.png
+++ b/plugins/jetpack/_inc/images/screenshots/beautifulmath.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/carousel.png b/plugins/jetpack/_inc/images/screenshots/carousel.png
index 5bcc94cd..bc56e4da 100644
--- a/plugins/jetpack/_inc/images/screenshots/carousel.png
+++ b/plugins/jetpack/_inc/images/screenshots/carousel.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/comments.png b/plugins/jetpack/_inc/images/screenshots/comments.png
index 86f6530c..04f37ba9 100644
--- a/plugins/jetpack/_inc/images/screenshots/comments.png
+++ b/plugins/jetpack/_inc/images/screenshots/comments.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/contactform.png b/plugins/jetpack/_inc/images/screenshots/contactform.png
index b41760b4..02934a50 100644
--- a/plugins/jetpack/_inc/images/screenshots/contactform.png
+++ b/plugins/jetpack/_inc/images/screenshots/contactform.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/custom-css.png b/plugins/jetpack/_inc/images/screenshots/custom-css.png
index 4be5cb22..1e35ad48 100644
--- a/plugins/jetpack/_inc/images/screenshots/custom-css.png
+++ b/plugins/jetpack/_inc/images/screenshots/custom-css.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/hovercards.png b/plugins/jetpack/_inc/images/screenshots/hovercards.png
index 63977a5b..12205492 100644
--- a/plugins/jetpack/_inc/images/screenshots/hovercards.png
+++ b/plugins/jetpack/_inc/images/screenshots/hovercards.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/likes.png b/plugins/jetpack/_inc/images/screenshots/likes.png
index 1c7670a3..9f5404ac 100644
--- a/plugins/jetpack/_inc/images/screenshots/likes.png
+++ b/plugins/jetpack/_inc/images/screenshots/likes.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/mobile-push-notifications.jpg b/plugins/jetpack/_inc/images/screenshots/mobile-push-notifications.jpg
index 94ca6dd6..d09d3915 100644
--- a/plugins/jetpack/_inc/images/screenshots/mobile-push-notifications.jpg
+++ b/plugins/jetpack/_inc/images/screenshots/mobile-push-notifications.jpg
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/notes.png b/plugins/jetpack/_inc/images/screenshots/notes.png
index 4506db17..bf3a6b99 100644
--- a/plugins/jetpack/_inc/images/screenshots/notes.png
+++ b/plugins/jetpack/_inc/images/screenshots/notes.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/post-by-email.png b/plugins/jetpack/_inc/images/screenshots/post-by-email.png
index b114088c..e63e9a7b 100644
--- a/plugins/jetpack/_inc/images/screenshots/post-by-email.png
+++ b/plugins/jetpack/_inc/images/screenshots/post-by-email.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/publicize.png b/plugins/jetpack/_inc/images/screenshots/publicize.png
index 428b886c..8cf9ede5 100644
--- a/plugins/jetpack/_inc/images/screenshots/publicize.png
+++ b/plugins/jetpack/_inc/images/screenshots/publicize.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/sharing.png b/plugins/jetpack/_inc/images/screenshots/sharing.png
index 9c36d17b..0949b5e4 100644
--- a/plugins/jetpack/_inc/images/screenshots/sharing.png
+++ b/plugins/jetpack/_inc/images/screenshots/sharing.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/shortcodes.png b/plugins/jetpack/_inc/images/screenshots/shortcodes.png
index 8bff1d6d..5434e120 100644
--- a/plugins/jetpack/_inc/images/screenshots/shortcodes.png
+++ b/plugins/jetpack/_inc/images/screenshots/shortcodes.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/shortlinks.png b/plugins/jetpack/_inc/images/screenshots/shortlinks.png
index 2de84771..bfc99cfa 100644
--- a/plugins/jetpack/_inc/images/screenshots/shortlinks.png
+++ b/plugins/jetpack/_inc/images/screenshots/shortlinks.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/spelling.png b/plugins/jetpack/_inc/images/screenshots/spelling.png
index a6986d4f..b28142e5 100644
--- a/plugins/jetpack/_inc/images/screenshots/spelling.png
+++ b/plugins/jetpack/_inc/images/screenshots/spelling.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/stats.png b/plugins/jetpack/_inc/images/screenshots/stats.png
index 836c1392..ceb3fbed 100644
--- a/plugins/jetpack/_inc/images/screenshots/stats.png
+++ b/plugins/jetpack/_inc/images/screenshots/stats.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/subscriptions.png b/plugins/jetpack/_inc/images/screenshots/subscriptions.png
index a1c55630..113800b2 100644
--- a/plugins/jetpack/_inc/images/screenshots/subscriptions.png
+++ b/plugins/jetpack/_inc/images/screenshots/subscriptions.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/tiled-gallery.png b/plugins/jetpack/_inc/images/screenshots/tiled-gallery.png
index 8168590d..0da99eee 100644
--- a/plugins/jetpack/_inc/images/screenshots/tiled-gallery.png
+++ b/plugins/jetpack/_inc/images/screenshots/tiled-gallery.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/vaultpress.png b/plugins/jetpack/_inc/images/screenshots/vaultpress.png
index f1f80c70..64645bc8 100644
--- a/plugins/jetpack/_inc/images/screenshots/vaultpress.png
+++ b/plugins/jetpack/_inc/images/screenshots/vaultpress.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/screenshots/widgets.png b/plugins/jetpack/_inc/images/screenshots/widgets.png
index e0749c62..ad609ae9 100644
--- a/plugins/jetpack/_inc/images/screenshots/widgets.png
+++ b/plugins/jetpack/_inc/images/screenshots/widgets.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/stars-2x.png b/plugins/jetpack/_inc/images/stars-2x.png
index a370aaf6..503c83a0 100644
--- a/plugins/jetpack/_inc/images/stars-2x.png
+++ b/plugins/jetpack/_inc/images/stars-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/status-light-2x.png b/plugins/jetpack/_inc/images/status-light-2x.png
index adff4979..461d9874 100644
--- a/plugins/jetpack/_inc/images/status-light-2x.png
+++ b/plugins/jetpack/_inc/images/status-light-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/status-light.png b/plugins/jetpack/_inc/images/status-light.png
index 9a6665c5..c9ffb7bb 100644
--- a/plugins/jetpack/_inc/images/status-light.png
+++ b/plugins/jetpack/_inc/images/status-light.png
Binary files differ
diff --git a/plugins/jetpack/_inc/images/tb-close-2x.png b/plugins/jetpack/_inc/images/tb-close-2x.png
index 9f5f6b63..9530278d 100644
--- a/plugins/jetpack/_inc/images/tb-close-2x.png
+++ b/plugins/jetpack/_inc/images/tb-close-2x.png
Binary files differ
diff --git a/plugins/jetpack/_inc/jetpack-retina.css b/plugins/jetpack/_inc/jetpack-retina.css
index c5c69ff8..295f6caa 100644
--- a/plugins/jetpack/_inc/jetpack-retina.css
+++ b/plugins/jetpack/_inc/jetpack-retina.css
@@ -1,5 +1,9 @@
/* Retina core icons */
-@media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
+@media only screen and (-moz-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
+
/* TinyMCE buttons */
.wp_themeSkin .mceToolbar span.mce_undo,
.wp_themeSkin .mceToolbar span.mce_redo,
@@ -36,7 +40,7 @@
.wp_themeSkin .mceToolbar .mceSplitButton .mce_forecolor span.mce_forecolor,
.wp_themeSkin .mceToolbar .mceSplitButton span.mce_numlist,
.wp_themeSkin .mceToolbar .mceSplitButton span.mce_bullist {
- background-image: url('images/wpicons-2x.png');
+ background-image: url(images/wpicons-2x.png);
background-size: 560px 40px;
}
@@ -44,7 +48,7 @@
.view-switch .current #view-switch-list,
.view-switch #view-switch-excerpt,
.view-switch .current #view-switch-excerpt {
- background-image: url('images/list-2x.png');
+ background-image: url(images/list-2x.png);
background-size: 80px 20px;
}
@@ -55,74 +59,76 @@
.imgedit-fliph,
.imgedit-undo,
.imgedit-redo {
- background-image: url('images/imgedit-icons-2x.png');
+ background-image: url(images/imgedit-icons-2x.png);
background-size: 260px 64px;
}
/* Welcome screen close button */
.welcome-panel .welcome-panel-close:before {
- background-image: url('images/xit-2x.gif');
+ background-image: url(images/xit-2x.gif);
background-size: 20px 10px;
}
/* Dismiss tag buttons */
- .tagchecklist span a, #bulk-titles div a {
- background-image: url('images/xit-2x.gif') !important;
+ .tagchecklist span a,
+ #bulk-titles div a {
+ background-image: url(images/xit-2x.gif) !important;
background-size: 20px 10px !important;
}
- .tagchecklist span a:hover, #bulk-titles div a:hover {
- background-image: url('images/xit-2x.gif') !important;
+ .tagchecklist span a:hover,
+ #bulk-titles div a:hover {
+ background-image: url(images/xit-2x.gif) !important;
background-size: 20px 10px !important;
}
/* Pointer dismiss button */
.wp-pointer-buttons a.close::before {
- background-image: url('images/xit-2x.gif');
- background-size: 20px 10px;
+ background-image: url(images/xit-2x.gif);
+ background-size: 20px 10px;
}
/* Pointer icon */
.wp-pointer-content h3::before {
- background-image: url('images/icon-pointer-flag-2x.png');
+ background-image: url(images/icon-pointer-flag-2x.png);
background-size: 36px 37px;
}
/* Pointer arrow */
.wp-pointer-arrow {
- background-image: url('images/arrow-pointer-blue-2x.png') !important;
+ background-image: url(images/arrow-pointer-blue-2x.png) !important;
background-size: 30px 60px !important;
}
/* Screen options links */
#screen-meta-links a.show-settings {
- background-image: url('images/arrows-2x.png') !important;
+ background-image: url(images/arrows-2x.png) !important;
background-size: 15px 123px !important;
}
body.admin-color-classic #screen-meta-links a.show-settings {
- background-image: url('images/arrows-vs-2x.png') !important;
+ background-image: url(images/arrows-vs-2x.png) !important;
}
-
+
/* Collapse button divs */
#collapse-button div {
- background-image: url('images/arrows-2x.png') !important;
+ background-image: url(images/arrows-2x.png) !important;
background-size: 15px 123px !important;
}
body.admin-color-classic #collapse-button div {
- background-image: url('images/arrows-vs-2x.png') !important;
+ background-image: url(images/arrows-vs-2x.png) !important;
}
/* Metabox handle arrows */
.meta-box-sortables .postbox:hover .handlediv {
- background-image: url('images/arrows-2x.png') !important;
+ background-image: url(images/arrows-2x.png) !important;
background-size: 15px 123px !important;
}
body.admin-color-classic .meta-box-sortables .postbox:hover .handlediv {
- background-image: url('images/arrows-vs-2x.png') !important;
+ background-image: url(images/arrows-vs-2x.png) !important;
}
/* Date button */
.curtime #timestamp {
- background-image: url('images/date-button-2x.gif') !important;
+ background-image: url(images/date-button-2x.gif) !important;
background-size: 16px 16px;
display: inline-block;
height: 16px;
@@ -133,77 +139,88 @@
padding-top: 12px;
height: 0;
width: 12px;
- background: transparent url('images/comment-grey-bubble-2x.png') no-repeat center center;
+ background: transparent url(images/comment-grey-bubble-2x.png) no-repeat center center;
background-size: 12px 12px;
}
.post-com-count {
- background-image: url('images/bubble_bg-2x.png') !important;
+ background-image: url(images/bubble_bg-2x.png) !important;
background-size: 18px 100px;
}
/* Post sorting indicator */
.sorting-indicator {
- background-image: url('images/sort-2x.gif');
+ background-image: url(images/sort-2x.gif);
background-size: 14px 4px;
}
/* Widget arrows */
.sidebar-name-arrow {
- background-image: url('images/arrows-2x.png') !important;
+ background-image: url(images/arrows-2x.png) !important;
background-size: 15px 123px !important;
}
+
body.admin-color-classic .sidebar-name-arrow {
- background-image: url('images/arrows-vs-2x.png') !important;
+ background-image: url(images/arrows-vs-2x.png) !important;
}
+
.sidebar-name:hover .sidebar-name-arrow {
- background-image: url('images/arrows-dark-2x.png') !important;
+ background-image: url(images/arrows-dark-2x.png) !important;
}
+
body.admin-color-classic .sidebar-name:hover .sidebar-name-arrow {
- background-image: url('images/arrows-dark-vs-2x.png') !important;
+ background-image: url(images/arrows-dark-vs-2x.png) !important;
}
+
.widget-top a.widget-action {
- background-image: url('images/arrows-2x.png') !important;
+ background-image: url(images/arrows-2x.png) !important;
background-size: 15px 123px !important;
}
+
body.admin-color-classic .widget-top a.widget-action {
- background-image: url('images/arrows-vs-2x.png') !important;
+ background-image: url(images/arrows-vs-2x.png) !important;
}
+
.widget-top a.widget-action:hover {
- background-image: url('images/arrows-dark-2x.png') !important;
+ background-image: url(images/arrows-dark-2x.png) !important;
}
+
body.admin-color-classic .widget-top a.widget-action:hover {
- background-image: url('images/arrows-dark-vs-2x.png') !important;
+ background-image: url(images/arrows-dark-vs-2x.png) !important;
}
/* Menu editor item arrows */
.item-edit {
- background-image: url('images/arrows-2x.png') !important;
+ background-image: url(images/arrows-2x.png) !important;
background-size: 15px 123px !important;
}
+
body.admin-color-classic .item-edit {
- background-image: url('images/arrows-vs-2x.png') !important;
+ background-image: url(images/arrows-vs-2x.png) !important;
}
+
.item-edit:hover {
- background-image: url('images/arrows-dark-2x.png') !important;
+ background-image: url(images/arrows-dark-2x.png) !important;
background-size: 15px 123px !important;
}
+
body.admin-color-classic .item-edit:hover {
- background-image: url('images/arrows-dark-vs-2x.png') !important;
+ background-image: url(images/arrows-dark-vs-2x.png) !important;
}
/* Plugin install star ratings */
div.star-holder {
- background-image: url('images/stars-2x.png');
+ background-image: url(images/stars-2x.png);
background-size: 21px 37px;
}
+
div.star-holder .star-rating {
- background-image: url('images/stars-2x.png');
+ background-image: url(images/stars-2x.png);
background-size: 21px 37px;
}
/* Press This bookmarklet icon */
.pressthis a span {
- background-image: url('images/press-this-2x.png');
+ background-image: url(images/press-this-2x.png);
background-size: 24px 20px;
}
@@ -212,7 +229,7 @@
padding-top: 15px;
width: 15px;
height: 0;
- background: url('images/media-button-2x.png') no-repeat center center;
+ background: url(images/media-button-2x.png) no-repeat center center;
background-size: 15px 15px;
}
@@ -221,28 +238,28 @@
padding-top: 20px;
width: 20px;
height: 0;
- background: url('images/atdbuttontr-2x.png') no-repeat center center;
+ background: url(images/atdbuttontr-2x.png) no-repeat center center;
background-size: 20px 20px;
}
/* Resize editor */
#post-body .wp_themeSkin .mceStatusbar a.mceResize {
- background-image: url('images/resize-2x.gif') !important;
+ background-image: url(images/resize-2x.gif) !important;
background-size: 11px 11px !important;
}
/* MCE dropdowns */
.wp_themeSkin .mceListBox .mceOpen span, .wp_themeSkin .mceSplitButton a.mceOpen {
- background-image: url("images/down_arrow-2x.gif") !important;
+ background-image: url(images/down_arrow-2x.gif) !important;
background-size: 10px 20px;
}
-
+
/* Img overlay buttons */
#wp_editimgbtn, #wp_delimgbtn, #wp_editgallery, #wp_delgallery {
padding-top: 24px !important;
height: 0;
width: 24px;
- background: url("images/delete-2x.png") no-repeat center center !important;
+ background: url(images/delete-2x.png) no-repeat center center !important;
background-size: 24px 24px;
}
@@ -254,40 +271,40 @@
}
#wp_editimgbtn, #wp_editgallery {
- background: #eee url("images/image-2x.png") no-repeat center center !important;
+ background: #eee url(images/image-2x.png) no-repeat center center !important;
}
#wp_delimgbtn, #wp_delgallery {
- background: #eee url("images/delete-2x.png") no-repeat center center !important;
+ background: #eee url(images/delete-2x.png) no-repeat center center !important;
}
-
+
/* AJAX loading spinners */
img.ajax-loading, img.ajax-feedback {
width: 16px;
height: 0;
padding-top: 19px !important;
- background: url("images/wpspin_light-2x.gif") no-repeat center center !important;
+ background: url(images/wpspin_light-2x.gif) no-repeat center center !important;
background-size: 16px 16px;
}
/* Align buttons (in image properties in the media library) */
.image-align-none-label {
- background: url('images/align-none-2x.png') no-repeat center left;
+ background: url(images/align-none-2x.png) no-repeat center left;
background-size: 21px 15px;
}
.image-align-left-label {
- background: url('images/align-left-2x.png') no-repeat center left;
+ background: url(images/align-left-2x.png) no-repeat center left;
background-size: 22px 15px;
}
.image-align-center-label {
- background: url('images/align-center-2x.png') no-repeat center left;
+ background: url(images/align-center-2x.png) no-repeat center left;
background-size: 21px 15px;
}
.image-align-right-label {
- background: url('images/align-right-2x.png') no-repeat center left;
+ background: url(images/align-right-2x.png) no-repeat center left;
background-size: 22px 15px;
}
@@ -345,88 +362,88 @@
/* Uploader close button */
#TB_closeWindowButton img {
- background: url('images/tb-close-2x.png') no-repeat center center;
+ background: url(images/tb-close-2x.png) no-repeat center center;
padding-top: 15px;
width: 15px;
height: 0;
background-size: 15px 15px;
}
- td.media-icon img[src$='wp-includes/images/crystal/archive.png'],
- td.A1B1 img[src$='wp-includes/images/crystal/archive.png'] {
- background: url('images/archive-2x.png') no-repeat center center;
+ td.media-icon img[src$="wp-includes/images/crystal/archive.png"],
+ td.A1B1 img[src$="wp-includes/images/crystal/archive.png"] {
+ background: url(images/archive-2x.png) no-repeat center center;
padding-top: 60px;
width: 46px;
height: 0;
background-size: 46px 60px;
}
- td.media-icon img[src$='wp-includes/images/crystal/audio.png'],
- td.A1B1 img[src$='wp-includes/images/crystal/audio.png'] {
- background: url('images/audio-2x.png') no-repeat center center;
+ td.media-icon img[src$="wp-includes/images/crystal/audio.png"],
+ td.A1B1 img[src$="wp-includes/images/crystal/audio.png"] {
+ background: url(images/audio-2x.png) no-repeat center center;
padding-top: 60px;
width: 46px;
height: 0;
background-size: 46px 60px;
}
- td.media-icon img[src$='wp-includes/images/crystal/code.png'],
- td.A1B1 img[src$='wp-includes/images/crystal/code.png'] {
- background: url('images/code-2x.png') no-repeat center center;
+ td.media-icon img[src$="wp-includes/images/crystal/code.png"],
+ td.A1B1 img[src$="wp-includes/images/crystal/code.png"] {
+ background: url(images/code-2x.png) no-repeat center center;
padding-top: 60px;
width: 46px;
height: 0;
background-size: 46px 60px;
}
- td.media-icon img[src$='wp-includes/images/crystal/default.png'],
- td.A1B1 img[src$='wp-includes/images/crystal/default.png'] {
- background: url('images/default-2x.png') no-repeat center center;
+ td.media-icon img[src$="wp-includes/images/crystal/default.png"],
+ td.A1B1 img[src$="wp-includes/images/crystal/default.png"] {
+ background: url(images/default-2x.png) no-repeat center center;
padding-top: 60px;
width: 46px;
height: 0;
background-size: 46px 60px;
}
- td.media-icon img[src$='wp-includes/images/crystal/document.png'],
- td.A1B1 img[src$='wp-includes/images/crystal/document.png'] {
- background: url('images/document-2x.png') no-repeat center center;
+ td.media-icon img[src$="wp-includes/images/crystal/document.png"],
+ td.A1B1 img[src$="wp-includes/images/crystal/document.png"] {
+ background: url(images/document-2x.png) no-repeat center center;
padding-top: 60px;
width: 46px;
height: 0;
background-size: 46px 60px;
}
- td.media-icon img[src$='wp-includes/images/crystal/interactive.png'],
- td.A1B1 img[src$='wp-includes/images/crystal/interactive.png'] {
- background: url('images/interactive-2x.png') no-repeat center center;
+ td.media-icon img[src$="wp-includes/images/crystal/interactive.png"],
+ td.A1B1 img[src$="wp-includes/images/crystal/interactive.png"] {
+ background: url(images/interactive-2x.png) no-repeat center center;
padding-top: 60px;
width: 46px;
height: 0;
background-size: 46px 60px;
}
- td.media-icon img[src$='wp-includes/images/crystal/spreadsheet.png'],
- td.A1B1 img[src$='wp-includes/images/crystal/spreadsheet.png'] {
- background: url('images/spreadsheet-2x.png') no-repeat center center;
+ td.media-icon img[src$="wp-includes/images/crystal/spreadsheet.png"],
+ td.A1B1 img[src$="wp-includes/images/crystal/spreadsheet.png"] {
+ background: url(images/spreadsheet-2x.png) no-repeat center center;
padding-top: 60px;
width: 46px;
height: 0;
background-size: 46px 60px;
}
- td.media-icon img[src$='wp-includes/images/crystal/text.png'],
- td.A1B1 img[src$='wp-includes/images/crystal/text.png'] {
- background: url('images/text-2x.png') no-repeat center center;
+ td.media-icon img[src$="wp-includes/images/crystal/text.png"],
+ td.A1B1 img[src$="wp-includes/images/crystal/text.png"] {
+ background: url(images/text-2x.png) no-repeat center center;
padding-top: 60px;
width: 46px;
height: 0;
background-size: 46px 60px;
}
- td.media-icon img[src$='wp-includes/images/crystal/video.png'],
- td.A1B1 img[src$='wp-includes/images/crystal/video.png'] {
- background: url('images/video-2x.png') no-repeat center center;
+ td.media-icon img[src$="wp-includes/images/crystal/video.png"],
+ td.A1B1 img[src$="wp-includes/images/crystal/video.png"] {
+ background: url(images/video-2x.png) no-repeat center center;
padding-top: 60px;
width: 46px;
height: 0;
@@ -434,23 +451,23 @@
}
.farbtastic .marker {
- background-image: url('images/marker-2x.png');
+ background-image: url(images/marker-2x.png);
background-size: 17px 17px;
}
.farbtastic .wheel {
- background-image: url('images/wheel-2x.png');
+ background-image: url(images/wheel-2x.png);
background-size: 195px 195px;
}
.farbtastic .overlay {
- background-image: url('images/mask-2x.png');
+ background-image: url(images/mask-2x.png);
background-size: 101px 101px;
}
/* Generic admin menu icon */
- #adminmenu img[src$='wp-admin/images/generic.png'] {
- background: url('images/generic-2x.png') no-repeat center center;
+ #adminmenu img[src$="wp-admin/images/generic.png"] {
+ background: url(images/generic-2x.png) no-repeat center center;
padding-top: 25px;
width: 16px;
height: 0;
@@ -463,7 +480,7 @@
.clearlooks2 .mceMed,
.clearlooks2 .mceMax,
.wp-dialog .ui-dialog-titlebar-close {
- background-image: url('images/buttons-2x.gif') !important;
+ background-image: url(images/buttons-2x.gif) !important;
background-size: 116px 48px !important;
}
}
diff --git a/plugins/jetpack/_inc/jetpack-rtl.css b/plugins/jetpack/_inc/jetpack-rtl.css
index 45c676b4..f1fad500 100644
--- a/plugins/jetpack/_inc/jetpack-rtl.css
+++ b/plugins/jetpack/_inc/jetpack-rtl.css
@@ -1,128 +1,120 @@
- #jp-header #jp-clouds {
- background-position: -632px 100%;
- }
- #jp-header.small #jp-clouds {
- background-position: -425px 100%;
- }
-
- #jp-header #jp-clouds #jp-disconnect {
- float: left;
- margin: -35px 0 0 25px;
- text-align: left;
- }
-
- #jp-header #jp-clouds #jp-disconnect a {
- background-position: 100% 90%;
- padding: 4px 30px 3px 10px;
- }
- #jp-header #jp-clouds #jp-disconnect a:hover {
- background-position: 100% 3%;
- }
-
- #jp-header h3 {
- background-position: top right;
- right: 25px;
- left: auto;
- }
-
- #jp-header p {
- right: 390px;
- left: auto;
- text-align: right;
- }
-
- #jp-info {
- margin: 0 28px 0 12px;
- }
-
- #jp-info p {
- float:right;
- }
-
- #jp-info a.jp-button {
- float: left;
- margin: 8px 20px 0 0;
- }
-
- .jp-connect { padding: 10px 0 5px !important; }
-
- #jetpack-settings > .jetpack-message { margin: 10px 15px 10px 13px }
-
- .jetpack-message .squeezer {
- text-align: right;
- }
- .jetpack-message h4 {
- margin: 0 0 10px 10px;
- }
-
- .more-info {
- margin: 0 15px 5px 12px;
- background: transparent url( images/header-clouds-sm.png ) bottom right repeat-x;
- }
- .more-info .jp-close {
- left: 0;
- right: auto;
- padding: 0 6px 0 4px;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
- -moz-border-radius-topright: 0;
- -moz-border-radius-bottomright: 0;
- -webkit-border-top-left-radius: 0;
- -webkit-border-bottom-left-radius: 0;
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
- }
-
- .more-info div.jp-info-img {
- float: left;
- margin: 0 20px 0 30px;
- }
-
+#jp-header #jp-clouds {
+ background-position: -632px 100%;
+}
+
+#jp-header.small #jp-clouds {
+ background-position: -425px 100%;
+}
+
+#jp-header #jp-clouds #jp-disconnect {
+ float: left;
+ margin: -35px 0 0 25px;
+ text-align: left;
+}
+
+#jp-header #jp-clouds #jp-disconnect a {
+ background-position: 100% 90%;
+ padding: 4px 30px 3px 10px;
+}
+
+#jp-header #jp-clouds #jp-disconnect a:hover {
+ background-position: 100% 3%;
+}
+
+#jp-header h3 {
+ background-position: top right;
+ right: 25px;
+ left: auto;
+}
+
+#jp-header p {
+ right: 390px;
+ left: auto;
+ text-align: right;
+}
+
+#jp-info {
+ margin: 0 28px 0 12px;
+}
+
+#jp-info p {
+ float:right;
+}
+
+#jp-info a.jp-button {
+ float: left;
+ margin: 8px 20px 0 0;
+}
+
+.jp-connect {
+ padding: 10px 0 5px !important;
+}
+
+#jetpack-settings > .jetpack-message {
+ margin: 10px 15px 10px 13px;
+}
+
+.jetpack-message .squeezer {
+ text-align: right;
+}
+
+.jetpack-message h4 {
+ margin: 0 0 10px 10px;
+}
+
+.more-info {
+ margin: 0 15px 5px 12px;
+ background: transparent url(images/header-clouds-sm.png) bottom right repeat-x;
+}
+
+.more-info .jp-close {
+ left: 0;
+ right: auto;
+ padding: 0 6px 0 4px;
+ border-radius: 3px;
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+}
+
+.more-info div.jp-info-img {
+ float: left;
+ margin: 0 20px 0 30px;
+}
+
.jetpack-module {
float: right;
margin: 0 15px 15px 0;
padding: 15px 15px 35px 0;
}
- .jetpack-module div.module-image {
- float: left;
- margin: 0 10px 5px 0;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
- -webkit-border-top-right-radius: 5px;
- -moz-border-radius-topleft: 5px;
- border-top-right-radius: 5px;
- -webkit-border-bottom-right-radius: 5px;
- -moz-border-radius-bottomleft: 5px;
- border-bottom-right-radius: 5px;
- }
-
- .jetpack-module div.module-image p {
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
- -webkit-border-bottom-right-radius: 5px;
- -moz-border-radius-bottomleft: 5px;
- border-bottom-right-radius: 5px;
- }
-
-
- .jetpack-module .jetpack-module-actions {
- right: 15px;
- left: auto;
- }
-
- .placeholder h3 {
- margin-left: 15px;
- margin-right: auto;
- }
-
- #jp-footer .automattic {
- padding-right: 3px;
- padding-left: 0;
- }
-
- #jp-footer .automattic span {
- margin: 0 1px 0 5px;
- }
+
+.jetpack-module div.module-image {
+ float: left;
+ margin: 0 10px 5px 0;
+ border-radius: 0;
+ border-top-right-radius: 5px;
+ border-bottom-right-radius: 5px;
+}
+
+.jetpack-module div.module-image p {
+ border-radius: 0;
+ border-bottom-right-radius: 5px;
+}
+
+.jetpack-module .jetpack-module-actions {
+ right: 15px;
+ left: auto;
+}
+
+.placeholder h3 {
+ margin-left: 15px;
+ margin-right: auto;
+}
+
+#jp-footer .automattic {
+ padding-right: 3px;
+ padding-left: 0;
+}
+
+#jp-footer .automattic span {
+ margin: 0 1px 0 5px;
+}
diff --git a/plugins/jetpack/_inc/jetpack.css b/plugins/jetpack/_inc/jetpack.css
index b684f7c7..9c2c977d 100644
--- a/plugins/jetpack/_inc/jetpack.css
+++ b/plugins/jetpack/_inc/jetpack.css
@@ -1,439 +1,566 @@
+/*
+ * Consolidate the font-family declarations:
+ */
+
+#jp-header p,
+#jp-info a.jp-button,
+.jetpack-message h4,
+.jetpack-message h5,
+.jetpack-message p a.button-primary,
+.jetpack-activated h3,
+.jetpack-activated p,
+.jetpack-module div.module-image p,
+.jetpack-module h3,
+.jetpack-module .jetpack-module-actions a,
+#jp-settings-screen h3,
+.jp-survey h4,
+.jetpack-install-container p a.button-connector {
+ font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", Verdana, "Bitstream Vera Sans", sans-serif;
+}
+
+#jp-info p,
+.more-info p,
+.more-info ul,
+.jetpack-module-description p {
+ font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+}
+
+/*
+ * Jetpack:
+ */
+
+/* Force the menu not to be sticky, so we can color the arrow. */
+.toplevel_page_jetpack.admin-color-mp6.sticky-menu #adminmenuwrap,
+body[class*=" jetpack_page_jetpack_"].admin-color-mp6.sticky-menu #adminmenuwrap {
+ position: relative;
+ z-index: auto;
+ top: 0;
+}
+
+.toplevel_page_jetpack.admin-color-mp6 ul#adminmenu a.wp-has-current-submenu:after,
+.toplevel_page_jetpack.admin-color-mp6 ul#adminmenu > li.current > a.current:after,
+body[class*=" jetpack_page_jetpack_"].admin-color-mp6 ul#adminmenu a.wp-has-current-submenu:after,
+body[class*=" jetpack_page_jetpack_"].admin-color-mp6 ul#adminmenu > li.current > a.current:after {
+ border-right-color:#8fad4b;
+}
+
+.toplevel_page_jetpack.jetpack-disconnected #wpwrap,
+body[class*=" jetpack_page_jetpack_"].jetpack-disconnected #wpwrap {
+ background: url(images/header-clouds.png) -150px -60px repeat-x;
+}
+
+.toplevel_page_jetpack.jetpack-disconnected.admin-color-mp6 #wpwrap,
+body[class*=" jetpack_page_jetpack_"].jetpack-disconnected.admin-color-mp6 #wpwrap {
+ background-position: -143px -60px;
+}
+
+.toplevel_page_jetpack.jetpack-disconnected.folded #wpwrap,
+body[class*=" jetpack_page_jetpack_"].jetpack-disconnected.folded #wpwrap {
+ background-position: -263px -60px;
+}
+
+.toplevel_page_jetpack.jetpack-disconnected.admin-color-mp6.folded #wpwrap,
+body[class*=" jetpack_page_jetpack_"].jetpack-disconnected.admin-color-mp6.folded #wpwrap {
+ background-position: -257px -60px;
+}
+
+.toplevel_page_jetpack.jetpack-connected #wpwrap,
+body[class*=" jetpack_page_jetpack_"].jetpack-connected #wpwrap {
+ background: url(images/header-clouds-small.png) 45px 0 repeat-x;
+}
+
+.toplevel_page_jetpack.jetpack-connected.admin-color-mp6 #wpwrap,
+body[class*=" jetpack_page_jetpack_"].jetpack-connected.admin-color-mp6 #wpwrap {
+ background-position: 52px 0;
+}
+
+.toplevel_page_jetpack.jetpack-connected.folded #wpwrap,
+body[class*=" jetpack_page_jetpack_"].jetpack-connected.folded #wpwrap {
+ background-position: -68px 0;
+}
+
+.toplevel_page_jetpack.jetpack-connected.admin-color-mp6.folded #wpwrap,
+body[class*=" jetpack_page_jetpack_"].jetpack-connected.admin-color-mp6.folded #wpwrap {
+ background-position: -62px 0;
+}
+
+@media only screen and (max-width: 900px) {
+
+ .toplevel_page_jetpack.jetpack-disconnected.auto-fold #wpwrap,
+ body[class*=" jetpack_page_jetpack_"].jetpack-disconnected.auto-fold #wpwrap {
+ background-position: -263px -60px;
+ }
+
+ .toplevel_page_jetpack.jetpack-disconnected.admin-color-mp6.auto-fold #wpwrap,
+ body[class*=" jetpack_page_jetpack_"].jetpack-disconnected.admin-color-mp6.auto-fold #wpwrap {
+ background-position: -257px -60px;
+ }
+
+ .toplevel_page_jetpack.jetpack-connected.auto-fold #wpwrap,
+ body[class*=" jetpack_page_jetpack_"].jetpack-connected.auto-fold #wpwrap {
+ background-position: -68px 0;
+ }
+
+ .toplevel_page_jetpack.jetpack-connected.admin-color-mp6.auto-fold #wpwrap,
+ body[class*=" jetpack_page_jetpack_"].jetpack-connected.admin-color-mp6.auto-fold #wpwrap {
+ background-position: -62px 0;
+ }
+
+}
+
+.toplevel_page_jetpack.screen-meta-wrap {
+ position: absolute;
+ top: 0;
+ width: 100%;
+ z-index: 2;
+}
+
#jp-header {
min-width: 741px;
z-index: 0;
margin: 30px 0 -30px 0;
}
- #jp-header.small {
- margin-bottom: 50px;
+
+#jp-header.small {
+ margin: 20px 0 50px;
+}
+
+#jp-header #jp-clouds {
+ position: relative;
+ padding-top: 110px;
+}
+
+#jp-header.small #jp-clouds {
+ padding: 50px 0 0 0;
+ height: 70px;
+}
+
+#jp-header #jp-clouds #jp-disconnectors {
+ font-size: 12px;
+ color: #fff;
+ float: right;
+ margin-top: -35px;
+ text-align: left;
+ position: relative;
+ left: -45px;
+}
+
+#jp-header #jp-clouds .jp-disconnect a {
+ background: #8caa46 url(images/status-light.png) 3px 85% no-repeat;
+ display: inline-block;
+ position: relative;
+ width: 100%;
+ height: 1.7em;
+ overflow: hidden;
+ padding: 4px 0 3px 30px;
+ margin: 0 -20px 3px 0;
+ color: #fff;
+ text-decoration: none;
+ border: 1px solid #7a943d;
+ border-radius: 5px;
+ box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.4);
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
+}
+
+#jp-header #jp-clouds .jp-disconnect a:hover {
+ background: #8caa46 url(images/status-light.png) 3px -2% no-repeat;
+ background-color: #839f40;
+ border-color: #6a8037;
+}
+
+#jp-header #jp-clouds .jp-disconnect div {
+ position: relative;
+ line-height: 1.7em;
+ height: 1.7em;
+}
+
+#jp-header #jp-clouds .jp-disconnect a:hover div,
+#jp-header #jp-clouds .jp-disconnect a.clicked div {
+ top: -1.7em;
+}
+
+/* Retina Header Clouds & Status Light */
+@media only screen and (-moz-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
+
+ .toplevel_page_jetpack.jetpack-disconnected #wpwrap,
+ body[class*=" jetpack_page_jetpack_"].jetpack-disconnected #wpwrap {
+ background-image: url(images/header-clouds-2x.png);
+ background-size: 1600px 400px;
}
- #jp-header #jp-clouds {
- position: relative;
- background: transparent url( images/header-clouds.png ) -315px 100% repeat-x;
- padding-top: 110px;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
+ .toplevel_page_jetpack.jetpack-connected #wpwrap,
+ body[class*=" jetpack_page_jetpack_"].jetpack-connected #wpwrap {
+ background-image: url(images/header-clouds-small-2x.png);
+ background-size: 980px 140px;
}
- #jp-header.small #jp-clouds {
- background: transparent url( images/header-clouds-small.png ) -120px 100% repeat-x;
- padding: 50px 0 0 0;
- height: 70px;
- }
-
-
- #jp-header #jp-clouds #jp-disconnectors {
- font-size: 12px;
- color: #fff;
- float: right;
- margin-top: -35px;
- text-align: left;
- position: relative;
- left: -45px;
- }
-
- #jp-header #jp-clouds .jp-disconnect a {
- background: #8caa46 url( images/status-light.png ) 3px 85% no-repeat;
- display: inline-block;
- position: relative;
- width: 100%;
- height: 1.7em;
- overflow: hidden;
- padding: 4px 0 3px 30px;
- margin: 0 -20px 3px 0;
- color: #fff;
- text-decoration: none;
- border: 1px solid #7a943d;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- -moz-box-shadow: inset 0 0 2px rgba( 255, 255, 255, 0.4 );
- -webkit-box-shadow: inset 0 0 2px rgba( 255, 255, 255, 0.4 );
- box-shadow: inset 0 0 2px rgba( 255, 255, 255, 0.4 );
- text-shadow: 0px -1px 0px rgba( 0,0,0,0.3 );
- }
- #jp-header #jp-clouds .jp-disconnect a:hover {
- background: #8caa46 url( images/status-light.png ) 3px -2% no-repeat;
- background-color: #839f40;
- border-color: #6a8037;
- }
-
- #jp-header #jp-clouds .jp-disconnect div {
- position: relative;
- line-height: 1.7em;
- height: 1.7em;
- }
-
- #jp-header #jp-clouds .jp-disconnect a:hover div,
- #jp-header #jp-clouds .jp-disconnect a.clicked div {
- top: -1.7em;
- }
-
- /* Retina Header Clouds & Status Light */
- @media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- #jp-header #jp-clouds {
- background: transparent url( images/header-clouds-2x.png ) -315px 100% repeat-x;
- background-size:1600px 400px;
- }
- #jp-header.small #jp-clouds {
- background: transparent url( images/header-clouds-small-2x.png ) -120px 100% repeat-x;
- background-size:980px 140px;
- }
-
- #jp-header #jp-clouds .jp-disconnect a {
- background: #8caa46 url( images/status-light-2x.png ) 3px 85% no-repeat;
- background-size:25px 57px;
- }
- #jp-header #jp-clouds .jp-disconnect a:hover {
- background: #8caa46 url( images/status-light-2x.png ) 3px -2% no-repeat;
- background-size:25px 57px;
- }
+
+ #jp-header #jp-clouds .jp-disconnect a {
+ background-image: url(images/status-light-2x.png);
+ background-size: 25px 57px;
+ }
+
+ #jp-header #jp-clouds .jp-disconnect a:hover {
+ background-image: url(images/status-light-2x.png);
+ background-size: 25px 57px;
}
+}
+
+#jp-header h3 {
+ position: relative;
+ background: transparent url(images/logo.png) top left no-repeat;
+ width: 252px;
+ height: 200px;
+ overflow: hidden;
+ text-indent: -999em;
+ top: -95px;
+ left: 25px;
+ margin: 0;
+ padding: 0;
+}
+
+#jp-header.small h3 {
+ background: transparent url(images/logo-small.png) top left no-repeat;
+ width: 149px;
+ height: 120px;
+ top: -35px;
+}
+
+/* Retina Logo */
+@media only screen and (-moz-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
#jp-header h3 {
- position: relative;
- background: transparent url( images/logo.png ) top left no-repeat;
- width: 252px;
- height: 200px;
- overflow: hidden;
- text-indent: -999em;
- top: -95px;
- left: 25px;
- margin: 0;
- padding: 0;
+ background-image: url(images/logo-2x.png);
+ background-size: 250px 200px;
}
- #jp-header.small h3 {
- background: transparent url( images/logo-small.png ) top left no-repeat;
- width: 149px;
- height: 120px;
- top: -35px;
- }
-
- /* Retina Logo */
- @media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- #jp-header h3 {
- background: transparent url( images/logo-2x.png ) top left no-repeat;
- background-size:250px 200px;
- }
- #jp-header.small h3 {
- background: transparent url( images/logo-small-2x.png ) top left no-repeat;
- background-size:150px 120px;
- }
+
+ #jp-header.small h3 {
+ background-image: url(images/logo-small-2x.png);
+ background-size: 150px 120px;
}
+}
+#jp-header p {
+ position: absolute;
+ left: 390px;
+ text-align: left;
+ top: 30px;
+ width: 48%;
+ color: #fff;
+ font-size: 25px;
+ line-height: 130%;
+ text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
+ -webkit-font-smoothing: antialiased;
+}
- #jp-header p {
- position: absolute;
- left: 390px;
- text-align: left;
- top: 30px;
- width: 48%;
- color: #fff;
- font-size: 25px;
- line-height: 130%;
- text-shadow: 0px 1px 1px rgba(0,0,0,0.5);
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
- -webkit-font-smoothing: antialiased;
- }
+#jp-info {
+ position: relative;
+ overflow: visible;
+ z-index: 50;
+ margin: 0 12px 0 28px;
+ min-width: 780px;
+}
- #jp-info {
- position: relative;
- overflow: visible;
- z-index: 50;
- margin: 0 12px 0 28px;
- min-width: 780px;
- }
+#jp-info p {
+ font-size: 17px;
+ line-height: 150%;
+ text-shadow: 0 1px 0 #fff;
+ color: #666;
+ margin: 0 0 40px;
+ float: left;
+ width: 58%;
+}
- #jp-info p {
- font-size: 17px;
- line-height: 150%;
- text-shadow: 0px 1px 0px #fff;
- font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
- color: #666;
- margin: 0 0 40px;
- float:left;
- width: 58%;
- }
- #jp-info p.small {
- font-size: 14px;
- }
-
- #jp-info a.jp-button {
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
- float: right;
- margin: 8px 0 0 20px;
- display: inline-block;
- background: #69acce;
- -moz-box-shadow: inset 0 0 2px #fff, 0 1px 5px rgba(0,0,0,0.3);
- -webkit-box-shadow: inset 0 0 2px #fff, 0 1px 5px rgba(0,0,0,0.3);
- box-shadow: inset 0 0 2px #fff, 0 1px 5px rgba(0,0,0,0.3);
- padding: 12px 20px;
- border: 1px solid #2a8cba;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- line-height: 100%;
- color: #fff;
- text-align: center;
- font-size: 20px;
- font-weight: bold;
- text-decoration: none;
- text-shadow: 0px 1px 2px rgba( 0,0,0,0.5);
- -webkit-transition-duration: .3s;
- -moz-transition-duration: .3s;
- cursor: pointer;
- }
- #jp-info a.jp-button:hover, #jp-info a.jp-button:active {
- background-color: #f0a000;
- border-color: #c87800;
- -webkit-transition-duration: .3s;
- outline: none;
- -moz-box-shadow: inset 0 0 2px #fff, 0 1px 7px rgba(240,160,0,0.5);
- -webkit-box-shadow: inset 0 0 2px #fff, 0 1px 7px rgba(240,160,0,0.5);
- box-shadow: inset 0 0 2px #fff, 0 1px 7spx rgba(240,160,0,0.5);
- }
+#jp-info p.small {
+ font-size: 14px;
+}
+
+#jp-info a.jp-button {
+ float: right;
+ margin: 8px 0 0 20px;
+ display: inline-block;
+ background: #69acce;
+ box-shadow: inset 0 0 2px #fff,
+ 0 1px 5px rgba(0, 0, 0, 0.3);
+ padding: 12px 20px;
+ border: 1px solid #2a8cba;
+ border-radius: 5px;
+ line-height: 100%;
+ color: #fff;
+ text-align: center;
+ font-size: 20px;
+ font-weight: bold;
+ text-decoration: none;
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
+ -webkit-transition-duration: 0.3s;
+ transition-duration: 0.3s;
+ cursor: pointer;
+}
+
+#jp-info a.jp-button:hover,
+#jp-info a.jp-button:active {
+ background-color: #f0a000;
+ border-color: #c87800;
+ outline: none;
+ box-shadow: inset 0 0 2px #fff,
+ 0 1px 7px rgba(240, 160, 0, 0.5);
+}
.jetpack-message {
position: relative;
z-index: 100;
border: 1px solid #2a8cba !important;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
border-radius: 3px;
- background: url( images/alertbox-clouds.png ) 100% 100% no-repeat;
+ background: url(images/alertbox-clouds.png) 100% 100% no-repeat;
background-color: #6aafcf !important;
- -webkit-box-shadow: inset 0 0 15px rgba( 0,0,0,0.04 );
- -moz-box-shadow: inset 0 0 15px rgba( 0,0,0,0.04 );
- box-shadow: inset 0 0 15px rgba( 0,0,0,0.04 );
+ box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.04);
padding: 18px 90px 8px 15px !important;
overflow: hidden;
line-height: 180%;
}
/* Retina alertbox clouds */
-@media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- .jetpack-message {
- background: url( images/alertbox-clouds-2x.png ) 100% 100% no-repeat;
- background-size:95px 55px;
- }
+@media only screen and (-moz-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
+
+ .jetpack-message {
+ background-image: url(images/alertbox-clouds-2x.png);
+ background-size: 95px 55px;
+ }
+
}
- .jp-connect { padding: 10px 0 5px !important; }
+.jp-connect {
+ padding: 10px 0 5px !important;
+}
- #jetpack-settings > .jetpack-message { margin: 10px 13px 10px 15px }
+#jetpack-settings > .jetpack-message {
+ margin: 10px 13px 10px 15px;
+}
- .jetpack-message .squeezer {
- max-width: 940px;
- margin: 0 0 2px;
- padding: 0 10px;
- text-align: left;
- overflow: hidden;
- }
- .jetpack-message h4 {
- margin: 0 10px 10px 0;
- font-size: 18px;
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
- font-weight: normal;
- color: #fff;
- text-shadow: 0px 1px 1px rgba(0,0,0,0.4);
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- display: inline-block;
- }
+.jetpack-message .squeezer {
+ max-width: 940px;
+ margin: 0 0 2px;
+ padding: 0 10px;
+ text-align: left;
+ overflow: hidden;
+}
- .jetpack-message h5 {
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
- margin: 0;
- }
+.jetpack-message h4 {
+ margin: 0 10px 10px 0;
+ font-size: 18px;
+ font-weight: normal;
+ color: #fff;
+ text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
+ border-radius: 5px;
+ display: inline-block;
+}
- .jetpack-message .squeezer a, .jetpack-message .squeezer a:visited {
- color: #fff;
- text-decoration: underline;
- }
+.jetpack-message h5 {
+ margin: 0;
+}
- .jetpack-message .squeezer a:hover {
- color: #f0a000;
- }
+.jetpack-message .squeezer a,
+.jetpack-message .squeezer a:visited {
+ color: #fff;
+ text-decoration: underline;
+}
- .jetpack-message code, .jetpack-err p {
- background: rgba( 0,0,0,0.2 );
- font-size: 14px;
- padding: 3px 5px !important;
- text-shadow: 0px 1px 1px rgba(0,0,0,0.4);
- color: #fff;
- }
+.jetpack-message .squeezer a:hover {
+ color: #f0a000;
+}
- .jetpack-message p {
- margin: -1px 0 0 0 !important;
- padding: 0;
- display: inline-block;
- }
- .jetpack-err p {
- overflow: hidden;
- margin-bottom: 10px !important;
- }
-
- .jetpack-message p a.button-primary {
- font-size: 16px !important;
- display: inline-block;
- padding: 8px 15px;
- color: #fff;
- text-align: center;
- font-size: 20px;
- text-decoration: none;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- border: 1px solid #8caa46;
- background: #b4d278;
- -moz-box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
- -webkit-box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
- box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
- text-shadow: 0px -1px 0px rgba( 0,0,0,0.3);
- -webkit-transition-duration: .3s;
- -moz-transition-duration: .3s;
- cursor: pointer;
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
- }
- .jetpack-message p a.button-primary:hover, .jetpack-message p a.button-primary:active {
- background-color: #f0a000;
- border-color: #c87800;
- -webkit-transition-duration: .3s;
- outline: none;
- }
-
- .inline-message p strong { display: block; }
+.jetpack-message code, .jetpack-err p {
+ background: rgba(0, 0, 0, 0.2);
+ font-size: 14px;
+ padding: 3px 5px !important;
+ text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
+ color: #fff;
+}
+
+.jetpack-message p {
+ margin: -1px 0 0 0 !important;
+ padding: 0;
+ display: inline-block;
+}
+
+.jetpack-err p {
+ overflow: hidden;
+ margin-bottom: 10px !important;
+}
+
+.jetpack-message p a.button-primary {
+ font-size: 16px !important;
+ display: inline-block;
+ padding: 8px 15px;
+ color: #fff;
+ text-align: center;
+ font-size: 20px;
+ text-decoration: none;
+ border-radius: 5px;
+ border: 1px solid #8caa46;
+ background: #b4d278;
+ box-shadow: inset 0 0 2px #fff,
+ 0 1px 1px rgba(0, 0, 0, 0.1);
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
+ -webkit-transition-duration: 0.3s;
+ transition-duration: 0.3s;
+ cursor: pointer;
+}
+
+.jetpack-message p a.button-primary:hover,
+.jetpack-message p a.button-primary:active {
+ background-color: #f0a000;
+ border-color: #c87800;
+ outline: none;
+}
+
+.inline-message p strong {
+ display: block;
+}
+
+.more-info {
+ position: relative;
+ top: -5px;
+ margin: 0 15px 5px 15px;
+ height: 230px; /* Have to set height otherwise slideDown() doesn't work. */
+ padding-right: 15px !important;
+ padding-bottom: 15px;
+ clear: both;
+ overflow: visible !important;
+ color: #666 !important;
+ background: transparent url(images/module-clouds.png) bottom left repeat-x;
+ background-color: #f0f0f0 !important;
+ border-color: #dcdcdc !important;
+ text-shadow: 0 1px 0 #fff;
+ box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05),
+ 0 1px 2px rgba(0, 0, 0, 0.1);
+}
+
+/* Retina moreinfo bg clouds */
+@media only screen and (-moz-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
.more-info {
- position: relative;
- top: -5px;
- margin: 0 15px 5px 15px;
- height: 230px; /* Have to set height otherwise slideDown() doesn't work. */
- padding-right: 15px !important;
- padding-bottom: 15px;
- clear: both;
- overflow: visible !important;
- color: #666 !important;
- background: transparent url( images/module-clouds.png ) bottom left repeat-x;
- background-color: #f0f0f0 !important;
- border-color: #dcdcdc !important;
- text-shadow: 0px 1px 0px #fff;
- -webkit-box-shadow: inset 0 0 20px rgba(0,0,0,0.05), 0 1px 2px rgba( 0,0,0,0.1 );
- -moz-box-shadow: inset 0 0 20px rgba(0,0,0,0.05), 0 1px 2px rgba( 0,0,0,0.1 );
- box-shadow: inset 0 0 20px rgba(0,0,0,0.05), 0 1px 2px rgba( 0,0,0,0.1 );
+ background-image: url(images/module-clouds-2x.png);
+ background-size: 980px 140px;
}
- /* Retina moreinfo bg clouds */
- @media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- .more-info {
- background: transparent url( images/module-clouds-2x.png ) bottom left repeat-x;
- background-size:980px 140px;
- }
+}
+
+.more-info h4 {
+ padding: 0;
+ background: none;
+ font-weight: normal;
+ color: #000;
+ font-size: 19px;
+ text-shadow: 0 1px 0 #fff;
+}
+
+.more-info h5 {
+ margin-left: 0;
+ font-size: 12px !important;
+}
+
+.more-info .arrow {
+ position: absolute;
+ width: 29px;
+ height: 18px;
+ top: -16px;
+ left: 0;
+ background: url(images/arrow.png) top left no-repeat;
+}
+
+.more-info .arrow:after {
+ display: none;
+}
+
+/* Retina module more info arrow */
+@media only screen and (-moz-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
+
+ .more-info .arrow {
+ background-image: url(images/arrow-2x.png);
+ background-size: 29px 16px;
}
+}
+
+.more-info p {
+ margin: 0 0 10px 0 !important;
+ font-size: 14px;
+ line-height: 150%;
+ display: block;
+}
+
+.more-info ul {
+ font-size: 14px;
+ line-height: 150%;
+}
+
+.more-info li {
+ list-style-type: disc;
+ list-style-position: inside;
+}
+
+.more-info code {
+ background: rgba(0, 0, 0, 0.05);
+ font-size: 12px;
+ padding: 1px;
+ text-shadow: none;
+ color: #555;
+}
+
+.more-info .jp-close {
+ position: absolute;
+ top: 18px;
+ right: 0;
+ background: #888;
+ background: rgba(0, 0, 0, 0.4);
+ color: #fff;
+ font-size: 14px !important;
+ height: 22px;
+ line-height: 20px;
+ padding: 0 6px 0 6px;
+ font-weight: bold !important;
+ border-radius: 3px;
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ cursor: pointer;
+ text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
+}
+
+.more-info .jp-close:hover {
+ background: #69acce;
+}
+
+.more-info div.jp-info-img {
+ float: right;
+ width: 320px;
+ margin: 0 30px 0 20px;
+}
- .more-info h4 {
- padding: 0;
- background: none;
- font-weight: normal;
- color: #000;
- font-size: 19px;
- text-shadow: 0px 1px 0px #fff;
- }
-
- .more-info h5 {
- margin-left: 0;
- font-size: 12px !important;
- }
- .more-info .arrow {
- position: absolute;
- width: 29px;
- height: 18px;
- top: -16px;
- left: 0;
- background: url( images/arrow.png ) top left no-repeat;
- }
-
- /* Retina module more info arrow */
- @media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- .more-info .arrow {
- background: url( images/arrow-2x.png ) top left no-repeat;
- background-size:29px 16px;
- }
- }
-
- .more-info p {
- margin: 0 0 10px 0 !important;
- font-size: 14px;
- font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
- line-height: 150%;
- display: block;
- }
-
- .more-info ul {
- font-size: 14px;
- font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
- line-height: 150%;
- }
-
- .more-info li {
- list-style-type: disc;
- list-style-position: inside;
- }
-
- .more-info code {
- background: rgba( 0,0,0,0.05 );
- font-size: 12px;
- padding: 1px;
- text-shadow: none;
- color: #555;
- }
-
- .more-info .jp-close {
- position: absolute;
- top: 18px;
- right: 0;
- background: #888;
- background: rgba(0,0,0,0.4);
- color: #fff;
- font-size: 14px !important;
- height: 22px;
- line-height: 20px;
- padding: 0 6px 0 6px;
- font-weight: bold !important;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
- -moz-border-radius-topright: 0;
- -moz-border-radius-bottomright: 0;
- -webkit-border-top-right-radius: 0;
- -webkit-border-bottom-right-radius: 0;
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
- cursor: pointer;
- text-shadow: 0 1px 0 rgba(0,0,0,0.2);
- }
- .more-info .jp-close:hover {
- background: #69acce;
- }
-
- .more-info div.jp-info-img {
- float: right;
- width: 320px;
- margin: 0 30px 0 20px;
- }
-
- .more-info img.jp-info-img {
- padding: 3px;
- background: rgba( 255, 255, 255, 0.65 );
- border: 5px solid #ddd;
- }
+.more-info img.jp-info-img {
+ padding: 3px;
+ background: rgba(255, 255, 255, 0.65);
+ border: 5px solid #ddd;
+}
.jetpack-activated {
- background: #fffff5 url( images/jp-enabled-bg.jpg ) top left repeat-x !important;
+ background: #fffff5 url(images/jp-enabled-bg.jpg) top left repeat-x !important;
height: 154px;
padding: 60px 0 0 200px !important;
position: relative;
@@ -442,59 +569,55 @@
z-index: 5;
position: relative;
}
- .jetpack-activated h3 {
- position: relative;
- z-index: 5;
- color: #444;
- font-size: 42px;
- font-weight: bold;
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
- margin: 0;
- padding: 0;
- background: none;
- display: block;
- text-transform: uppercase;
- }
- .jetpack-activated p {
- position: relative;
- z-index: 3;
- top: 3px;
- left: 10px;
- font-size: 16px;
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
- font-weight: normal;
- color: #666;
- background: rgba( 255, 255, 255, 0.75 );
- padding: 7px 10px 6px;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- display: inline-block;
- }
- .jetpack-activated .jetpack {
- position: absolute;
- top: 0;
- left: 0;
- width: 238px;
- height: 214px;
- background: url( images/jp-enabled-jetpack.jpg ) top left no-repeat;
- z-index: 2;
- }
- .jetpack-activated .clouds {
- position: absolute;
- right: 0;
- bottom: 0;
- width: 566px;
- height: 214px;
- background: url( images/jp-enabled-clouds.png ) bottom left no-repeat;
- z-index: 0;
- -webkit-border-bottom-right-radius: 5px;
- -moz-border-radius-bottomright: 5px;
- border-bottom-right-radius: 5px;
- -webkit-box-shadow: inset -7px -7px 10px rgba( 0,0,0,0.05 );
- -moz-box-shadow: inset -7px -7px 10px rgba( 0,0,0,0.05 );
- box-shadow: inset -7px -7px 10px rgba( 0,0,0,0.05 );
- }
+
+.jetpack-activated h3 {
+ position: relative;
+ z-index: 5;
+ color: #444;
+ font-size: 42px;
+ font-weight: bold;
+ margin: 0;
+ padding: 0;
+ background: none;
+ display: block;
+ text-transform: uppercase;
+}
+
+.jetpack-activated p {
+ position: relative;
+ z-index: 3;
+ top: 3px;
+ left: 10px;
+ font-size: 16px;
+ font-weight: normal;
+ color: #666;
+ background: rgba(255, 255, 255, 0.75);
+ padding: 7px 10px 6px;
+ border-radius: 5px;
+ display: inline-block;
+}
+
+.jetpack-activated .jetpack {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 238px;
+ height: 214px;
+ background: url(images/jp-enabled-jetpack.jpg) top left no-repeat;
+ z-index: 2;
+}
+
+.jetpack-activated .clouds {
+ position: absolute;
+ right: 0;
+ bottom: 0;
+ width: 566px;
+ height: 214px;
+ background: url(images/jp-enabled-clouds.png) bottom left no-repeat;
+ z-index: 0;
+ border-bottom-right-radius: 5px;
+ box-shadow: inset -7px -7px 10px rgba(0, 0, 0, 0.05);
+}
p.jp-help {
padding: 10px 0 15px;
@@ -515,346 +638,397 @@ p.jp-help {
max-height: 220px;
margin: 0 0 15px 15px;
border: 1px solid #dedede;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
border-radius: 3px;
background: #fff;
padding: 15px 0 35px 15px;
- -webkit-box-shadow: inset 0 1px 0 #fff, inset 0 0 20px rgba(0,0,0,0.05), 0 1px 2px rgba( 0,0,0,0.1 );
- -moz-box-shadow: inset 0 1px 0 #fff, inset 0 0 20px rgba(0,0,0,0.05), 0 1px 2px rgba( 0,0,0,0.1 );
- box-shadow: inset 0 1px 0 #fff, inset 0 0 20px rgba(0,0,0,0.05), 0 1px 2px rgba( 0,0,0,0.1 );
- -webkit-transition-duration: .4s;
- -moz-transition-duration: .4s
+ box-shadow: inset 0 1px 0 #fff,
+ inset 0 0 20px rgba(0, 0, 0, 0.05),
+ 0 1px 2px rgba(0, 0, 0, 0.1);
+ -webkit-transition-duration: 0.4s;
+ transition-duration: 0.4s;
}
+
/*
- .jetpack-module:hover {
- border-color: #bbb;
- -webkit-box-shadow: 0 1px 2px rgba( 0,0,0,0.2 );
- -moz-box-shadow: 0 1px 2px rgba( 0,0,0,0.2 );
- box-shadow: 0 1px 2px rgba( 0,0,0,0.2 );
- -webkit-transition-duration: .4s;
- -moz-transition-duration: .4s
- }
+.jetpack-module:hover {
+ border-color: #bbb;
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
+ -webkit-transition-duration: 0.4s;
+ transition-duration: 0.4s;
+}
*/
+
+.jetpack-module div.module-image {
+ float: right;
+ margin: 0 0 5px 10px;
+ padding: 60px 0 0;
+ background: #cbe0a1;
+ width: 80px;
+ border-top-left-radius: 3px;
+ border-bottom-left-radius: 3px;
+ background-repeat: no-repeat;
+ background-image: url(images/module-icons-sprite.png);
+ background-size: 2705px 50px; /* remember to update this every time a new module is added! */
+}
+
+@media only screen and (-moz-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
+
.jetpack-module div.module-image {
- float: right;
- margin: 0 0 5px 10px;
- padding: 60px 0 0;
- background: #cbe0a1;
- width: 80px;
- -webkit-border-top-left-radius: 3px;
- -moz-border-radius-topleft: 3px;
- border-top-left-radius: 3px;
- -webkit-border-bottom-left-radius: 3px;
- -moz-border-radius-bottomleft: 3px;
- border-bottom-left-radius: 3px;
- background-repeat: no-repeat;
- background-image: url( images/module-icons-sprite.png );
- background-size: 2555px 50px; /* remember to update this every time a new module is added! */
+ background-image: url(images/module-icons-sprite-2x.png);
}
+}
- @media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- .jetpack-module div.module-image {
- background-image: url( images/module-icons-sprite-2x.png );
- }
- }
+#stats.jetpack-module div.module-image {
+ background-position: -510px 5px;
+}
- #stats.jetpack-module div.module-image {
- background-position: -510px 5px;
- }
- #comments.jetpack-module div.module-image {
- background-position: -1210px 5px;
- }
- #subscriptions.jetpack-module div.module-image {
- background-position: -1009px 5px;
- }
- #sharedaddy.jetpack-module div.module-image {
- background-position: -710px 5px;
- }
- #after-the-deadline.jetpack-module div.module-image {
- background-position: -308px 5px;
- }
- #vaultpress.jetpack-module div.module-image {
- background-position: -910px 5px;
- }
- #gravatar-hovercards.jetpack-module div.module-image {
- background-position: -410px 5px;
- }
- #contact-form.jetpack-module div.module-image {
- background-position: -1107px 5px;
- }
- #shortlinks.jetpack-module div.module-image {
- background-position: -108px 5px;
- }
- #shortcodes.jetpack-module div.module-image {
- background-position: -608px 5px;
- }
- #latex.jetpack-module div.module-image {
- background-position: -208px 5px;
- }
- #widgets.jetpack-module div.module-image {
- background-position: -5px 5px;
- }
- #enhanced-distribution.jetpack-module div.module-image {
- background-position: -808px 5px;
- }
- #carousel.jetpack-module div.module-image {
- background-position: -1325px 5px;
- }
- #custom-css.jetpack-module div.module-image {
- background-position: -1459px 5px;
- }
- #minileven.jetpack-module div.module-image {
- background-position: -1570px 5px;
- }
- #notes.jetpack-module div.module-image {
- background-position: -1806px 5px;
- }
- #json-api.jetpack-module div.module-image {
- background-position: -1689px 5px;
- }
- #mobile-push.jetpack-module div.module-image {
- background-position: -1925px 5px;
- }
- #publicize.jetpack-module div.module-image {
- background-position: -2136px 5px;
- }
- #post-by-email.jetpack-module div.module-image {
- background-position: -2025px 5px;
- }
- #infinite-scroll.jetpack-module div.module-image {
- background-position: -2230px 5px;
- }
- #photon.jetpack-module div.module-image {
- background-position: -2320px 5px;
- }
- #tiled-gallery.jetpack-module div.module-image {
- background-position: -2400px 5px;
- }
-
- #likes.jetpack-module div.module-image {
- background-position: -2471px 5px;
- }
-
- .jetpack-module div.module-image p {
- background-color: #b4d278;
- color: #fff;
- text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
- text-align: center;
- margin: 0;
- padding: 0;
- clear: both;
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
- font-weight: bold;
- -webkit-font-smoothing: antialiased;
- -webkit-border-bottom-left-radius: 2px;
- -moz-border-radius-bottomleft: 2px;
- border-bottom-left-radius: 2px;
- }
-
- .jetpack-new-module div.module-image p {
- background-color: #f5bd4d;
- }
-
- .jetpack-updated-module div.module-image p {
- background-color: #6aafcf;
- }
-
- .jetpack-new-module:hover div.module-image p {
- background-color: #b4d278;
- }
-
- .jetpack-updated-module:hover div.module-image p {
- background-color: #b4d278;
- }
-
- .jetpack-new-module:hover div.module-image span.module-image-free,
- .jetpack-updated-module:hover div.module-image span.module-image-free {
- display: inline !important;
- }
-
- .jetpack-new-module:hover div.module-image span.module-image-badge,
- .jetpack-updated-module:hover div.module-image span.module-image-badge {
- display: none;
- }
-
- .jetpack-toggle {
- float: right;
- padding: 2px 4px 4px;
- }
- .jetpack-toggle a {
- text-decoration: none;
- font-weight: bold;
- font-size: 180%;
- color: #bbb;
- }
-
- .jetpack-active .jetpack-toggle-button:hover { color: #b90000; }
-
- .jetpack-module h3 {
- line-height: 1.1;
- margin: 0;
- padding: 0;
- font-size: 17px;
- font-weight: normal;
- font-style: normal;
- color: #000;
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
- }
+#comments.jetpack-module div.module-image {
+ background-position: -1210px 5px;
+}
- .jetpack-module-description p {
- line-height: 150%;
- font-size: 12px;
- font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
- margin-bottom: 20px;
- color: #666;
- }
+#subscriptions.jetpack-module div.module-image {
+ background-position: -1009px 5px;
+}
- .jetpack-module .jetpack-module-actions {
- position: absolute;
- bottom: 20px;
- left: 15px;
- background: #fff;
- display: block;
- }
+#sharedaddy.jetpack-module div.module-image {
+ background-position: -710px 5px;
+}
- .jetpack-module .jetpack-module-actions a {
- position: relative;
- font-weight: bold;
- color: #888;
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
- }
+#after-the-deadline.jetpack-module div.module-image {
+ background-position: -308px 5px;
+}
- .jetpack-inactive {
- border-color: #eee;
- cursor: pointer;
- }
- .jetpack-inactive *, jetpack-inactive:hover * { -webkit-transition-duration: .4s; -moz-transition-duration: .4s }
+#vaultpress.jetpack-module div.module-image {
+ background-position: -910px 5px;
+}
+
+#gravatar-hovercards.jetpack-module div.module-image {
+ background-position: -410px 5px;
+}
+
+#contact-form.jetpack-module div.module-image {
+ background-position: -1107px 5px;
+}
+
+#shortlinks.jetpack-module div.module-image {
+ background-position: -108px 5px;
+}
+
+#shortcodes.jetpack-module div.module-image {
+ background-position: -608px 5px;
+}
+
+#latex.jetpack-module div.module-image {
+ background-position: -208px 5px;
+}
+
+#widgets.jetpack-module div.module-image {
+ background-position: -5px 5px;
+}
+
+#enhanced-distribution.jetpack-module div.module-image {
+ background-position: -808px 5px;
+}
+
+#carousel.jetpack-module div.module-image {
+ background-position: -1325px 5px;
+}
+
+#custom-css.jetpack-module div.module-image {
+ background-position: -1459px 5px;
+}
+
+#minileven.jetpack-module div.module-image {
+ background-position: -1570px 5px;
+}
+
+#notes.jetpack-module div.module-image {
+ background-position: -1806px 5px;
+}
+
+#json-api.jetpack-module div.module-image {
+ background-position: -1689px 5px;
+}
+
+#mobile-push.jetpack-module div.module-image {
+ background-position: -1925px 5px;
+}
+
+#publicize.jetpack-module div.module-image {
+ background-position: -2136px 5px;
+}
+
+#post-by-email.jetpack-module div.module-image {
+ background-position: -2025px 5px;
+}
+
+#infinite-scroll.jetpack-module div.module-image {
+ background-position: -2230px 5px;
+}
+
+#photon.jetpack-module div.module-image {
+ background-position: -2320px 5px;
+}
+
+#tiled-gallery.jetpack-module div.module-image {
+ background-position: -2400px 5px;
+}
+
+#likes.jetpack-module div.module-image {
+ background-position: -2471px 5px;
+}
+
+#debug.jetpack-module div.module-image {
+ background-position: -2550px 5px;
+}
+
+#omnisearch.jetpack-module div.module-image {
+ background-position: -2625px 5px;
+}
+
+.jetpack-module div.module-image p {
+ background-color: #b4d278;
+ color: #fff;
+ text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
+ text-align: center;
+ margin: 0;
+ padding: 0;
+ clear: both;
+ font-weight: bold;
+ -webkit-font-smoothing: antialiased;
+ border-bottom-left-radius: 2px;
+}
- .jetpack-inactive h3, .jetpack-inactive p, .jetpack-inactive span {
- color: #ccc;
- }
+.jetpack-new-module div.module-image p {
+ background-color: #f5bd4d;
+}
- .jetpack-inactive .jetpack-configure-button { display: none; }
- .jetpack-inactive div.module-image {
- opacity: 0.6;
- }
+.jetpack-updated-module div.module-image p {
+ background-color: #6aafcf;
+}
- .jetpack-inactive .jetpack-module-description p a {
- color: #92b8d0;
- }
- .jetpack-inactive:hover .jetpack-module-description p a {
- color: #5590b7;
- }
+.jetpack-new-module:hover div.module-image p {
+ background-color: #b4d278;
+}
+.jetpack-updated-module:hover div.module-image p {
+ background-color: #b4d278;
+}
- .jetpack-inactive:hover {
- border-color: #ddd;
- }
+.jetpack-new-module:hover div.module-image span.module-image-free,
+.jetpack-updated-module:hover div.module-image span.module-image-free {
+ display: inline !important;
+}
- .jetpack-inactive:hover h3, .jetpack-inactive:hover p, .jetpack-inactive:hover span {
- color: #aaa;
- }
+.jetpack-new-module:hover div.module-image span.module-image-badge,
+.jetpack-updated-module:hover div.module-image span.module-image-badge {
+ display: none;
+}
- .jetpack-inactive:hover div.module-image {
- opacity: 0.75;
- }
+.jetpack-toggle {
+ float: right;
+ padding: 2px 4px 4px;
+}
- .placeholder {
- border-color: #eee !important;
- cursor: default !important;
+.jetpack-toggle a {
+ text-decoration: none;
+ font-weight: bold;
+ font-size: 180%;
+ color: #bbb;
+}
+
+.jetpack-active .jetpack-toggle-button:hover {
+ color: #b90000;
+}
+
+.jetpack-module h3 {
+ line-height: 1.1;
+ margin: 0;
+ padding: 0;
+ font-size: 17px;
+ font-weight: normal;
+ font-style: normal;
+ color: #000;
+}
+
+.jetpack-module-description p {
+ line-height: 150%;
+ font-size: 12px;
+ margin-bottom: 20px;
+ color: #666;
+}
+
+.jetpack-module .jetpack-module-actions {
+ position: absolute;
+ bottom: 20px;
+ left: 15px;
+ background: #fff;
+ display: block;
+}
+
+.jetpack-module .jetpack-module-actions a {
+ position: relative;
+ font-weight: bold;
+ color: #888;
+}
+
+.jetpack-inactive {
+ border-color: #eee;
+ cursor: pointer;
+}
+
+.jetpack-inactive *,
+jetpack-inactive:hover * {
+ -webkit-transition-duration: 0.4s;
+ transition-duration: 0.4s;
+}
+
+.jetpack-inactive h3, .jetpack-inactive p, .jetpack-inactive span {
+ color: #ccc;
+}
+
+.jetpack-inactive .jetpack-configure-button {
+ display: none;
+}
+
+.jetpack-inactive div.module-image {
+ opacity: 0.6;
+}
+
+.jetpack-inactive .jetpack-module-description p a {
+ color: #92b8d0;
+}
+
+.jetpack-inactive:hover .jetpack-module-description p a {
+ color: #5590b7;
+}
+
+.jetpack-inactive:hover {
+ border-color: #ddd;
+}
+
+.jetpack-inactive:hover h3,
+.jetpack-inactive:hover p,
+.jetpack-inactive:hover span {
+ color: #aaa;
+}
+
+.jetpack-inactive:hover div.module-image {
+ opacity: 0.75;
+}
+
+.placeholder {
+ border-color: #eee !important;
+ cursor: default !important;
+}
+
+.placeholder h3 {
+ color: #dadada;
+ margin-top: 55px;
+ text-align: center;
+ background: transparent url(images/icon-comingsoon.png) top center no-repeat;
+ padding: 40px 0 0 0;
+ margin-right: 15px;
+ box-shadow: none;
+}
+
+@media only screen and (-moz-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
+
+ .placeholder h3 {
+ background-image: url(images/icon-comingsoon-2x.png);
+ background-size: 32px 32px;
}
- .placeholder h3 {
- color: #dadada;
- margin-top: 55px;
- text-align: center;
- background: transparent url(images/icon-comingsoon.png) top center no-repeat;
- padding: 40px 0 0 0;
- margin-right: 15px;
- box-shadow: none;
- }
-
- @media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- .placeholder h3 {
- background: transparent url(images/icon-comingsoon-2x.png) top center no-repeat;
- background-size:32px 32px;
- }
- }
+}
#jp-settings-screen {
margin: 0 25px;
}
- #jp-settings-screen h3 {
- font-size: 18px;
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
- color: #555;
- padding-bottom: 20px;
- border-bottom: 1px solid #eee;
- }
+
+#jp-settings-screen h3 {
+ font-size: 18px;
+ color: #555;
+ padding-bottom: 20px;
+ border-bottom: 1px solid #eee;
+}
p#news-sub {
text-align: center;
}
#jp-footer {
- background: url( images/footer-clouds.png ) top center no-repeat;
+ background: url(images/footer-clouds.png) top center no-repeat;
margin: 30px 0;
padding-top: 60px;
text-align: center;
}
-@media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- #jp-footer {
- background: url( images/footer-clouds-2x.png ) top center no-repeat;
- background-size:700px 150px;
- }
+@media only screen and (-moz-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
+
+ #jp-footer {
+ background-image: url(images/footer-clouds-2x.png);
+ background-size: 700px 150px;
+ }
+
}
+#jp-footer .automattic {
+ color: #999;
+ font-size: 10px;
+ line-height: 15px;
+ text-transform: uppercase;
+ letter-spacing: 3px;
+ padding-left: 3px;
+}
- #jp-footer .automattic {
- color: #999;
- font-size: 10px;
- line-height: 15px;
- text-transform: uppercase;
- letter-spacing: 3px;
- padding-left: 3px;
- }
+#jp-footer .automattic span {
+ text-indent: -999em;
+ overflow: hidden;
+ background: url(images/automattic.png) center top no-repeat;
+ display: inline-block;
+ width: 165px;
+ vertical-align: top;
+ margin: 0 5px 0 1px;
+ line-height: 14px;
+ height: 14px;
+ filter: alpha(opacity=40);
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
+ opacity: 0.5;
+}
- #jp-footer .automattic span {
- text-indent: -999em;
- overflow: hidden;
- background: url( images/automattic.png ) center top no-repeat;
- display: inline-block;
- width: 165px;
- vertical-align: top;
- margin: 0 5px 0 1px;
- line-height: 14px;
- height: 14px;
- filter: alpha(opacity=40);
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
- opacity: 0.5;
- }
- @media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- #jp-footer .automattic span {
- background: url( images/automattic-2x.png ) center top no-repeat;
- background-size:165px 14px;
- }
- }
-
- #jp-footer p.small {
- font-size: 11px;
- color: #ccc;
+@media only screen and (-moz-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
+
+ #jp-footer .automattic span {
+ background-image: url(images/automattic-2x.png);
+ background-size: 165px 14px;
}
- #jp-footer .small a {
- text-decoration: none;
- }
+}
- #jp-footer .small a:hover {
- text-decoration: underline;
- }
+#jp-footer p.small {
+ font-size: 11px;
+ color: #ccc;
+}
+
+#jp-footer .small a {
+ text-decoration: none;
+}
+
+#jp-footer .small a:hover {
+ text-decoration: underline;
+}
#jetpack-configuration code {
font-size: 14px;
@@ -864,7 +1038,11 @@ p#news-sub {
clear: both;
}
-.error, .updated { position: relative; z-index: 100; }
+.error,
+.updated {
+ position: relative;
+ z-index: 100;
+}
.toplevel_page_jetpack .wrap {
max-width: 983px;
@@ -880,29 +1058,24 @@ p#news-sub {
position: relative;
z-index: 100;
border: 1px solid #ccc !important;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
border-radius: 3px;
background-color: #efefef !important;
- -webkit-box-shadow: inset 0 0 15px rgba( 0,0,0,0.04 );
- -moz-box-shadow: inset 0 0 15px rgba( 0,0,0,0.04 );
- box-shadow: inset 0 0 15px rgba( 0,0,0,0.04 );
+ box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.04);
padding: 18px 90px 8px 15px !important;
overflow: hidden;
line-height: 180%;
}
-#jetpack-settings > .jp-survey { margin: 10px 13px 40px 15px }
+#jetpack-settings > .jp-survey {
+ margin: 10px 13px 40px 15px;
+}
.jp-survey h4 {
margin: 0;
font-size: 18px;
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
font-weight: normal;
color: #333;
text-shadow: 0 1px 0 #fff;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
border-radius: 5px;
display: block;
float: left;
@@ -942,50 +1115,40 @@ p#news-sub {
width: 16px;
height: 16px;
text-indent: -9999px;
- background: transparent url( images/alertbox-closeicon.png ) no-repeat center center;
+ background: transparent url(images/alertbox-closeicon.png) center center no-repeat;
border: 0 none;
- -moz-border-radius: 0 0 0 5px;
- -webkit-border-radius: 0 0 0 5px;
- -o-border-radius: 0 0 0 5px;
- -ms-border-radius: 0 0 0 5px;
border-radius: 0 0 0 5px;
- -moz-box-shadow: none;
- -webkit-box-shadow: none;
box-shadow: none;
- -webkit-transition-duration: .3s;
- -moz-transition-duration: .3s;
- -o-transition-duration: .3s;
- -ms-transition-duration: .3s;
- transition-duration: .3s;
+ -webkit-transition-duration: 0.3s;
+ transition-duration: 0.3s;
cursor: pointer;
}
-@media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- .jetpack-close-button {
- background: transparent url( images/alertbox-closeicon-2x.png ) no-repeat center center;
- background-size:16px 16px;
- }
+@media only screen and (-moz-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
+
+ .jetpack-close-button {
+ background-image: url(images/alertbox-closeicon-2x.png);
+ background-size: 16px 16px;
+ }
+
}
.jetpack-close-button:hover {
background-color: #fff;
border: 0 none;
outline: none;
- -webkit-transition-duration: .3s;
- -moz-transition-duration: .3s;
- -o-transition-duration: .3s;
- -ms-transition-duration: .3s;
- transition-duration: .3s;
+ -webkit-transition-duration: 0.3s;
+ transition-duration: 0.3s;
}
.jetpack-close-button:active {
background-color: #efefef;
border: 0 none;
- -webkit-transition-duration: .3s;
- -moz-transition-duration: .3s;
- -o-transition-duration: .3s;
- -ms-transition-duration: .3s;
- transition-duration: .3s;
+ -webkit-transition-duration: 0.3s;
+ transition-duration: 0.3s;
}
.jetpack-wrap-container {
@@ -1002,17 +1165,13 @@ p#news-sub {
position: absolute;
bottom: 5px;
right: 15px;
- font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
float: right;
display: inline-block;
background: #b4d278;
- -moz-box-shadow: inset 0 0 2px #fff, 0 1px 5px rgba(0,0,0,0.3);
- -webkit-box-shadow: inset 0 0 2px #fff, 0 1px 5px rgba(0,0,0,0.3);
- box-shadow: inset 0 0 2px #fff, 0 1px 5px rgba(0,0,0,0.3);
+ box-shadow: inset 0 0 2px #fff,
+ 0 1px 5px rgba(0, 0, 0, 0.3);
padding: 8px 15px;
border: 1px solid #2a8cba;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
border-radius: 5px;
line-height: 1.3;
color: #fff;
@@ -1020,26 +1179,23 @@ p#news-sub {
font-size: 16px;
font-weight: bold;
text-decoration: none;
- text-shadow: 0px 1px 2px rgba( 0,0,0,0.5);
- -webkit-transition-duration: .3s;
- -moz-transition-duration: .3s;
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
+ -webkit-transition-duration: 0.3s;
+ transition-duration: 0.3s;
cursor: pointer;
}
-.jetpack-install-container p a.button-connector:hover, .jetpack-install-container p a.button-connector:active {
+.jetpack-install-container p a.button-connector:hover,
+.jetpack-install-container p a.button-connector:active {
background-color: #f0a000;
border-color: #c87800;
- -webkit-transition-duration: .3s;
outline: none;
- -moz-box-shadow: inset 0 0 2px #fff, 0 1px 7px rgba(240,160,0,0.5);
- -webkit-box-shadow: inset 0 0 2px #fff, 0 1px 7px rgba(240,160,0,0.5);
- box-shadow: inset 0 0 2px #fff, 0 1px 7spx rgba(240,160,0,0.5);
+ box-shadow: inset 0 0 2px #fff,
+ 0 1px 7px rgba(240, 160, 0, 0.5);
}
.jetpack-inline-error, .jetpack-inline-message {
- padding: .5em 1em .5em 1em;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
+ padding: 0.5em 1em 0.5em 1em;
border-radius: 3px;
border-width: 1px;
border-style: solid;
diff --git a/plugins/jetpack/_inc/jetpack.js b/plugins/jetpack/_inc/jetpack.js
index 6ef9de8d..4d70053d 100644
--- a/plugins/jetpack/_inc/jetpack.js
+++ b/plugins/jetpack/_inc/jetpack.js
@@ -80,6 +80,7 @@ jetpack = {
}
} );
+ jQuery( '#screen-meta, #screen-meta-links' ).wrapAll( '<div class="screen-meta-wrap" />' );
},
level_modules: function() {
diff --git a/plugins/jetpack/_inc/jquery.inview.js b/plugins/jetpack/_inc/jquery.inview.js
index 45f71c4c..b581903a 100644
--- a/plugins/jetpack/_inc/jquery.inview.js
+++ b/plugins/jetpack/_inc/jquery.inview.js
@@ -73,14 +73,14 @@
visiblePartX,
visiblePartY,
visiblePartsMerged;
-
+
// for the case where 'display:none' is used in place of 'visibility:hidden'
// count and sum the above items to get and move closer to the correct values
// IMPORTANT :: insert element into container empty
if($element.css('display') == 'none')
{
var parentElement = $element.parent();
-
+
elementOffset.top = parentElement.offset().top;
elementOffset.left = parentElement.offset().left;
elementSize.height = parentElement.height();
@@ -98,7 +98,7 @@
if (!viewportOffset || !viewportSize) {
return;
}
-
+
if (element.offsetWidth >= 0 && element.offsetHeight >= 0 && element.style.display != "none" &&
elementOffset.top + elementSize.height > viewportOffset.top &&
elementOffset.top < viewportOffset.top + viewportSize.height &&
@@ -124,7 +124,7 @@
$(w).bind("scroll resize", function() {
viewportSize = viewportOffset = null;
});
-
+
// IE < 9 scrolls to focused elements without firing the "scroll" event
if (!documentElement.addEventListener && documentElement.attachEvent) {
documentElement.attachEvent("onfocusin", function() {
diff --git a/plugins/jetpack/_inc/jquery.jetpack-resize.js b/plugins/jetpack/_inc/jquery.jetpack-resize.js
index e1adb22d..1c3cc87c 100644
--- a/plugins/jetpack/_inc/jquery.jetpack-resize.js
+++ b/plugins/jetpack/_inc/jquery.jetpack-resize.js
@@ -60,7 +60,7 @@
if ( 'undefined' === typeof $.fn.Jetpack ) {
/**
* Dispatches calls to the correct namespace
- *
+ *
* @param string namespace
* @param ...
* @return mixed|jQuery (chainable)
@@ -81,7 +81,7 @@
/**
* Defines the Jetpack.resizeable() namespace.
* See below for non-trivial definition for browsers with postMessage.
- */
+ */
resizeable: function() {
$.error( 'Browser does not support window.postMessage' );
}
@@ -122,7 +122,7 @@
// Some browsers send structured data, some send JSON strings
if ( 'object' === typeof event.data ) {
- data = event.data;
+ data = event.data.data;
} else {
try {
data = JSON.parse( event.data );
@@ -131,10 +131,13 @@
}
}
- if ( !data ) {
+ if ( !data.data ) {
return;
}
+ // Un-nest
+ data = data.data;
+
// Is it a resize event?
if ( 'undefined' === typeof data.action || 'resize' !== data.action ) {
return;
@@ -242,6 +245,10 @@
if ( 0 !== value ) {
target[variable]( value );
+ var container = target.parent();
+ if ( container.hasClass( 'slim-likes-widget' ) ) {
+ container[variable]( value );
+ }
}
} );
@@ -269,7 +276,7 @@
return methods.on.apply( this );
} else {
$.error( 'Method ' + method + ' does not exist on Jetpack.resizeable' );
- }
+ }
}
} );
})(jQuery);
diff --git a/plugins/jetpack/_inc/jquery.spin.js b/plugins/jetpack/_inc/jquery.spin.js
index 4642af13..1e901ca6 100644
--- a/plugins/jetpack/_inc/jquery.spin.js
+++ b/plugins/jetpack/_inc/jquery.spin.js
@@ -1,86 +1,104 @@
-/*
- * Matt Husby https://github.com/matthusby/spin.js
- * Based on the jquery plugin by Bradley Smith
- * https://gist.github.com/1290439
+/**
+ * Copyright (c) 2011-2013 Felix Gnass
+ * Licensed under the MIT license
*/
/*
-Add spin to the jQuery object
-If color is not passed the spinner will be black
-You can now create a spinner using any of the variants below:
-$("#el").spin(); // Produces default Spinner
-$("#el").spin("small"); // Produces a 'small' Spinner
-$("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
-$("#el").spin({ ... }); // Produces a Spinner using your custom settings.
-$("#el").spin("small-right"); // Pin the small spinner to the right edge
-$("#el").spin("{small, medium, large}-{left, right, top, bottom}"); // All options for where to pin
-$("#el").spin(false); // Kills the spinner.
+
+Basic Usage:
+============
+
+$('#el').spin(); // Creates a default Spinner using the text color of #el.
+$('#el').spin({ ... }); // Creates a Spinner using the provided options.
+
+$('#el').spin(false); // Stops and removes the spinner.
+
+Using Presets:
+==============
+
+$('#el').spin('small'); // Creates a 'small' Spinner using the text color of #el.
+$('#el').spin('large', '#fff'); // Creates a 'large' white Spinner.
+
+Adding a custom preset:
+=======================
+
+$.fn.spin.presets.flower = {
+ lines: 9
+ length: 10
+ width: 20
+ radius: 0
+}
+
+$('#el').spin('flower', 'red');
+
*/
-( function( $ ) {
- $.fn.spin = function( opts, color ) {
- var presets = {
- "small": { lines: 8, length: 2, width: 2, radius: 3, trail: 60, speed: 1.3 },
- "medium": { lines: 8, length: 4, width: 3, radius: 5, trail: 60, speed: 1.3 },
- "large": { lines: 10, length: 6, width: 4, radius: 7, trail: 60, speed: 1.3 }
- };
- if ( Spinner ) {
- return this.each( function() {
- var $this = $( this ),
- data = $this.data();
-
- if ( data.spinner ) {
- data.spinner.stop();
- delete data.spinner;
- }
- if ( opts !== false ) {
- var spinner_options;
- if ( typeof opts === "string" ) {
- var spinner_base = opts.indexOf( '-' );
- if( spinner_base == -1 ) {
- spinner_base = opts;
- } else {
- spinner_base = opts.substring( 0, spinner_base );
- }
- if ( spinner_base in presets ) {
- spinner_options = presets[spinner_base];
- } else {
- spinner_options = {};
- }
- var padding;
- if ( opts.indexOf( "-right" ) != -1 ) {
- padding = jQuery( this ).css( 'padding-left' );
- if( typeof padding === "undefined" ) {
- padding = 0;
- } else {
- padding = padding.replace( 'px', '' );
- }
- spinner_options.left = jQuery( this ).outerWidth() - ( 2 * ( spinner_options.length + spinner_options.width + spinner_options.radius ) ) - padding - 5;
- }
- if ( opts.indexOf( '-left' ) != -1 ) {
- spinner_options.left = 5;
- }
- if ( opts.indexOf( '-top' ) != -1 ) {
- spinner_options.top = 5;
- }
- if ( opts.indexOf( '-bottom' ) != -1 ) {
- padding = jQuery( this ).css( 'padding-top' );
- if( typeof padding === "undefined" ) {
- padding = 0;
- } else {
- padding = padding.replace( 'px', '' );
- }
- spinner_options.top = jQuery( this ).outerHeight() - ( 2 * ( spinner_options.length + spinner_options.width + spinner_options.radius ) ) - padding - 5;
- }
- }
- if( color ){
- spinner_options.color = color;
- }
- data.spinner = new Spinner( spinner_options ).spin( this );
- }
- });
- } else {
- throw "Spinner class not available.";
- }
- };
-})( jQuery ); \ No newline at end of file
+(function(factory) {
+
+ if (typeof exports == 'object') {
+ // CommonJS
+ factory(require('jquery'), require('spin'))
+ }
+ else if (typeof define == 'function' && define.amd) {
+ // AMD, register as anonymous module
+ define(['jquery', 'spin'], factory)
+ }
+ else {
+ // Browser globals
+ if (!window.Spinner) throw new Error('Spin.js not present')
+ factory(window.jQuery, window.Spinner)
+ }
+
+}(function($, Spinner) {
+
+ $.fn.spin = function(opts, color) {
+
+ return this.each(function() {
+ var $this = $(this),
+ data = $this.data();
+
+ if (data.spinner) {
+ data.spinner.stop();
+ delete data.spinner;
+ }
+ if (opts !== false) {
+ opts = $.extend(
+ { color: color || $this.css('color') },
+ $.fn.spin.presets[opts] || opts
+ )
+ // Begin WordPress Additions
+ // To use opts.right, you need to have specified a length, width, and radius.
+ if ( typeof opts.right !== 'undefined' && typeof opts.length !== 'undefined'
+ && typeof opts.width !== 'undefined' && typeof opts.radius !== 'undefined' ) {
+ var pad = $this.css( 'padding-left' );
+ pad = ( typeof pad === 'undefined' ) ? 0 : parseInt( pad, 10 );
+ opts.left = $this.outerWidth() - ( 2 * ( opts.length + opts.width + opts.radius ) ) - pad - opts.right;
+ delete opts.right;
+ }
+ // End WordPress Additions
+ data.spinner = new Spinner(opts).spin(this)
+ }
+ })
+ }
+
+ $.fn.spin.presets = {
+ tiny: { lines: 8, length: 2, width: 2, radius: 3 },
+ small: { lines: 8, length: 4, width: 3, radius: 5 },
+ large: { lines: 10, length: 8, width: 4, radius: 8 }
+ }
+
+}));
+
+// Jetpack Presets Overrides:
+(function($){
+ $.fn.spin.presets.wp = { trail: 60, speed: 1.3 };
+ $.fn.spin.presets.small = $.extend( { lines: 8, length: 2, width: 2, radius: 3 }, $.fn.spin.presets.wp );
+ $.fn.spin.presets.medium = $.extend( { lines: 8, length: 4, width: 3, radius: 5 }, $.fn.spin.presets.wp );
+ $.fn.spin.presets.large = $.extend( { lines: 10, length: 6, width: 4, radius: 7 }, $.fn.spin.presets.wp );
+ $.fn.spin.presets['small-left'] = $.extend( { left: 5 }, $.fn.spin.presets.small );
+ $.fn.spin.presets['small-right'] = $.extend( { right: 5 }, $.fn.spin.presets.small );
+ $.fn.spin.presets['medium-left'] = $.extend( { left: 5 }, $.fn.spin.presets.medium );
+ $.fn.spin.presets['medium-right'] = $.extend( { right: 5 }, $.fn.spin.presets.medium );
+ $.fn.spin.presets['large-left'] = $.extend( { left: 5 }, $.fn.spin.presets.large );
+ $.fn.spin.presets['large-right'] = $.extend( { right: 5 }, $.fn.spin.presets.large );
+})(jQuery);
diff --git a/plugins/jetpack/_inc/postmessage.js b/plugins/jetpack/_inc/postmessage.js
index e8933bca..51f8567b 100644
--- a/plugins/jetpack/_inc/postmessage.js
+++ b/plugins/jetpack/_inc/postmessage.js
@@ -105,7 +105,7 @@ var NO_JQUERY = {};
bind: function(type, fn, origin, hash, async_reply) {
pm._replyBind ( type, fn, origin, hash, async_reply );
},
-
+
_replyBind: function(type, fn, origin, hash, isCallback) {
if (("postMessage" in window) && !hash) {
pm._bind();
@@ -243,7 +243,7 @@ var NO_JQUERY = {};
pm.send({target:e.source, data:data, type:msg.callback});
}
}
-
+
try {
if ( o.callback ) {
o.fn(msg.data, sendReply, e);
@@ -390,7 +390,7 @@ var NO_JQUERY = {};
pm.send({target:source_window, data:data, type:msg.callback, hash:true, url:hash.source.url});
}
}
-
+
try {
if ( o.callback ) {
o.fn(msg.data, sendReply);
diff --git a/plugins/jetpack/_inc/spin.js b/plugins/jetpack/_inc/spin.js
index f506cd2b..c66c607a 100644
--- a/plugins/jetpack/_inc/spin.js
+++ b/plugins/jetpack/_inc/spin.js
@@ -1,301 +1,349 @@
-//fgnass.github.com/spin.js#v1.2.4
-(function(window, document, undefined) {
+//fgnass.github.com/spin.js#v1.3
/**
- * Copyright (c) 2011 Felix Gnass [fgnass at neteye dot de]
+ * Copyright (c) 2011-2013 Felix Gnass
* Licensed under the MIT license
*/
-
- var prefixes = ['webkit', 'Moz', 'ms', 'O']; /* Vendor prefixes */
- var animations = {}; /* Animation rules keyed by their name */
- var useCssAnimations;
-
- /**
- * Utility function to create elements. If no tag name is given,
- * a DIV is created. Optionally properties can be passed.
- */
- function createEl(tag, prop) {
- var el = document.createElement(tag || 'div');
- var n;
-
- for(n in prop) {
- el[n] = prop[n];
- }
- return el;
- }
-
- /**
- * Appends children and returns the parent.
- */
- function ins(parent /* child1, child2, ...*/) {
- for (var i=1, n=arguments.length; i<n; i++) {
- parent.appendChild(arguments[i]);
- }
- return parent;
- }
-
- /**
- * Insert a new stylesheet to hold the @keyframe or VML rules.
- */
- var sheet = function() {
- var el = createEl('style');
- ins(document.getElementsByTagName('head')[0], el);
- return el.sheet || el.styleSheet;
- }();
-
- /**
- * Creates an opacity keyframe animation rule and returns its name.
- * Since most mobile Webkits have timing issues with animation-delay,
- * we create separate rules for each line/segment.
- */
- function addAnimation(alpha, trail, i, lines) {
- var name = ['opacity', trail, ~~(alpha*100), i, lines].join('-');
- var start = 0.01 + i/lines*100;
- var z = Math.max(1-(1-alpha)/trail*(100-start) , alpha);
- var prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase();
- var pre = prefix && '-'+prefix+'-' || '';
-
- if (!animations[name]) {
- sheet.insertRule(
- '@' + pre + 'keyframes ' + name + '{' +
- '0%{opacity:'+z+'}' +
- start + '%{opacity:'+ alpha + '}' +
- (start+0.01) + '%{opacity:1}' +
- (start+trail)%100 + '%{opacity:'+ alpha + '}' +
- '100%{opacity:'+ z + '}' +
- '}', 0);
- animations[name] = 1;
- }
- return name;
- }
-
- /**
- * Tries various vendor prefixes and returns the first supported property.
- **/
- function vendor(el, prop) {
- var s = el.style;
- var pp;
- var i;
-
- if(s[prop] !== undefined) return prop;
- prop = prop.charAt(0).toUpperCase() + prop.slice(1);
- for(i=0; i<prefixes.length; i++) {
- pp = prefixes[i]+prop;
- if(s[pp] !== undefined) return pp;
- }
- }
-
- /**
- * Sets multiple style properties at once.
- */
- function css(el, prop) {
- for (var n in prop) {
- el.style[vendor(el, n)||n] = prop[n];
- }
- return el;
- }
-
- /**
- * Fills in default values.
- */
- function merge(obj) {
- for (var i=1; i < arguments.length; i++) {
- var def = arguments[i];
- for (var n in def) {
- if (obj[n] === undefined) obj[n] = def[n];
- }
- }
- return obj;
- }
-
- /**
- * Returns the absolute page-offset of the given element.
- */
- function pos(el) {
- var o = {x:el.offsetLeft, y:el.offsetTop};
- while((el = el.offsetParent)) {
- o.x+=el.offsetLeft;
- o.y+=el.offsetTop;
- }
- return o;
- }
-
- var defaults = {
- lines: 12, // The number of lines to draw
- length: 7, // The length of each line
- width: 5, // The line thickness
- radius: 10, // The radius of the inner circle
- color: '#000', // #rgb or #rrggbb
- speed: 1, // Rounds per second
- trail: 100, // Afterglow percentage
- opacity: 1/4, // Opacity of the lines
- fps: 20, // Frames per second when using setTimeout()
- zIndex: 2e9, // Use a high z-index by default
- className: 'spinner', // CSS class to assign to the element
- top: 'auto', // center vertically
- left: 'auto' // center horizontally
- };
-
- /** The constructor */
- var Spinner = function Spinner(o) {
- if (!this.spin) return new Spinner(o);
- this.opts = merge(o || {}, Spinner.defaults, defaults);
- };
-
- Spinner.defaults = {};
- Spinner.prototype = {
- spin: function(target) {
- this.stop();
- var self = this;
- var o = self.opts;
- var el = self.el = css(createEl(0, {className: o.className}), {position: 'relative', zIndex: o.zIndex});
- var mid = o.radius+o.length+o.width;
- var ep; // element position
- var tp; // target position
-
- if (target) {
- target.insertBefore(el, target.firstChild||null);
- tp = pos(target);
- ep = pos(el);
- css(el, {
- left: (o.left == 'auto' ? tp.x-ep.x + (target.offsetWidth >> 1) : o.left+mid) + 'px',
- top: (o.top == 'auto' ? tp.y-ep.y + (target.offsetHeight >> 1) : o.top+mid) + 'px'
- });
- }
-
- el.setAttribute('aria-role', 'progressbar');
- self.lines(el, self.opts);
-
- if (!useCssAnimations) {
- // No CSS animation support, use setTimeout() instead
- var i = 0;
- var fps = o.fps;
- var f = fps/o.speed;
- var ostep = (1-o.opacity)/(f*o.trail / 100);
- var astep = f/o.lines;
-
- !function anim() {
- i++;
- for (var s=o.lines; s; s--) {
- var alpha = Math.max(1-(i+s*astep)%f * ostep, o.opacity);
- self.opacity(el, o.lines-s, alpha, o);
- }
- self.timeout = self.el && setTimeout(anim, ~~(1000/fps));
- }();
- }
- return self;
- },
- stop: function() {
- var el = this.el;
- if (el) {
- clearTimeout(this.timeout);
- if (el.parentNode) el.parentNode.removeChild(el);
- this.el = undefined;
- }
- return this;
- },
- lines: function(el, o) {
- var i = 0;
- var seg;
-
- function fill(color, shadow) {
- return css(createEl(), {
- position: 'absolute',
- width: (o.length+o.width) + 'px',
- height: o.width + 'px',
- background: color,
- boxShadow: shadow,
- transformOrigin: 'left',
- transform: 'rotate(' + ~~(360/o.lines*i) + 'deg) translate(' + o.radius+'px' +',0)',
- borderRadius: (o.width>>1) + 'px'
- });
- }
- for (; i < o.lines; i++) {
- seg = css(createEl(), {
- position: 'absolute',
- top: 1+~(o.width/2) + 'px',
- transform: o.hwaccel ? 'translate3d(0,0,0)' : '',
- opacity: o.opacity,
- animation: useCssAnimations && addAnimation(o.opacity, o.trail, i, o.lines) + ' ' + 1/o.speed + 's linear infinite'
- });
- if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'}));
- ins(el, ins(seg, fill(o.color, '0 0 1px rgba(0,0,0,.1)')));
- }
- return el;
- },
- opacity: function(el, i, val) {
- if (i < el.childNodes.length) el.childNodes[i].style.opacity = val;
- }
- };
-
- /////////////////////////////////////////////////////////////////////////
- // VML rendering for IE
- /////////////////////////////////////////////////////////////////////////
-
- /**
- * Check and init VML support
- */
- !function() {
- var s = css(createEl('group'), {behavior: 'url(#default#VML)'});
- var i;
-
- if (!vendor(s, 'transform') && s.adj) {
-
- // VML support detected. Insert CSS rules ...
- for (i=4; i--;) sheet.addRule(['group', 'roundrect', 'fill', 'stroke'][i], 'behavior:url(#default#VML)');
-
- Spinner.prototype.lines = function(el, o) {
- var r = o.length+o.width;
- var s = 2*r;
-
- function grp() {
- return css(createEl('group', {coordsize: s +' '+s, coordorigin: -r +' '+-r}), {width: s, height: s});
- }
-
- var margin = -(o.width+o.length)*2+'px';
- var g = css(grp(), {position: 'absolute', top: margin, left: margin});
-
- var i;
-
- function seg(i, dx, filter) {
- ins(g,
- ins(css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}),
- ins(css(createEl('roundrect', {arcsize: 1}), {
- width: r,
- height: o.width,
- left: o.radius,
- top: -o.width>>1,
- filter: filter
- }),
- createEl('fill', {color: o.color, opacity: o.opacity}),
- createEl('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change
- )
- )
- );
- }
-
- if (o.shadow) {
- for (i = 1; i <= o.lines; i++) {
- seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)');
- }
- }
- for (i = 1; i <= o.lines; i++) seg(i);
- return ins(el, g);
- };
- Spinner.prototype.opacity = function(el, i, val, o) {
- var c = el.firstChild;
- o = o.shadow && o.lines || 0;
- if (c && i+o < c.childNodes.length) {
- c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild;
- if (c) c.opacity = val;
- }
- };
- }
- else {
- useCssAnimations = vendor(s, 'animation');
- }
- }();
-
- window.Spinner = Spinner;
-
-})(window, document); \ No newline at end of file
+(function(root, factory) {
+
+ /* CommonJS */
+ if (typeof exports == 'object') module.exports = factory()
+
+ /* AMD module */
+ else if (typeof define == 'function' && define.amd) define(factory)
+
+ /* Browser global */
+ else root.Spinner = factory()
+}
+(this, function() {
+ "use strict";
+
+ var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */
+ , animations = {} /* Animation rules keyed by their name */
+ , useCssAnimations /* Whether to use CSS animations or setTimeout */
+
+ /**
+ * Utility function to create elements. If no tag name is given,
+ * a DIV is created. Optionally properties can be passed.
+ */
+ function createEl(tag, prop) {
+ var el = document.createElement(tag || 'div')
+ , n
+
+ for(n in prop) el[n] = prop[n]
+ return el
+ }
+
+ /**
+ * Appends children and returns the parent.
+ */
+ function ins(parent /* child1, child2, ...*/) {
+ for (var i=1, n=arguments.length; i<n; i++)
+ parent.appendChild(arguments[i])
+
+ return parent
+ }
+
+ /**
+ * Insert a new stylesheet to hold the @keyframe or VML rules.
+ */
+ var sheet = (function() {
+ var el = createEl('style', {type : 'text/css'})
+ ins(document.getElementsByTagName('head')[0], el)
+ return el.sheet || el.styleSheet
+ }())
+
+ /**
+ * Creates an opacity keyframe animation rule and returns its name.
+ * Since most mobile Webkits have timing issues with animation-delay,
+ * we create separate rules for each line/segment.
+ */
+ function addAnimation(alpha, trail, i, lines) {
+ var name = ['opacity', trail, ~~(alpha*100), i, lines].join('-')
+ , start = 0.01 + i/lines * 100
+ , z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)
+ , prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase()
+ , pre = prefix && '-' + prefix + '-' || ''
+
+ if (!animations[name]) {
+ sheet.insertRule(
+ '@' + pre + 'keyframes ' + name + '{' +
+ '0%{opacity:' + z + '}' +
+ start + '%{opacity:' + alpha + '}' +
+ (start+0.01) + '%{opacity:1}' +
+ (start+trail) % 100 + '%{opacity:' + alpha + '}' +
+ '100%{opacity:' + z + '}' +
+ '}', sheet.cssRules.length)
+
+ animations[name] = 1
+ }
+
+ return name
+ }
+
+ /**
+ * Tries various vendor prefixes and returns the first supported property.
+ */
+ function vendor(el, prop) {
+ var s = el.style
+ , pp
+ , i
+
+ if(s[prop] !== undefined) return prop
+ prop = prop.charAt(0).toUpperCase() + prop.slice(1)
+ for(i=0; i<prefixes.length; i++) {
+ pp = prefixes[i]+prop
+ if(s[pp] !== undefined) return pp
+ }
+ }
+
+ /**
+ * Sets multiple style properties at once.
+ */
+ function css(el, prop) {
+ for (var n in prop)
+ el.style[vendor(el, n)||n] = prop[n]
+
+ return el
+ }
+
+ /**
+ * Fills in default values.
+ */
+ function merge(obj) {
+ for (var i=1; i < arguments.length; i++) {
+ var def = arguments[i]
+ for (var n in def)
+ if (obj[n] === undefined) obj[n] = def[n]
+ }
+ return obj
+ }
+
+ /**
+ * Returns the absolute page-offset of the given element.
+ */
+ function pos(el) {
+ var o = { x:el.offsetLeft, y:el.offsetTop }
+ while((el = el.offsetParent))
+ o.x+=el.offsetLeft, o.y+=el.offsetTop
+
+ return o
+ }
+
+ // Built-in defaults
+
+ var defaults = {
+ lines: 12, // The number of lines to draw
+ length: 7, // The length of each line
+ width: 5, // The line thickness
+ radius: 10, // The radius of the inner circle
+ rotate: 0, // Rotation offset
+ corners: 1, // Roundness (0..1)
+ color: '#000', // #rgb or #rrggbb
+ direction: 1, // 1: clockwise, -1: counterclockwise
+ speed: 1, // Rounds per second
+ trail: 100, // Afterglow percentage
+ opacity: 1/4, // Opacity of the lines
+ fps: 20, // Frames per second when using setTimeout()
+ zIndex: 2e9, // Use a high z-index by default
+ className: 'spinner', // CSS class to assign to the element
+ top: 'auto', // center vertically
+ left: 'auto', // center horizontally
+ position: 'relative' // element position
+ }
+
+ /** The constructor */
+ function Spinner(o) {
+ if (typeof this == 'undefined') return new Spinner(o)
+ this.opts = merge(o || {}, Spinner.defaults, defaults)
+ }
+
+ // Global defaults that override the built-ins:
+ Spinner.defaults = {}
+
+ merge(Spinner.prototype, {
+
+ /**
+ * Adds the spinner to the given target element. If this instance is already
+ * spinning, it is automatically removed from its previous target b calling
+ * stop() internally.
+ */
+ spin: function(target) {
+ this.stop()
+
+ var self = this
+ , o = self.opts
+ , el = self.el = css(createEl(0, {className: o.className}), {position: o.position, width: 0, zIndex: o.zIndex})
+ , mid = o.radius+o.length+o.width
+ , ep // element position
+ , tp // target position
+
+ if (target) {
+ target.insertBefore(el, target.firstChild||null)
+ tp = pos(target)
+ ep = pos(el)
+ css(el, {
+ left: (o.left == 'auto' ? tp.x-ep.x + (target.offsetWidth >> 1) : parseInt(o.left, 10) + mid) + 'px',
+ top: (o.top == 'auto' ? tp.y-ep.y + (target.offsetHeight >> 1) : parseInt(o.top, 10) + mid) + 'px'
+ })
+ }
+
+ el.setAttribute('role', 'progressbar')
+ self.lines(el, self.opts)
+
+ if (!useCssAnimations) {
+ // No CSS animation support, use setTimeout() instead
+ var i = 0
+ , start = (o.lines - 1) * (1 - o.direction) / 2
+ , alpha
+ , fps = o.fps
+ , f = fps/o.speed
+ , ostep = (1-o.opacity) / (f*o.trail / 100)
+ , astep = f/o.lines
+
+ ;(function anim() {
+ i++;
+ for (var j = 0; j < o.lines; j++) {
+ alpha = Math.max(1 - (i + (o.lines - j) * astep) % f * ostep, o.opacity)
+
+ self.opacity(el, j * o.direction + start, alpha, o)
+ }
+ self.timeout = self.el && setTimeout(anim, ~~(1000/fps))
+ })()
+ }
+ return self
+ },
+
+ /**
+ * Stops and removes the Spinner.
+ */
+ stop: function() {
+ var el = this.el
+ if (el) {
+ clearTimeout(this.timeout)
+ if (el.parentNode) el.parentNode.removeChild(el)
+ this.el = undefined
+ }
+ return this
+ },
+
+ /**
+ * Internal method that draws the individual lines. Will be overwritten
+ * in VML fallback mode below.
+ */
+ lines: function(el, o) {
+ var i = 0
+ , start = (o.lines - 1) * (1 - o.direction) / 2
+ , seg
+
+ function fill(color, shadow) {
+ return css(createEl(), {
+ position: 'absolute',
+ width: (o.length+o.width) + 'px',
+ height: o.width + 'px',
+ background: color,
+ boxShadow: shadow,
+ transformOrigin: 'left',
+ transform: 'rotate(' + ~~(360/o.lines*i+o.rotate) + 'deg) translate(' + o.radius+'px' +',0)',
+ borderRadius: (o.corners * o.width>>1) + 'px'
+ })
+ }
+
+ for (; i < o.lines; i++) {
+ seg = css(createEl(), {
+ position: 'absolute',
+ top: 1+~(o.width/2) + 'px',
+ transform: o.hwaccel ? 'translate3d(0,0,0)' : '',
+ opacity: o.opacity,
+ animation: useCssAnimations && addAnimation(o.opacity, o.trail, start + i * o.direction, o.lines) + ' ' + 1/o.speed + 's linear infinite'
+ })
+
+ if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'}))
+
+ ins(el, ins(seg, fill(o.color, '0 0 1px rgba(0,0,0,.1)')))
+ }
+ return el
+ },
+
+ /**
+ * Internal method that adjusts the opacity of a single line.
+ * Will be overwritten in VML fallback mode below.
+ */
+ opacity: function(el, i, val) {
+ if (i < el.childNodes.length) el.childNodes[i].style.opacity = val
+ }
+
+ })
+
+
+ function initVML() {
+
+ /* Utility function to create a VML tag */
+ function vml(tag, attr) {
+ return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr)
+ }
+
+ // No CSS transforms but VML support, add a CSS rule for VML elements:
+ sheet.addRule('.spin-vml', 'behavior:url(#default#VML)')
+
+ Spinner.prototype.lines = function(el, o) {
+ var r = o.length+o.width
+ , s = 2*r
+
+ function grp() {
+ return css(
+ vml('group', {
+ coordsize: s + ' ' + s,
+ coordorigin: -r + ' ' + -r
+ }),
+ { width: s, height: s }
+ )
+ }
+
+ var margin = -(o.width+o.length)*2 + 'px'
+ , g = css(grp(), {position: 'absolute', top: margin, left: margin})
+ , i
+
+ function seg(i, dx, filter) {
+ ins(g,
+ ins(css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}),
+ ins(css(vml('roundrect', {arcsize: o.corners}), {
+ width: r,
+ height: o.width,
+ left: o.radius,
+ top: -o.width>>1,
+ filter: filter
+ }),
+ vml('fill', {color: o.color, opacity: o.opacity}),
+ vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change
+ )
+ )
+ )
+ }
+
+ if (o.shadow)
+ for (i = 1; i <= o.lines; i++)
+ seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)')
+
+ for (i = 1; i <= o.lines; i++) seg(i)
+ return ins(el, g)
+ }
+
+ Spinner.prototype.opacity = function(el, i, val, o) {
+ var c = el.firstChild
+ o = o.shadow && o.lines || 0
+ if (c && i+o < c.childNodes.length) {
+ c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild
+ if (c) c.opacity = val
+ }
+ }
+ }
+
+ var probe = css(createEl('group'), {behavior: 'url(#default#VML)'})
+
+ if (!vendor(probe, 'transform') && probe.adj) initVML()
+ else useCssAnimations = vendor(probe, 'animation')
+
+ return Spinner
+
+}));
diff --git a/plugins/jetpack/class.jetpack-ixr-client.php b/plugins/jetpack/class.jetpack-ixr-client.php
index 8d6e52fe..7eefee5f 100644
--- a/plugins/jetpack/class.jetpack-ixr-client.php
+++ b/plugins/jetpack/class.jetpack-ixr-client.php
@@ -49,7 +49,7 @@ class Jetpack_IXR_Client extends IXR_Client {
$this->error = new IXR_Error( -32300, 'transport error - HTTP status code was not 200' );
return false;
}
-
+
$content = wp_remote_retrieve_body( $response );
// Now parse what we've got back
diff --git a/plugins/jetpack/class.jetpack-post-images.php b/plugins/jetpack/class.jetpack-post-images.php
index afdcacfa..5829fcc6 100644
--- a/plugins/jetpack/class.jetpack-post-images.php
+++ b/plugins/jetpack/class.jetpack-post-images.php
@@ -15,15 +15,17 @@ class Jetpack_PostImages {
* If a slideshow is embedded within a post, then parse out the images involved and return them
*/
static function from_slideshow( $post_id, $width = 200, $height = 200 ) {
+ $images = array();
+
$post = get_post( $post_id );
+ if ( !empty( $post->post_password ) )
+ return $images;
if ( false === strpos( $post->post_content, '[slideshow' ) )
return false; // no slideshow - bail
$permalink = get_permalink( $post->ID );
- $images = array();
-
// Mechanic: Somebody set us up the bomb
$old_post = $GLOBALS['post'];
$GLOBALS['post'] = $post;
@@ -79,15 +81,17 @@ class Jetpack_PostImages {
* If a gallery is detected, then get all the images from it.
*/
static function from_gallery( $post_id ) {
+ $images = array();
+
$post = get_post( $post_id );
+ if ( !empty( $post->post_password ) )
+ return $images;
if ( false === strpos( $post->post_content, '[gallery' ) )
return false; // no gallery - bail
$permalink = get_permalink( $post->ID );
- $images = array();
-
// CATS: All your base are belong to us
$old_post = $GLOBALS['post'];
$GLOBALS['post'] = $post;
@@ -145,6 +149,11 @@ class Jetpack_PostImages {
* their dimensions are at or above a required minimum.
*/
static function from_attachment( $post_id, $width = 200, $height = 200 ) {
+ $images = array();
+
+ $post = get_post( $post_id );
+ if ( !empty( $post->post_password ) )
+ return $images;
$post_images = get_posts( array(
'post_parent' => $post_id, // Must be children of post
@@ -158,8 +167,6 @@ class Jetpack_PostImages {
$permalink = get_permalink( $post_id );
- $images = array();
-
foreach ( $post_images as $post_image ) {
$meta = wp_get_attachment_metadata( $post_image->ID );
// Must be larger than 200x200
@@ -210,9 +217,12 @@ class Jetpack_PostImages {
static function from_thumbnail( $post_id, $width = 200, $height = 200 ) {
$images = array();
- if ( !function_exists( 'get_post_thumbnail_id' ) ) {
+ $post = get_post( $post_id );
+ if ( !empty( $post->post_password ) )
+ return $images;
+
+ if ( !function_exists( 'get_post_thumbnail_id' ) )
return $images;
- }
$thumb = get_post_thumbnail_id( $post_id );
@@ -251,10 +261,12 @@ class Jetpack_PostImages {
if ( is_numeric( $html_or_id ) ) {
$post = get_post( $html_or_id );
-
- if ( !$post )
+ if ( empty( $post ) || !empty( $post->post_password ) )
return $images;
+
$html = $post->post_content; // DO NOT apply the_content filters here, it will cause loops
+ } else {
+ $html = $html_or_id;
}
if ( !$html )
diff --git a/plugins/jetpack/class.jetpack-signature.php b/plugins/jetpack/class.jetpack-signature.php
index 975375ab..3f6c16fb 100644
--- a/plugins/jetpack/class.jetpack-signature.php
+++ b/plugins/jetpack/class.jetpack-signature.php
@@ -56,7 +56,7 @@ class Jetpack_Signature {
}
}
- $method = isset( $override['method'] ) ? $override['method'] : $_SERVER['REQUEST_METHOD'];
+ $method = isset( $override['method'] ) ? $override['method'] : $_SERVER['REQUEST_METHOD'];
return $this->sign_request( $a['token'], $a['timestamp'], $a['nonce'], $a['body-hash'], $method, $url, $body, true );
}
@@ -99,7 +99,7 @@ class Jetpack_Signature {
return new Jetpack_Error( 'invalid_body_hash', 'The body hash does not match.' );
}
} else {
- if ( $verify_body_hash && jetpack_sha1_base64( $body ) != $body_hash ) {
+ if ( $verify_body_hash && jetpack_sha1_base64( $body ) !== $body_hash ) {
return new Jetpack_Error( 'invalid_body_hash', 'The body hash does not match.' );
}
}
diff --git a/plugins/jetpack/class.jetpack-user-agent.php b/plugins/jetpack/class.jetpack-user-agent.php
index 3ae1bb85..4c63a65a 100644
--- a/plugins/jetpack/class.jetpack-user-agent.php
+++ b/plugins/jetpack/class.jetpack-user-agent.php
@@ -78,6 +78,7 @@ class Jetpack_User_Agent_Info {
const PLATFORM_J2ME_MIDP = 'j2me_midp';
const PLATFORM_ANDROID = 'android';
const PLATFORM_ANDROID_TABLET = 'android_tablet';
+ const PLATFORM_FIREFOX_OS = 'firefoxOS';
var $dumb_agents = array(
'nokia', 'blackberry', 'philips', 'samsung', 'sanyo', 'sony', 'panasonic', 'webos',
@@ -139,6 +140,8 @@ class Jetpack_User_Agent_Info {
return 'webos';
elseif ( $this->is_S60_OSSBrowser() )
return 'series60';
+ elseif ( $this->is_firefox_os() )
+ return 'firefoxOS';
elseif ( $this->is_firefox_mobile() )
return 'firefox_mobile';
elseif ( $this->is_MaemoTablet() )
@@ -228,6 +231,9 @@ class Jetpack_User_Agent_Info {
elseif ( $this->is_J2ME_platform() ) {
$this->_platform = self::PLATFORM_J2ME_MIDP;
}
+ elseif ( $this->is_firefox_os() ) {
+ $this->_platform = self::PLATFORM_FIREFOX_OS;
+ }
else
$this->_platform = false;
@@ -297,6 +303,12 @@ class Jetpack_User_Agent_Info {
$this->isTierRichCss = false;
$this->isTierGenericMobile = false;
}
+ elseif ( $this->is_firefox_os() ) {
+ $this->matched_agent = 'firefoxOS';
+ $this->isTierIphone = true;
+ $this->isTierRichCss = false;
+ $this->isTierGenericMobile = false;
+ }
elseif ( $this->is_firefox_mobile() ) {
$this->matched_agent = 'fennec';
$this->isTierIphone = true;
@@ -377,7 +389,7 @@ class Jetpack_User_Agent_Info {
// Detects if the user is using a tablet.
// props Corey Gilmore, BGR.com
- function is_tablet() {
+ static function is_tablet() {
return ( 0 // never true, but makes it easier to manage our list of tablet conditions
|| self::is_ipad()
|| self::is_android_tablet()
@@ -387,14 +399,14 @@ class Jetpack_User_Agent_Info {
|| self::is_TouchPad()
);
}
-
+
/*
* Detects if the current UA is the default iPhone or iPod Touch Browser.
*
* DEPRECATED: use is_iphone_or_ipod
*
*/
- function is_iphoneOrIpod(){
+ static function is_iphoneOrIpod(){
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -421,7 +433,7 @@ class Jetpack_User_Agent_Info {
* Otherwise those browsers will be 'catched' by the iphone string.
*
*/
- function is_iphone_or_ipod( $type = 'iphone-any' ) {
+ static function is_iphone_or_ipod( $type = 'iphone-any' ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -438,61 +450,61 @@ class Jetpack_User_Agent_Info {
return $is_iphone;
}
-
+
/*
* Detects if the current UA is Chrome for iOS
*
* The User-Agent string in Chrome for iOS is the same as the Mobile Safari User-Agent, with CriOS/<ChromeRevision> instead of Version/<VersionNum>.
* - Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3
*/
- function is_chrome_for_iOS( ) {
+ static function is_chrome_for_iOS( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
-
+
if ( self::is_iphone_or_ipod( 'iphone-safari' ) === false ) return false;
-
+
$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
-
+
if ( strpos( $ua, 'crios/' ) !== false )
return true;
else
return false;
}
-
-
+
+
/*
* Detects if the current UA is Twitter for iPhone
- *
+ *
* Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_5 like Mac OS X; nb-no) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8L1 Twitter for iPhone
* Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B206 Twitter for iPhone
- *
+ *
*/
- function is_twitter_for_iphone( ) {
+ static function is_twitter_for_iphone( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
-
+
$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
if ( strpos( $ua, 'ipad' ) !== false )
return false;
-
+
if ( strpos( $ua, 'twitter for iphone' ) !== false )
return true;
else
return false;
}
-
+
/*
* Detects if the current UA is Twitter for iPad
- *
+ *
* Old version 4.X - Mozilla/5.0 (iPad; U; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8L1 Twitter for iPad
* Ver 5.0 or Higher - Mozilla/5.0 (iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B206 Twitter for iPhone
- *
+ *
*/
- function is_twitter_for_ipad( ) {
+ static function is_twitter_for_ipad( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
-
+
$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
if ( strpos( $ua, 'twitter for ipad' ) !== false )
@@ -502,7 +514,7 @@ class Jetpack_User_Agent_Info {
else
return false;
}
-
+
/*
* Detects if the current UA is Facebook for iPhone
@@ -510,7 +522,7 @@ class Jetpack_User_Agent_Info {
* - Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_0 like Mac OS X; en_US) AppleWebKit (KHTML, like Gecko) Mobile [FBAN/FBForIPhone;FBAV/4.0.2;FBBV/4020.0;FBDV/iPhone3,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/5.0;FBSS/2; FBCR/O2;FBID/phone;FBLC/en_US;FBSF/2.0]
* - Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B206 [FBAN/FBIOS;FBAV/5.0;FBBV/47423;FBDV/iPhone3,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/5.1.1;FBSS/2; FBCR/3ITA;FBID/phone;FBLC/en_US]
*/
- function is_facebook_for_iphone( ) {
+ static function is_facebook_for_iphone( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -535,7 +547,7 @@ class Jetpack_User_Agent_Info {
* - Mozilla/5.0 (iPad; U; CPU iPhone OS 5_0 like Mac OS X; en_US) AppleWebKit (KHTML, like Gecko) Mobile [FBAN/FBForIPhone;FBAV/4.0.2;FBBV/4020.0;FBDV/iPad2,1;FBMD/iPad;FBSN/iPhone OS;FBSV/5.0;FBSS/1; FBCR/;FBID/tablet;FBLC/en_US;FBSF/1.0]
* - Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10A403 [FBAN/FBIOS;FBAV/5.0;FBBV/47423;FBDV/iPad2,1;FBMD/iPad;FBSN/iPhone OS;FBSV/6.0;FBSS/1; FBCR/;FBID/tablet;FBLC/en_US]
*/
- function is_facebook_for_ipad( ) {
+ static function is_facebook_for_ipad( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -553,7 +565,7 @@ class Jetpack_User_Agent_Info {
/*
* Detects if the current UA is WordPress for iOS
*/
- function is_wordpress_for_ios( ) {
+ static function is_wordpress_for_ios( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -573,7 +585,7 @@ class Jetpack_User_Agent_Info {
* Otherwise those browsers will be 'catched' by the ipad string.
*
*/
- function is_ipad( $type = 'ipad-any' ) {
+ static function is_ipad( $type = 'ipad-any' ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -598,7 +610,7 @@ class Jetpack_User_Agent_Info {
* Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.1.1) Gecko/20110415 Firefox/4.0.2pre Fennec/4.0.1
* Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1
*/
- function is_firefox_mobile( ) {
+ static function is_firefox_mobile( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -613,6 +625,26 @@ class Jetpack_User_Agent_Info {
/*
+ * Detects if the current browser is FirefoxOS Native browser
+ *
+ * Mozilla/5.0 (Mobile; rv:14.0) Gecko/14.0 Firefox/14.0
+ *
+ */
+ static function is_firefox_os( ) {
+
+ if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
+ return false;
+
+ $ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
+
+ if ( strpos( $ua, 'mozilla' ) !== false && strpos( $ua, 'mobile' ) !== false && strpos( $ua, 'gecko' ) !== false && strpos( $ua, 'firefox' ) !== false)
+ return true;
+ else
+ return false;
+ }
+
+
+ /*
* Detects if the current browser is Opera Mobile
*
* What is the difference between Opera Mobile and Opera Mini?
@@ -623,7 +655,7 @@ class Jetpack_User_Agent_Info {
*
* Opera/9.80 (Windows NT 6.1; Opera Mobi/14316; U; en) Presto/2.7.81 Version/11.00"
*/
- function is_opera_mobile( ) {
+ static function is_opera_mobile( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -649,7 +681,7 @@ class Jetpack_User_Agent_Info {
* Opera/9.80 (BlackBerry; Opera Mini/5.1.22303/22.387; U; en) Presto/2.5.25 Version/10.54
*
*/
- function is_opera_mini( ) {
+ static function is_opera_mini( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -666,7 +698,7 @@ class Jetpack_User_Agent_Info {
* Detects if the current browser is Opera Mini, but not on a smart device OS(Android, iOS, etc)
* Used to send users on dumb devices to m.wor
*/
- function is_opera_mini_dumb( ) {
+ static function is_opera_mini_dumb( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -690,7 +722,7 @@ class Jetpack_User_Agent_Info {
* Opera Mini 5 Beta: Opera/9.80 (J2ME/MIDP; Opera Mini/5.0.15650/756; U; en) Presto/2.2.0
* Opera Mini 8: Opera/8.01 (J2ME/MIDP; Opera Mini/3.0.6306/1528; en; U; ssr)
*/
- function is_OperaMobile() {
+ static function is_OperaMobile() {
_deprecated_function( __FUNCTION__, 'always', 'is_opera_mini() or is_opera_mobile()' );
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
@@ -712,7 +744,7 @@ class Jetpack_User_Agent_Info {
* Detects if the current browser is a Windows Phone 7 device.
* ex: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; LG; GW910)
*/
- function is_WindowsPhone7() {
+ static function is_WindowsPhone7() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -732,10 +764,10 @@ class Jetpack_User_Agent_Info {
* Detects if the current browser is a Windows Phone 8 device.
* ex: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; ARM; Touch; IEMobile/10.0; <Manufacturer>; <Device> [;<Operator>])
*/
- function is_windows_phone_8() {
+ static function is_windows_phone_8() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
-
+
$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
if ( strpos( $ua, 'windows phone 8' ) === false ) {
return false;
@@ -743,8 +775,8 @@ class Jetpack_User_Agent_Info {
return true;
}
}
-
-
+
+
/*
* Detects if the current browser is on a Palm device running the new WebOS. This EXCLUDES TouchPad.
*
@@ -752,7 +784,7 @@ class Jetpack_User_Agent_Info {
* ex2: Mozilla/5.0 (webOS/1.4.0; U; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pixi/1.1
*
*/
- function is_PalmWebOS() {
+ static function is_PalmWebOS() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -775,7 +807,7 @@ class Jetpack_User_Agent_Info {
* TouchPad: Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.0; U; en-US) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/233.70 Safari/534.6 TouchPad/1.0
*
*/
- function is_TouchPad() {
+ static function is_TouchPad() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -801,7 +833,7 @@ class Jetpack_User_Agent_Info {
* Browser 7.1 (Nokia N97 (v12.0.024)) : Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 NokiaN97-1/12.0.024; Profile/MIDP-2.1 Configuration/CLDC-1.1; en-us) AppleWebKit/525 (KHTML, like Gecko) BrowserNG/7.1.12344
*
*/
- function is_S60_OSSBrowser() {
+ static function is_S60_OSSBrowser() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -831,7 +863,7 @@ class Jetpack_User_Agent_Info {
* Detects if the device platform is the Symbian Series 60.
*
*/
- function is_symbian_platform() {
+ static function is_symbian_platform() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -864,7 +896,7 @@ class Jetpack_User_Agent_Info {
* This browser will report 'NokiaBrowser' in the header, however some older version will also report 'OviBrowser'.
*
*/
- function is_symbian_s40_platform() {
+ static function is_symbian_s40_platform() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -879,7 +911,7 @@ class Jetpack_User_Agent_Info {
return false;
}
- function is_J2ME_platform() {
+ static function is_J2ME_platform() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -899,7 +931,7 @@ class Jetpack_User_Agent_Info {
/*
* Detects if the current UA is on one of the Maemo-based Nokia Internet Tablets.
*/
- function is_MaemoTablet() {
+ static function is_MaemoTablet() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -922,7 +954,7 @@ class Jetpack_User_Agent_Info {
/*
* Detects if the current UA is a MeeGo device (Nokia Smartphone).
*/
- function is_MeeGo() {
+ static function is_MeeGo() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -943,7 +975,7 @@ class Jetpack_User_Agent_Info {
/*
is_webkit() can be used to check the User Agent for an webkit generic browser
*/
- function is_webkit() {
+ static function is_webkit() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -962,7 +994,7 @@ class Jetpack_User_Agent_Info {
* Detects if the current browser is the Native Android browser.
* @return boolean true if the browser is Android otherwise false
*/
- function is_android() {
+ static function is_android() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -985,7 +1017,7 @@ class Jetpack_User_Agent_Info {
*
* @return boolean true if the browser is Android and not 'mobile' otherwise false
*/
- function is_android_tablet( ) {
+ static function is_android_tablet( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -1012,7 +1044,7 @@ class Jetpack_User_Agent_Info {
*
* @return boolean true if the browser is Kindle Fire Native browser otherwise false
*/
- function is_kindle_fire( ) {
+ static function is_kindle_fire( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -1033,7 +1065,7 @@ class Jetpack_User_Agent_Info {
*
* @return boolean true if the browser is Kindle monochrome Native browser otherwise false
*/
- function is_kindle_touch( ) {
+ static function is_kindle_touch( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
@@ -1046,7 +1078,7 @@ class Jetpack_User_Agent_Info {
// Detect if user agent is the WordPress.com Windows 8 app (used ONLY on the custom oauth stylesheet)
- function is_windows8_auth( ) {
+ static function is_windows8_auth( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -1059,10 +1091,10 @@ class Jetpack_User_Agent_Info {
}
// Detect if user agent is the WordPress.com Windows 8 app.
- function is_wordpress_for_win8( ) {
+ static function is_wordpress_for_win8( ) {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
-
+
$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
$pos = strpos( $agent, 'wp-windows8' );
if ( $pos !== false )
@@ -1070,15 +1102,15 @@ class Jetpack_User_Agent_Info {
else
return false;
}
-
-
+
+
/*
* is_blackberry_tablet() can be used to check the User Agent for a RIM blackberry tablet
* The user agent of the BlackBerry® Tablet OS follows a format similar to the following:
* Mozilla/5.0 (PlayBook; U; RIM Tablet OS 1.0.0; en-US) AppleWebKit/534.8+ (KHTML, like Gecko) Version/0.0.1 Safari/534.8+
*
*/
- function is_blackberry_tablet() {
+ static function is_blackberry_tablet() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -1099,13 +1131,13 @@ class Jetpack_User_Agent_Info {
is_blackbeberry() can be used to check the User Agent for a blackberry device
Note that opera mini on BB matches this rule.
*/
- function is_blackbeberry() {
+ static function is_blackbeberry() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
-
+
$pos_blackberry = strpos( $agent, 'blackberry' );
if ( $pos_blackberry !== false ) {
if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() )
@@ -1120,7 +1152,7 @@ class Jetpack_User_Agent_Info {
/*
is_blackberry_10() can be used to check the User Agent for a BlackBerry 10 device.
*/
- function is_blackberry_10() {
+ static function is_blackberry_10() {
$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
return ( strpos( $agent, 'bb10' ) !== false ) && ( strpos( $agent, 'mobile' ) !== false );
}
@@ -1141,14 +1173,14 @@ class Jetpack_User_Agent_Info {
* @return string Version of the BB OS.
* If version is not found, get_blackbeberry_OS_version will return boolean false.
*/
- function get_blackbeberry_OS_version() {
+ static function get_blackbeberry_OS_version() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
if ( self::is_blackberry_10() )
return 'blackberry-10';
-
+
$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
$pos_blackberry = stripos( $agent, 'blackberry' );
@@ -1223,7 +1255,7 @@ class Jetpack_User_Agent_Info {
* @return string Type of the BB browser.
* If browser's version is not found, detect_blackbeberry_browser_version will return boolean false.
*/
- function detect_blackberry_browser_version() {
+ static function detect_blackberry_browser_version() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
@@ -1232,7 +1264,7 @@ class Jetpack_User_Agent_Info {
if ( self::is_blackberry_10() )
return 'blackberry-10';
-
+
$pos_blackberry = strpos( $agent, 'blackberry' );
if ( $pos_blackberry === false ) {
//not a blackberry device
@@ -1270,7 +1302,7 @@ class Jetpack_User_Agent_Info {
}
//Checks if a visitor is coming from one of the WordPress mobile apps
- function is_mobile_app() {
+ static function is_mobile_app() {
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
return false;
diff --git a/plugins/jetpack/class.jetpack-xmlrpc-server.php b/plugins/jetpack/class.jetpack-xmlrpc-server.php
index 3aa5adb1..fd1b8939 100644
--- a/plugins/jetpack/class.jetpack-xmlrpc-server.php
+++ b/plugins/jetpack/class.jetpack-xmlrpc-server.php
@@ -30,7 +30,7 @@ class Jetpack_XMLRPC_Server {
'jetpack.featuresEnabled' => array( $this, 'features_enabled' ),
'jetpack.getPost' => array( $this, 'get_post' ),
'jetpack.getPosts' => array( $this, 'get_posts' ),
- 'jetpack.getComment' => array( $this, 'get_comment' ),
+ 'jetpack.getComment' => array( $this, 'get_comment' ),
'jetpack.getComments' => array( $this, 'get_comments' ),
) );
@@ -158,7 +158,7 @@ class Jetpack_XMLRPC_Server {
function test_connection() {
return JETPACK__VERSION;
}
-
+
function test_api_user_code( $args ) {
$client_id = (int) $args[0];
$user_id = (int) $args[1];
@@ -279,7 +279,7 @@ class Jetpack_XMLRPC_Server {
return $sync_data;
}
-
+
function update_attachment_parent( $args ) {
$attachment_id = (int) $args[0];
$parent_id = (int) $args[1];
diff --git a/plugins/jetpack/class.json-api-endpoints.php b/plugins/jetpack/class.json-api-endpoints.php
index 6189d404..91c14808 100644
--- a/plugins/jetpack/class.json-api-endpoints.php
+++ b/plugins/jetpack/class.json-api-endpoints.php
@@ -55,7 +55,7 @@ abstract class WPCOM_JSON_API_Endpoint {
// Is this endpoint still in testing phase? If so, not available to the public.
var $in_testing = false;
-
+
/**
* @var string Version of the API
*/
@@ -161,15 +161,16 @@ abstract class WPCOM_JSON_API_Endpoint {
// Get POST body data
function input( $return_default_values = true, $cast_and_filter = true ) {
$input = trim( $this->api->post_body );
-
switch ( $this->api->content_type ) {
+ case 'application/json; charset=utf-8' :
case 'application/json' :
case 'application/x-javascript' :
case 'text/javascript' :
case 'text/x-javascript' :
case 'text/x-json' :
case 'text/json' :
- $return = json_decode( $input );
+ $return = json_decode( $input, true );
+
if ( function_exists( 'json_last_error' ) ) {
if ( JSON_ERROR_NONE !== json_last_error() ) {
return null;
@@ -180,9 +181,6 @@ abstract class WPCOM_JSON_API_Endpoint {
}
}
- if ( is_object( $return ) ) {
- $return = (array) $return;
- }
break;
case 'multipart/form-data' :
$return = array_merge( stripslashes_deep( $_POST ), $_FILES );
@@ -202,6 +200,7 @@ abstract class WPCOM_JSON_API_Endpoint {
function cast_and_filter( $data, $documentation, $return_default_values = false, $for_output = false ) {
$return_as_object = false;
if ( is_object( $data ) ) {
+ // @todo this should probably be a deep copy if $data can ever have nested objects
$data = (array) $data;
$return_as_object = true;
} elseif ( !is_array( $data ) ) {
@@ -446,6 +445,16 @@ abstract class WPCOM_JSON_API_Endpoint {
);
$return[$key] = (object) $this->cast_and_filter( $value, apply_filters( 'wpcom_json_api_attachment_cast_and_filter', $docs ), false, $for_output );
break;
+ case 'metadata' :
+ $docs = array(
+ 'id' => '(int)',
+ 'key' => '(string)',
+ 'value' => '(string|false|float|int|array|object)',
+ 'previous_value' => '(string)',
+ 'operation' => '(string)',
+ );
+ $return[$key] = (object) $this->cast_and_filter( $value, apply_filters( 'wpcom_json_api_attachment_cast_and_filter', $docs ), false, $for_output );
+ break;
default :
trigger_error( "Unknown API casting type {$type['type']}", E_USER_WARNING );
}
@@ -517,7 +526,7 @@ abstract class WPCOM_JSON_API_Endpoint {
'body' => 'Request Parameters',
'response' => 'Response Parameters',
) as $doc_section_key => $label ) :
- $doc_section = 'response' == $doc_section_key ? $doc['response']['body'] : $doc['request'][$doc_section_key];
+ $doc_section = 'response' === $doc_section_key ? $doc['response']['body'] : $doc['request'][$doc_section_key];
if ( !$doc_section ) {
continue;
}
@@ -560,29 +569,26 @@ abstract class WPCOM_JSON_API_Endpoint {
<?php
// If no example was hardcoded in the doc, try to get some
- if ( empty( $this->example_response ) ) {
+ if ( empty( $this->example_response ) ) {
// Examples for endpoint documentation response
$response_key = 'dev_response_' . $this->version . '_' . $this->method . '_' . sanitize_title( $this->path );
- $response = get_option( $response_key );
+ $response = wp_cache_get( $response_key );
// Response doesn't exist, so run the request
- if ( empty( $response ) ) {
+ if ( false === $response ) {
// Only trust GET request
- if ( 'GET' == $this->method ) {
- $response = wp_remote_get( $this->example_request );
- }
-
- // Set as false if it's an error
- if ( is_wp_error( $response ) ) {
- $response = false;
- }
+ if ( 'GET' === $this->method ) {
+ $response = wp_remote_get( $this->example_request );
+ $response_body = wp_remote_retrieve_body( $response );
- // Only update the option if there's a result
- if ( !empty( $response ) ) {
- $response = $response['body'];
- update_option( $response_key, $response );
+ // Only cache if there's a result
+ if ( strlen( $response_body ) ) {
+ wp_cache_set( $response_key, $response );
+ } else {
+ wp_cache_delete( $response_key );
+ }
}
}
@@ -771,7 +777,7 @@ EOPHP;
$type = '(string)';
}
- if ( 'response_format' != $_property ) {
+ if ( 'response_format' !== $_property ) {
// hack - don't show "(default)" in response format
reset( $description );
$description_key = key( $description );
@@ -802,7 +808,7 @@ EOPHP;
$item = compact( 'type', 'description' );
- if ( 'response_format' == $_property ) {
+ if ( 'response_format' === $_property ) {
$doc['response'][$doc_item][$key] = $item;
} else {
$doc['request'][$doc_item][$key] = $item;
@@ -819,7 +825,7 @@ EOPHP;
return false;
}
- if ( 'inherit' == $post->post_status ) {
+ if ( 'inherit' === $post->post_status ) {
$parent_post = get_post( $post->post_parent );
$post_status_obj = get_post_status_object( $parent_post->post_status );
} else {
@@ -849,11 +855,11 @@ EOPHP;
}
if ( -1 == get_option( 'blog_public' ) && !current_user_can( 'read_post', $post->ID ) ) {
- return new WP_Error( 'unauthorized', 'User cannot view post', 403 );
+ return new WP_Error( 'unauthorized', 'User cannot view post', array( 'status_code' => 403, 'error' => 'private_blog' ) );
}
if ( strlen( $post->post_password ) && !current_user_can( 'edit_post', $post->ID ) ) {
- return new WP_Error( 'unauthorized', 'User cannot view password protected post', 403 );
+ return new WP_Error( 'unauthorized', 'User cannot view password protected post', array( 'status_code' => 403, 'error' => 'password_protected' ) );
}
return true;
@@ -876,6 +882,9 @@ EOPHP;
$profile_URL = 'http://en.gravatar.com/' . md5( strtolower( trim( $email ) ) );
} else {
if ( isset( $author->post_author ) ) {
+ if ( 0 == $author->post_author )
+ return null;
+
$author = $author->post_author;
} elseif ( isset( $author->user_id ) && $author->user_id ) {
$author = $author->user_id;
@@ -944,7 +953,7 @@ EOPHP;
$response['description'] = (string) $taxonomy->description;
$response['post_count'] = (int) $taxonomy->count;
- if ( 'category' == $taxonomy_type )
+ if ( 'category' === $taxonomy_type )
$response['parent'] = (int) $taxonomy->parent;
$response['meta'] = (object) array(
@@ -1009,11 +1018,11 @@ EOPHP;
$gmt_offset = get_option( 'gmt_offset' );
$local_time = $time + $gmt_offset * 3600;
-
+
$date = getdate( ( int ) $local_time );
$datetime->setDate( $date['year'], $date['mon'], $date['mday'] );
$datetime->setTime( $date['hours'], $date['minutes'], $date['seconds'] );
-
+
$local = $datetime->format( 'Y-m-d H:i:s' );
return array( (string) $local, (string) $gmt );
}
@@ -1038,7 +1047,7 @@ EOPHP;
}
function get_taxonomy_link( $blog_id, $taxonomy_id, $taxonomy_type, $path = '' ) {
- if ( 'category' == $taxonomy_type )
+ if ( 'category' === $taxonomy_type )
return $this->get_link( '/sites/%d/categories/slug:%s', $blog_id, $taxonomy_id, $path );
else
return $this->get_link( '/sites/%d/tags/slug:%s', $blog_id, $taxonomy_id, $path );
@@ -1091,14 +1100,14 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
),
'password' => '(string) The plaintext password protecting the post, or, more likely, the empty string if the post is not password protected.',
'parent' => "(object>post_reference|false) A reference to the post's parent, if it has one.",
- 'type' => array(
- 'post' => 'A blog post.',
- 'page' => 'A page.',
- ),
+ 'type' => "(string) The post's post_type. Post types besides post and page need to be whitelisted using the <code>rest_api_allowed_post_types</code> filter.",
'comments_open' => '(bool) Is the post open for comments?',
'pings_open' => '(bool) Is the post open for pingbacks, trackbacks?',
'comment_count' => '(int) The number of comments for this post.',
'like_count' => '(int) The number of likes for this post.',
+ 'i_like' => '(bool) Does the current user like this post?',
+ 'is_reblogged' => '(bool) Did the current user reblog this post?',
+ 'is_following' => '(bool) Is the current user following this blog?',
'featured_image' => '(URL) The URL to the featured image for this post if it has one.',
'format' => array(), // see constructor
'geo' => '(object>geo|false)',
@@ -1106,7 +1115,8 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
'tags' => '(object:tag) Hash of tags (keyed by tag name) applied to the post.',
'categories' => '(object:category) Hash of categories (keyed by category name) applied to the post.',
'attachments' => '(object:attachment) Hash of post attachments (keyed by attachment ID).',
- 'meta' => '(object) Meta data',
+ 'metadata' => '(array) Array of post metadata keys and values. All unprotected meta keys are available by default for read requests. Both unprotected and protected meta keys are avaiable for authenticated requests with access. Protected meta keys can be made available with the <code>rest_api_allowed_public_metadata</code> filter.',
+ 'meta' => '(object) API result meta data',
);
// var $response_format =& $this->post_object_format;
@@ -1121,6 +1131,30 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
parent::__construct( $args );
}
+ function is_post_type_allowed( $post_type ) {
+
+ // if the post type is empty, that's fine, WordPress will default to post
+ if ( empty( $post_type ) )
+ return true;
+
+ // whitelist of post types that can be accessed
+ if ( in_array( $post_type, apply_filters( 'rest_api_allowed_post_types', array( 'post', 'page', 'any' ) ) ) )
+ return true;
+
+ return false;
+ }
+
+ function is_metadata_public( $key ) {
+ if ( empty( $key ) )
+ return false;
+
+ // whitelist of metadata that can be accessed
+ if ( in_array( $key, apply_filters( 'rest_api_allowed_public_metadata', array() ) ) )
+ return true;
+
+ return false;
+ }
+
function the_password_form() {
return __( 'This post is password protected.', 'jetpack' );
}
@@ -1134,7 +1168,7 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
$geo = false;
}
- if ( 'display' == $context ) {
+ if ( 'display' === $context ) {
$args = $this->query_args();
if ( isset( $args['content_width'] ) && $args['content_width'] ) {
$GLOBALS['content_width'] = (int) $args['content_width'];
@@ -1173,8 +1207,7 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
return new WP_Error( 'unknown_post', 'Unknown post', 404 );
}
- $types = array( 'post', 'page' );
- if ( !in_array( $post->post_type, $types ) ) {
+ if ( ! $this->is_post_type_allowed( $post->post_type ) ) {
return new WP_Error( 'unknown_post', 'Unknown post', 404 );
}
@@ -1200,7 +1233,7 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
$post = get_post( $post->ID, OBJECT, $context );
$GLOBALS['post'] = $post;
- if ( 'display' == $context ) {
+ if ( 'display' === $context ) {
setup_postdata( $post );
}
@@ -1221,7 +1254,7 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
$response[$key] = (string) $this->format_date( $post->post_modified_gmt, $post->post_modified );
break;
case 'title' :
- if ( 'display' == $context ) {
+ if ( 'display' === $context ) {
$response[$key] = (string) get_the_title( $post->ID );
} else {
$response[$key] = (string) $post->post_title;
@@ -1234,7 +1267,7 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
$response[$key] = (string) esc_url_raw( wp_get_shortlink( $post->ID ) );
break;
case 'content' :
- if ( 'display' == $context ) {
+ if ( 'display' === $context ) {
add_filter( 'the_password_form', array( $this, 'the_password_form' ) );
$response[$key] = (string) $this->get_the_post_content_for_display();
remove_filter( 'the_password_form', array( $this, 'the_password_form' ) );
@@ -1243,7 +1276,7 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
}
break;
case 'excerpt' :
- if ( 'display' == $context ) {
+ if ( 'display' === $context ) {
add_filter( 'the_password_form', array( $this, 'the_password_form' ) );
ob_start();
the_excerpt();
@@ -1289,6 +1322,15 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
case 'like_count' :
$response[$key] = (int) $this->api->post_like_count( $blog_id, $post->ID );
break;
+ case 'i_like' :
+ $response[$key] = (int) $this->api->is_liked( $blog_id, $post->ID );
+ break;
+ case 'is_reblogged':
+ $response[$key] = (int) $this->api->is_reblogged( $blog_id, $post->ID );
+ break;
+ case 'is_following':
+ $response[$key] = (int) $this->api->is_following( $blog_id );
+ break;
case 'featured_image' :
$image_attributes = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
if ( is_array( $image_attributes ) && isset( $image_attributes[0] ) )
@@ -1379,6 +1421,32 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
}
$response[$key] = (object) $response[$key];
break;
+ case 'metadata' : // (array|false)
+ $metadata = array();
+ foreach ( (array) has_meta( $post_id ) as $meta ) {
+ // Don't expose protected fields.
+ $show = false;
+ if ( $this->is_metadata_public( $meta['meta_key'] ) )
+ $show = true;
+ if ( current_user_can( 'edit_post_meta', $post_id , $meta['meta_key'] ) )
+ $show = true;
+
+ if ( !$show )
+ continue;
+
+ $metadata[] = array(
+ 'id' => $meta['meta_id'],
+ 'key' => $meta['meta_key'],
+ 'value' => maybe_unserialize( $meta['meta_value'] ),
+ );
+ }
+
+ if ( ! empty( $metadata ) ) {
+ $response[$key] = $metadata;
+ } else {
+ $response[$key] = false;
+ }
+ break;
case 'meta' :
$response[$key] = (object) array(
'links' => (object) array(
@@ -1462,7 +1530,7 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
$size = 'win8app-column';
$id = intval( $id );
- if ( 'RAND' == $order )
+ if ( 'RAND' === $order )
$orderby = 'none';
if ( !empty( $include ) ) {
@@ -1481,7 +1549,7 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
if ( ! empty( $attachments ) ) {
foreach ( $attachments as $id => $attachment ) {
- $link = isset( $attr['link'] ) && 'file' == $attr['link'] ? wp_get_attachment_link( $id, $size, false, false ) : wp_get_attachment_link( $id, $size, true, false );
+ $link = isset( $attr['link'] ) && 'file' === $attr['link'] ? wp_get_attachment_link( $id, $size, false, false ) : wp_get_attachment_link( $id, $size, true, false );
if ( $captiontag && trim($attachment->post_excerpt) ) {
$output .= "<div class='wp-caption aligncenter'>$link
@@ -1509,8 +1577,8 @@ abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint {
'URL' => (string) wp_get_attachment_url( $attachment->ID ),
'guid' => (string) $attachment->guid,
'mime_type' => (string) $attachment->post_mime_type,
- 'width' => (int) $metadata['width'],
- 'height' => (int) $metadata['height'],
+ 'width' => (int) isset( $metadata['width'] ) ? $metadata['width'] : 0,
+ 'height' => (int) isset( $metadata['height'] ) ? $metadata['height'] : 0,
);
if ( isset( $metadata['duration'] ) ) {
@@ -1573,16 +1641,37 @@ class WPCOM_JSON_API_List_Posts_Endpoint extends WPCOM_JSON_API_Post_Endpoint {
return new WP_Error( 'invalid_number', 'The NUMBER parameter must be less than or equal to 100.', 400 );
}
+ if ( ! $this->is_post_type_allowed( $args['type'] ) ) {
+ return new WP_Error( 'unknown_post_type', 'Unknown post type', 404 );
+ }
+
$query = array(
'posts_per_page' => $args['number'],
'order' => $args['order'],
'orderby' => $args['order_by'],
- 'post_type' => $args['type'],
+ 'post_type' => ( 'any' == $args['type'] ) ? array( 'post', 'page' ) : $args['type'],
'post_status' => $args['status'],
'author' => isset( $args['author'] ) && 0 < $args['author'] ? $args['author'] : null,
's' => isset( $args['search'] ) ? $args['search'] : null,
);
+ if ( isset( $args['meta_key'] ) ) {
+ $show = false;
+ if ( $this->is_metadata_public( $args['meta_key'] ) )
+ $show = true;
+ if ( current_user_can( 'edit_post_meta', $query['post_type'], $args['meta_key'] ) )
+ $show = true;
+
+ if ( is_protected_meta( $args['meta_key'], 'post' ) && ! $show )
+ return new WP_Error( 'invalid_meta_key', 'Invalid meta key', 404 );
+
+ $meta = array( 'key' => $args['meta_key'] );
+ if ( isset( $args['meta_value'] ) )
+ $meta['value'] = $args['meta_value'];
+
+ $query['meta_query'] = array( $meta );
+ }
+
if (
isset( $args['sticky'] )
&&
@@ -1735,8 +1824,16 @@ class WPCOM_JSON_API_Update_Post_Endpoint extends WPCOM_JSON_API_Post_Endpoint {
return new WP_Error( 'invalid_input', 'Invalid request input', 400 );
}
+ // default to post
+ if ( empty( $input['type'] ) )
+ $input['type'] = 'post';
+
$post_type = get_post_type_object( $input['type'] );
+ if ( ! $this->is_post_type_allowed( $input['type'] ) ) {
+ return new WP_Error( 'unknown_post_type', 'Unknown post type', 404 );
+ }
+
if ( 'publish' === $input['status'] ) {
if ( !current_user_can( $post_type->cap->publish_posts ) ) {
if ( current_user_can( $post_type->cap->edit_posts ) ) {
@@ -1782,12 +1879,21 @@ class WPCOM_JSON_API_Update_Post_Endpoint extends WPCOM_JSON_API_Post_Endpoint {
if ( !empty( $input['categories'] )) {
if ( is_array( $input['categories'] ) ) {
- $categories = $input['categories'];
+ $_categories = $input['categories'];
} else {
foreach ( explode( ',', $input['categories'] ) as $category ) {
- $categories[] = $category;
+ $_categories[] = $category;
}
}
+ foreach ( $_categories as $category ) {
+ if ( !$category_info = term_exists( $category, 'category' ) ) {
+ if ( is_int( $category ) )
+ continue;
+ $category_info = wp_insert_term( $category, 'category' );
+ }
+ if ( !is_wp_error( $category_info ) )
+ $categories[] = (int) $category_info['term_id'];
+ }
}
if ( !empty( $input['tags'] ) ) {
@@ -1802,9 +1908,9 @@ class WPCOM_JSON_API_Update_Post_Endpoint extends WPCOM_JSON_API_Post_Endpoint {
}
unset( $input['tags'], $input['categories'] );
-
+
$insert = array();
-
+
if ( !empty( $input['slug'] ) ) {
$insert['post_name'] = $input['slug'];
unset( $input['slug'] );
@@ -1814,22 +1920,30 @@ class WPCOM_JSON_API_Update_Post_Endpoint extends WPCOM_JSON_API_Post_Endpoint {
$insert['comment_status'] = 'open';
else if ( false === $input['comments_open'] )
$insert['comment_status'] = 'closed';
-
+
if ( true === $input['pings_open'] )
$insert['ping_status'] = 'open';
else if ( false === $input['pings_open'] )
$insert['ping_status'] = 'closed';
-
+
unset( $input['comments_open'], $input['pings_open'] );
-
+
$publicize = $input['publicize'];
$publicize_custom_message = $input['publicize_message'];
unset( $input['publicize'], $input['publicize_message'] );
-
+
+ $metadata = $input['metadata'];
+ unset( $input['metadata'] );
+
foreach ( $input as $key => $value ) {
$insert["post_$key"] = $value;
}
-
+
+ if ( !empty( $tags ) )
+ $insert["tax_input"]["post_tag"] = $tags;
+ if ( !empty( $categories ) )
+ $insert["tax_input"]["category"] = $categories;
+
$has_media = isset( $input['media'] ) && $input['media'] ? count( $input['media'] ) : false;
if ( $new ) {
@@ -1868,9 +1982,9 @@ class WPCOM_JSON_API_Update_Post_Endpoint extends WPCOM_JSON_API_Post_Endpoint {
}
if ( !$post_id || is_wp_error( $post_id ) ) {
- return null;
+ return $post_id;
}
-
+
if ( $publicize === false ) {
foreach ( $GLOBALS['publicize_ui']->publicize->get_services( 'all' ) as $name => $service ) {
update_post_meta( $post_id, $GLOBALS['publicize_ui']->publicize->POST_SKIP . $name, 1 );
@@ -1882,17 +1996,80 @@ class WPCOM_JSON_API_Update_Post_Endpoint extends WPCOM_JSON_API_Post_Endpoint {
}
}
}
-
+
if ( !empty( $publicize_custom_message ) )
- update_post_meta( $post_id, $GLOBALS['publicize_ui']->publicize->POST_MESS, trim( $publicize_custom_message ) );
-
- if ( is_array( $categories ) )
- wp_set_object_terms( $post_id, $categories, 'category' );
- if ( is_array( $tags ) )
- wp_set_object_terms( $post_id, $tags, 'post_tag' );
+ update_post_meta( $post_id, $GLOBALS['publicize_ui']->publicize->POST_MESS, trim( $publicize_custom_message ) );
set_post_format( $post_id, $insert['post_format'] );
+ if ( ! empty( $metadata ) ) {
+ foreach ( (array) $metadata as $meta ) {
+
+ $meta = (object) $meta;
+
+ $existing_meta_item = new stdClass;
+
+ if ( empty( $meta->operation ) )
+ $meta->operation = 'update';
+
+ if ( ! empty( $meta->value ) ) {
+ if ( 'true' == $meta->value )
+ $meta->value = true;
+ if ( 'false' == $meta->value )
+ $meta->value = false;
+ }
+
+ if ( ! empty( $meta->id ) ) {
+ $meta->id = absint( $meta->id );
+ $existing_meta_item = get_metadata_by_mid( 'post', $meta->id );
+ }
+
+ $unslashed_meta_key = wp_unslash( $meta->key ); // should match what the final key will be
+ $meta->key = wp_slash( $meta->key );
+ $unslashed_existing_meta_key = wp_unslash( $existing_meta_item->meta_key );
+ $existing_meta_item->meta_key = wp_slash( $existing_meta_item->meta_key );
+
+ switch ( $meta->operation ) {
+ case 'delete':
+
+ if ( ! empty( $meta->id ) && ! empty( $existing_meta_item->meta_key ) && current_user_can( 'delete_post_meta', $post_id, $unslashed_existing_meta_key ) ) {
+ delete_metadata_by_mid( 'post', $meta->id );
+ } elseif ( ! empty( $meta->key ) && ! empty( $meta->previous_value ) && current_user_can( 'delete_post_meta', $post_id, $unslashed_meta_key ) ) {
+ delete_post_meta( $post_id, $meta->key, $meta->previous_value );
+ } elseif ( ! empty( $meta->key ) && current_user_can( 'delete_post_meta', $post_id, $unslashed_meta_key ) ) {
+ delete_post_meta( $post_id, $meta->key );
+ }
+
+ break;
+ case 'add':
+
+ if ( ! empty( $meta->id ) || ! empty( $meta->previous_value ) ) {
+ continue;
+ } elseif ( ! empty( $meta->key ) && ! empty( $meta->value ) && current_user_can( 'add_post_meta', $post_id, $unslashed_meta_key ) ) {
+ add_post_meta( $post_id, $meta->key, $meta->value );
+ }
+
+ break;
+ case 'update':
+
+ if ( empty( $meta->value ) ) {
+ continue;
+ } elseif ( ! empty( $meta->id ) && ! empty( $existing_meta_item->meta_key ) && current_user_can( 'edit_post_meta', $post_id, $unslashed_existing_meta_key ) ) {
+ update_metadata_by_mid( 'post', $meta->id, $meta->value );
+ } elseif ( ! empty( $meta->key ) && ! empty( $meta->previous_value ) && current_user_can( 'edit_post_meta', $post_id, $unslashed_meta_key ) ) {
+ update_post_meta( $post_id, $meta->key,$meta->value, $meta->previous_value );
+ } elseif ( ! empty( $meta->key ) && current_user_can( 'edit_post_meta', $post_id, $unslashed_meta_key ) ) {
+ update_post_meta( $post_id, $meta->key, $meta->value );
+ }
+
+ break;
+ }
+
+ }
+ }
+
+ do_action( 'rest_api_inserted_post', $post_id, $insert, $new );
+
$return = $this->get_post_by( 'ID', $post_id, $args['context'] );
if ( !$return || is_wp_error( $return ) ) {
return $return;
@@ -1910,6 +2087,10 @@ class WPCOM_JSON_API_Update_Post_Endpoint extends WPCOM_JSON_API_Post_Endpoint {
return new WP_Error( 'unknown_post', 'Unknown post', 404 );
}
+ if ( ! $this->is_post_type_allowed( $post->post_type ) ) {
+ return new WP_Error( 'unknown_post_type', 'Unknown post type', 404 );
+ }
+
if ( !current_user_can( 'delete_post', $post->ID ) ) {
return new WP_Error( 'unauthorized', 'User cannot delete posts', 403 );
}
@@ -2039,7 +2220,7 @@ class WPCOM_JSON_API_Update_Taxonomy_Endpoint extends WPCOM_JSON_API_Taxonomy_En
return new WP_Error( 'unknown_taxonomy', 'A taxonomy with that name already exists', 404 );
}
- if ( 'category' != $taxonomy_type )
+ if ( 'category' !== $taxonomy_type )
$input['parent'] = 0;
$data = wp_insert_term( addslashes( $input['name'] ), $taxonomy_type,
@@ -2048,8 +2229,12 @@ class WPCOM_JSON_API_Update_Taxonomy_Endpoint extends WPCOM_JSON_API_Taxonomy_En
'parent' => $input['parent']
)
);
-
+
+ if ( is_wp_error( $data ) )
+ return $data;
+
$taxonomy = get_term_by( 'id', $data['term_id'], $taxonomy_type );
+
$return = $this->get_taxonomy( $taxonomy->slug, $taxonomy_type, $args['context'] );
if ( !$return || is_wp_error( $return ) ) {
return $return;
@@ -2081,7 +2266,7 @@ class WPCOM_JSON_API_Update_Taxonomy_Endpoint extends WPCOM_JSON_API_Taxonomy_En
}
$update = array();
- if ( 'category' == $taxonomy_type && !empty( $input['parent'] ) )
+ if ( 'category' === $taxonomy_type && !empty( $input['parent'] ) )
$update['parent'] = $input['parent'];
if ( !empty( $input['description'] ) )
@@ -2093,7 +2278,7 @@ class WPCOM_JSON_API_Update_Taxonomy_Endpoint extends WPCOM_JSON_API_Taxonomy_En
$data = wp_update_term( $taxonomy->term_id, $taxonomy_type, $update );
$taxonomy = get_term_by( 'id', $data['term_id'], $taxonomy_type );
-
+
$return = $this->get_taxonomy( $taxonomy->slug, $taxonomy_type, $args['context'] );
if ( !$return || is_wp_error( $return ) ) {
return $return;
@@ -2266,7 +2451,7 @@ abstract class WPCOM_JSON_API_Comment_Endpoint extends WPCOM_JSON_API_Endpoint {
$response[$key] = (string) esc_url_raw( wp_get_shortlink( $post->ID ) . "%23comment-{$comment->comment_ID}" );
break;
case 'content' :
- if ( 'display' == $context ) {
+ if ( 'display' === $context ) {
ob_start();
comment_text();
$response[$key] = (string) ob_get_clean();
@@ -2694,17 +2879,28 @@ class WPCOM_JSON_API_Update_Comment_Endpoint extends WPCOM_JSON_API_Comment_Endp
}
if ( isset( $update['comment_status'] ) ) {
+ if ( count( $update ) === 1 ) {
+ // We are only here to update the comment status so let's respond ASAP
+ add_action( 'wp_set_comment_status', array( $this, 'output_comment' ), 0, 1 );
+ }
switch ( $update['comment_status'] ) {
+ case 'approved' :
+ if ( 'approve' !== $comment_status ) {
+ wp_set_comment_status( $comment->comment_ID, 'approve' );
+ }
+ break;
case 'unapproved' :
- $update['comment_approved'] = 0;
+ if ( 'hold' !== $comment_status ) {
+ wp_set_comment_status( $comment->comment_ID, 'hold' );
+ }
break;
case 'spam' :
- if ( 'spam' != $comment_status ) {
+ if ( 'spam' !== $comment_status ) {
wp_spam_comment( $comment->comment_ID );
}
break;
case 'unspam' :
- if ( 'spam' == $comment_status ) {
+ if ( 'spam' === $comment_status ) {
wp_unspam_comment( $comment->comment_ID );
}
break;
@@ -2713,12 +2909,12 @@ class WPCOM_JSON_API_Update_Comment_Endpoint extends WPCOM_JSON_API_Comment_Endp
return new WP_Error( 'trash_disabled', 'Cannot trash comment', 403 );
}
- if ( 'trash' != $comment_status ) {
+ if ( 'trash' !== $comment_status ) {
wp_trash_comment( $comment_id );
}
break;
case 'untrash' :
- if ( 'trash' == $comment_status ) {
+ if ( 'trash' === $comment_status ) {
wp_untrash_comment( $comment->comment_ID );
}
break;
@@ -2729,9 +2925,10 @@ class WPCOM_JSON_API_Update_Comment_Endpoint extends WPCOM_JSON_API_Comment_Endp
unset( $update['comment_status'] );
}
- $update['comment_ID'] = $comment->comment_ID;
-
- wp_update_comment( add_magic_quotes( $update ) );
+ if ( ! empty( $update ) ) {
+ $update['comment_ID'] = $comment->comment_ID;
+ wp_update_comment( add_magic_quotes( $update ) );
+ }
$return = $this->get_comment( $comment->comment_ID, $args['context'] );
if ( !$return || is_wp_error( $return ) ) {
@@ -2770,6 +2967,12 @@ class WPCOM_JSON_API_Update_Comment_Endpoint extends WPCOM_JSON_API_Comment_Endp
return $this->get_comment( $comment->comment_ID, $args['context'] );
}
+
+ function output_comment( $comment_id ) {
+ $args = $this->query_args();
+ $output = $this->get_comment( $comment_id, $args['context'] );
+ $this->api->output_early( 200, $output );
+ }
}
class WPCOM_JSON_API_GET_Site_Endpoint extends WPCOM_JSON_API_Endpoint {
@@ -2838,16 +3041,20 @@ class WPCOM_JSON_API_GET_Site_Endpoint extends WPCOM_JSON_API_Endpoint {
}
}
+
+
/*
* Set up endpoints
*/
+
+
/*
* Site endpoints
*/
new WPCOM_JSON_API_GET_Site_Endpoint( array(
'description' => 'Information about a site ID/domain',
- 'group' => 'Sites',
+ 'group' => 'sites',
'stat' => 'sites:X',
'method' => 'GET',
@@ -2880,7 +3087,7 @@ new WPCOM_JSON_API_GET_Site_Endpoint( array(
*/
new WPCOM_JSON_API_List_Posts_Endpoint( array(
'description' => 'Return matching Posts',
- 'group' => 'Posts',
+ 'group' => 'posts',
'stat' => 'posts',
'method' => 'GET',
@@ -2907,11 +3114,7 @@ new WPCOM_JSON_API_List_Posts_Endpoint( array(
'before' => '(ISO 8601 datetime) Return posts dated on or before the specified datetime.',
'tag' => '(string) Specify the tag name or slug.',
'category' => '(string) Specify the category name or slug.',
- 'type' => array(
- 'post' => 'Return only blog posts.',
- 'page' => 'Return only pages.',
- 'any' => 'Return both blog posts and pages.',
- ),
+ 'type' => "(string) Specify the post type. Defaults to 'post', use 'any' to query for both posts and pages. Post types besides post and page need to be whitelisted using the <code>rest_api_allowed_post_types</code> filter.",
'status' => array(
'publish' => 'Return only published posts.',
'private' => 'Return only private posts.',
@@ -2924,6 +3127,8 @@ new WPCOM_JSON_API_List_Posts_Endpoint( array(
'sticky' => '(bool) Specify the stickiness.',
'author' => "(int) Author's user ID",
'search' => '(string) Search query',
+ 'meta_key' => '(string) Metadata key that the post should contain',
+ 'meta_value' => '(string) Metadata value that the post should contain. Will only be applied if a `meta_key` is also given',
),
'example_request' => 'https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/posts/?number=5&pretty=1'
@@ -2931,7 +3136,7 @@ new WPCOM_JSON_API_List_Posts_Endpoint( array(
new WPCOM_JSON_API_Get_Post_Endpoint( array(
'description' => 'Return a single Post (by ID)',
- 'group' => 'Posts',
+ 'group' => 'posts',
'stat' => 'posts:1',
'method' => 'GET',
@@ -2961,7 +3166,7 @@ new WPCOM_JSON_API_Get_Post_Endpoint( array(
new WPCOM_JSON_API_Get_Post_Endpoint( array(
'description' => 'Return a single Post (by slug)',
- 'group' => 'Posts',
+ 'group' => 'posts',
'stat' => 'posts:slug',
'method' => 'GET',
@@ -2976,7 +3181,7 @@ new WPCOM_JSON_API_Get_Post_Endpoint( array(
new WPCOM_JSON_API_Update_Post_Endpoint( array(
'description' => 'Create a Post',
- 'group' => 'Posts',
+ 'group' => 'posts',
'stat' => 'posts:new',
'method' => 'POST',
@@ -3002,15 +3207,13 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
),
'password' => '(string) The plaintext password protecting the post, or, more likely, the empty string if the post is not password protected.',
'parent' => "(int) The post ID of the new post's parent.",
- 'type' => array(
- 'post' => 'Create a blog post.',
- 'page' => 'Create a page.',
- ),
+ 'type' => "(string) The post type. Defaults to 'post'. Post types besides post and page need to be whitelisted using the <code>rest_api_allowed_post_types</code> filter.",
'categories' => "(array|string) Comma separated list or array of categories (name or id)",
'tags' => "(array|string) Comma separated list or array of tags (name or id)",
'format' => get_post_format_strings(),
'media' => "(media) An array of images to attach to the post. To upload media, the entire request should be multipart/form-data encoded. Multiple media items will be displayed in a gallery. Accepts images (image/gif, image/jpeg, image/png) only.<br /><br /><strong>Example</strong>:<br />" .
"<code>curl \<br />--form 'title=Image' \<br />--form 'media[]=@/path/to/file.jpg' \<br />-H 'Authorization: BEARER your-token' \<br />'https://public-api.wordpress.com/rest/v1/sites/123/posts/new'</code>",
+ 'metadata' => "(array) Array of metadata objects containing the following properties: `key` (metadata key), `id` (meta ID), `previous_value` (if set, the action will only occur for the provided previous value), `value` (the new value to set the meta to), `operation` (the operation to perform: `update` or `add`; defaults to `update`). All unprotected meta keys are available by default for read requests. Both unprotected and protected meta keys are avaiable for authenticated requests with access. Protected meta keys can be made available with the <code>rest_api_allowed_public_metadata</code> filter.",
'comments_open' => "(bool) Should the post be open to comments? Defaults to the blog's preference.",
'pings_open' => "(bool) Should the post be open to comments? Defaults to the blog's preference.",
),
@@ -3026,7 +3229,7 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
'title' => 'Hello World',
'content' => 'Hello. I am a test post. I was created by the API',
'tags' => 'tests',
- 'categories' => 'API'
+ 'categories' => 'API'
)
),
@@ -3056,11 +3259,14 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
"pings_open": true,
"comment_count": 0,
"like_count": 0,
+ "i_like": false,
+ "is_reblogged": false,
+ "is_following": false,
"featured_image": "",
"format": "standard",
"geo": false,
"publicize_URLs": [
-
+
],
"tags": {
"tests": {
@@ -3093,6 +3299,13 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
}
}
},
+ "metadata {
+ {
+ "id" : 123,
+ "key" : "test_meta_key",
+ "value" : "test_value",
+ }
+ },
"meta": {
"links": {
"self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183\/posts\/1270",
@@ -3107,7 +3320,7 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
new WPCOM_JSON_API_Update_Post_Endpoint( array(
'description' => 'Edit a Post',
- 'group' => 'Posts',
+ 'group' => 'posts',
'stat' => 'posts:1:POST',
'method' => 'POST',
@@ -3138,6 +3351,7 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
'format' => get_post_format_strings(),
'comments_open' => '(bool) Should the post be open to comments?',
'pings_open' => '(bool) Should the post be open to comments?',
+ 'metadata' => "(array) Array of metadata objects containing the following properties: `key` (metadata key), `id` (meta ID), `previous_value` (if set, the action will only occur for the provided previous value), `value` (the new value to set the meta to), `operation` (the operation to perform: `update` or `add`; defaults to `update`). All unprotected meta keys are available by default for read requests. Both unprotected and protected meta keys are avaiable for authenticated requests with access. Protected meta keys can be made available with the <code>rest_api_allowed_public_metadata</code> filter.",
),
'example_request' => 'https://public-api.wordpress.com/rest/v1/sites/30434183/posts/1222/',
@@ -3151,7 +3365,7 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
'title' => 'Hello World (Again)',
'content' => 'Hello. I am an edited post. I was edited by the API',
'tags' => 'tests',
- 'categories' => 'API'
+ 'categories' => 'API'
)
),
@@ -3181,11 +3395,14 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
"pings_open": true,
"comment_count": 5,
"like_count": 0,
+ "i_like": false,
+ "is_reblogged": false,
+ "is_following": false,
"featured_image": "",
"format": "standard",
"geo": false,
"publicize_URLs": [
-
+
],
"tags": {
"tests": {
@@ -3218,6 +3435,13 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
}
}
},
+ "metadata {
+ {
+ "id" : 123,
+ "key" : "test_meta_key",
+ "value" : "test_value",
+ }
+ },
"meta": {
"links": {
"self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/30434183\/posts\/1222",
@@ -3232,8 +3456,8 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
) );
new WPCOM_JSON_API_Update_Post_Endpoint( array(
- 'description' => 'Delete a Post',
- 'group' => 'Posts',
+ 'description' => 'Delete a Post. Note: If the post object is of type post or page and the trash is enabled, this request will send the post to the trash. A second request will permanently delete the post.',
+ 'group' => 'posts',
'stat' => 'posts:1:delete',
'method' => 'POST',
@@ -3277,11 +3501,14 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
"pings_open": true,
"comment_count": 5,
"like_count": 0,
+ "i_like": false,
+ "is_reblogged": false,
+ "is_following": false,
"featured_image": "",
"format": "standard",
"geo": false,
"publicize_URLs": [
-
+
],
"tags": {
"tests": {
@@ -3298,6 +3525,13 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
}
}
},
+ "metadata {
+ {
+ "id" : 123,
+ "key" : "test_meta_key",
+ "value" : "test_value",
+ }
+ },
"categories": {
"API": {
"name": "API",
@@ -3332,7 +3566,7 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
*/
new WPCOM_JSON_API_List_Comments_Endpoint( array(
'description' => 'Return recent Comments',
- 'group' => 'Comments',
+ 'group' => 'comments',
'stat' => 'comments',
'method' => 'GET',
@@ -3346,7 +3580,7 @@ new WPCOM_JSON_API_List_Comments_Endpoint( array(
new WPCOM_JSON_API_List_Comments_Endpoint( array(
'description' => 'Return recent Comments for a Post',
- 'group' => 'Comments',
+ 'group' => 'comments',
'stat' => 'posts:1:replies',
'method' => 'GET',
@@ -3361,7 +3595,7 @@ new WPCOM_JSON_API_List_Comments_Endpoint( array(
new WPCOM_JSON_API_Get_Comment_Endpoint( array(
'description' => 'Return a single Comment',
- 'group' => 'Comments',
+ 'group' => 'comments',
'stat' => 'comments:1',
'method' => 'GET',
@@ -3376,7 +3610,7 @@ new WPCOM_JSON_API_Get_Comment_Endpoint( array(
new WPCOM_JSON_API_Update_Comment_Endpoint( array(
'description' => 'Create a Comment on a Post',
- 'group' => 'Comments',
+ 'group' => 'comments',
'stat' => 'posts:1:replies:new',
'method' => 'POST',
@@ -3447,7 +3681,7 @@ new WPCOM_JSON_API_Update_Comment_Endpoint( array(
new WPCOM_JSON_API_Update_Comment_Endpoint( array(
'description' => 'Create a Comment as a reply to another Comment',
- 'group' => 'Comments',
+ 'group' => 'comments',
'stat' => 'comments:1:replies:new',
'method' => 'POST',
@@ -3517,7 +3751,7 @@ new WPCOM_JSON_API_Update_Comment_Endpoint( array(
new WPCOM_JSON_API_Update_Comment_Endpoint( array(
'description' => 'Edit a Comment',
- 'group' => 'Comments',
+ 'group' => 'comments',
'stat' => 'comments:1:POST',
'method' => 'POST',
@@ -3592,7 +3826,7 @@ new WPCOM_JSON_API_Update_Comment_Endpoint( array(
new WPCOM_JSON_API_Update_Comment_Endpoint( array(
'description' => 'Delete a Comment',
- 'group' => 'Comments',
+ 'group' => 'comments',
'stat' => 'comments:1:delete',
'method' => 'POST',
@@ -3654,7 +3888,7 @@ new WPCOM_JSON_API_Update_Comment_Endpoint( array(
*/
new WPCOM_JSON_API_Get_Taxonomy_Endpoint( array(
'description' => 'Returns information on a single Category',
- 'group' => 'Taxonomy',
+ 'group' => 'taxonomy',
'stat' => 'categories:1',
'method' => 'GET',
@@ -3669,7 +3903,7 @@ new WPCOM_JSON_API_Get_Taxonomy_Endpoint( array(
new WPCOM_JSON_API_Get_Taxonomy_Endpoint( array(
'description' => 'Returns information on a single Tag',
- 'group' => 'Taxonomy',
+ 'group' => 'taxonomy',
'stat' => 'tags:1',
'method' => 'GET',
@@ -3684,7 +3918,7 @@ new WPCOM_JSON_API_Get_Taxonomy_Endpoint( array(
new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
'description' => 'Create a new Category',
- 'group' => 'Taxonomy',
+ 'group' => 'taxonomy',
'stat' => 'categories:new',
'method' => 'POST',
@@ -3727,7 +3961,7 @@ new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
'description' => 'Create a new Tag',
- 'group' => 'Taxonomy',
+ 'group' => 'taxonomy',
'stat' => 'tags:new',
'method' => 'POST',
@@ -3769,7 +4003,7 @@ new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
'description' => 'Edit a Tag',
- 'group' => 'Taxonomy',
+ 'group' => 'taxonomy',
'stat' => 'tags:1:POST',
'method' => 'POST',
@@ -3812,7 +4046,7 @@ new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
'description' => 'Edit a Category',
- 'group' => 'Taxonomy',
+ 'group' => 'taxonomy',
'stat' => 'categories:1:POST',
'method' => 'POST',
@@ -3857,7 +4091,7 @@ new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
'description' => 'Delete a Category',
- 'group' => 'Taxonomy',
+ 'group' => 'taxonomy',
'stat' => 'categories:1:delete',
'method' => 'POST',
@@ -3885,7 +4119,7 @@ new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
'description' => 'Delete a Tag',
- 'group' => 'Taxonomy',
+ 'group' => 'taxonomy',
'stat' => 'tags:1:delete',
'method' => 'POST',
diff --git a/plugins/jetpack/class.json-api.php b/plugins/jetpack/class.json-api.php
index 5a322eb6..b94ce590 100644
--- a/plugins/jetpack/class.json-api.php
+++ b/plugins/jetpack/class.json-api.php
@@ -12,6 +12,7 @@ class WPCOM_JSON_API {
var $method = '';
var $url = '';
var $path = '';
+ var $version = null;
var $query = array();
var $post_body = null;
var $files = null;
@@ -23,6 +24,7 @@ class WPCOM_JSON_API {
var $public_api_scheme = 'https';
var $trapped_error = null;
+ var $did_output = false;
static function init( $method = null, $url = null, $post_body = null ) {
if ( !self::$self ) {
@@ -78,7 +80,7 @@ class WPCOM_JSON_API {
$this->accept = $_SERVER['HTTP_ACCEPT'];
}
- if ( 'POST' == $this->method ) {
+ if ( 'POST' === $this->method ) {
if ( is_null( $post_body ) ) {
$this->post_body = file_get_contents( 'php://input' );
@@ -122,11 +124,17 @@ class WPCOM_JSON_API {
add_filter( 'comment_edit_pre', array( $this, 'comment_edit_pre' ) );
- $this->initialize();
+ $initialization = $this->initialize();
+ if ( is_wp_error( $initialization ) ) {
+ $this->output_error( $initialization );
+ return;
+ }
- // Normalize path
+ // Normalize path and extract API version
$this->path = untrailingslashit( $this->path );
- $this->path = preg_replace( '#^/rest/v1#', '', $this->path );
+ preg_match( '#^/rest/v1(\.\d+)*#', $this->path, $matches );
+ $this->path = substr( $this->path, strlen( $matches[0] ) );
+ $this->version = $matches[1];
$allowed_methods = array( 'GET', 'POST' );
$four_oh_five = false;
@@ -156,7 +164,7 @@ class WPCOM_JSON_API {
$methods = $allowed_methods;
$find_all_matching_endpoints = true;
$four_oh_five = true;
- }
+ }
}
// Find which endpoint to serve
@@ -238,25 +246,37 @@ class WPCOM_JSON_API {
if ( !$response ) {
return $this->output( 500, '', 'text/plain' );
} elseif ( is_wp_error( $response ) ) {
- $status_code = $response->get_error_data();
- if ( !$status_code ) {
- $status_code = 400;
- }
- $response = array(
- 'error' => $response->get_error_code(),
- 'message' => $response->get_error_message(),
- );
- return $this->output( $status_code, $response );
+ return $this->output_error( $response );
}
return $this->output( 200, $response );
}
function process_request( WPCOM_JSON_API_Endpoint $endpoint, $path_pieces ) {
+ $this->endpoint = $endpoint;
return call_user_func_array( array( $endpoint, 'callback' ), $path_pieces );
}
+ function output_early( $status_code, $response = null, $content_type = 'application/json' ) {
+ $exit = $this->exit;
+ $this->exit = false;
+ if ( is_wp_error( $response ) )
+ $this->output_error( $response );
+ else
+ $this->output( $status_code, $response, $content_type );
+ $this->exit = $exit;
+ $this->finish_request();
+ }
+
function output( $status_code, $response = null, $content_type = 'application/json' ) {
+ // In case output() was called before the callback returned
+ if ( $this->did_output ) {
+ if ( $this->exit )
+ exit;
+ return $content_type;
+ }
+ $this->did_output = true;
+
if ( is_null( $response ) ) {
$response = new stdClass;
}
@@ -310,6 +330,22 @@ class WPCOM_JSON_API {
return $content_type;
}
+ function output_error( $error ) {
+ $status_code = $error->get_error_data();
+
+ if ( is_array( $status_code ) )
+ $status_code = $status_code['status_code'];
+
+ if ( !$status_code ) {
+ $status_code = 400;
+ }
+ $response = array(
+ 'error' => $error->get_error_code(),
+ 'message' => $error->get_error_message(),
+ );
+ return $this->output( $status_code, $response );
+ }
+
function ensure_http_scheme_of_home_url( $url, $path, $original_scheme ) {
if ( $original_scheme ) {
return $url;
@@ -352,6 +388,18 @@ class WPCOM_JSON_API {
return 0;
}
+ function is_liked( $blog_id, $post_id ) {
+ return false;
+ }
+
+ function is_reblogged( $blog_id, $post_id ) {
+ return false;
+ }
+
+ function is_following( $blog_id ) {
+ return false;
+ }
+
function get_avatar_url( $email ) {
add_filter( 'pre_option_show_avatars', '__return_true', 999 );
$_SERVER['HTTPS'] = 'off';
@@ -440,4 +488,9 @@ class WPCOM_JSON_API {
'message' => $this->trapped_error['message'],
) );
}
+
+ function finish_request() {
+ if ( function_exists( 'fastcgi_finish_request' ) )
+ return fastcgi_finish_request();
+ }
}
diff --git a/plugins/jetpack/class.photon.php b/plugins/jetpack/class.photon.php
index c0456885..b7e2ddfa 100644
--- a/plugins/jetpack/class.photon.php
+++ b/plugins/jetpack/class.photon.php
@@ -135,7 +135,7 @@ class Jetpack_Photon {
$images = Jetpack_Photon::parse_images_from_html( $content );
if ( ! empty( $images ) ) {
- global $content_width;
+ $content_width = Jetpack::get_content_width();
$image_sizes = self::image_sizes();
$upload_dir = wp_upload_dir();
@@ -309,6 +309,10 @@ class Jetpack_Photon {
// Replace original tag with modified version
$content = str_replace( $tag, $new_tag, $content );
}
+ } elseif ( preg_match( '#^http(s)?://i[\d]{1}.wp.com#', $src ) && ! empty( $images['link_url'][ $index ] ) && self::validate_image_url( $images['link_url'][ $index ] ) ) {
+ $new_tag = preg_replace( '#(href=["|\'])' . $images['link_url'][ $index ] . '(["|\'])#i', '\1' . jetpack_photon_url( $images['link_url'][ $index ] ) . '\2', $tag, 1 );
+
+ $content = str_replace( $tag, $new_tag, $content );
}
}
}
diff --git a/plugins/jetpack/functions.gallery.php b/plugins/jetpack/functions.gallery.php
index 9a9e71b5..fd9319ed 100644
--- a/plugins/jetpack/functions.gallery.php
+++ b/plugins/jetpack/functions.gallery.php
@@ -9,10 +9,10 @@ class Jetpack_Gallery_Settings {
}
function admin_init() {
- $this->gallery_types = apply_filters( 'jetpack_gallery_types', array() );
+ $this->gallery_types = apply_filters( 'jetpack_gallery_types', array( 'default' => __( 'Thumbnail Grid', 'jetpack' ) ) );
// Enqueue the media UI only if needed.
- if ( ! empty( $this->gallery_types ) ) {
+ if ( count( $this->gallery_types ) > 1 ) {
add_action( 'wp_enqueue_media', array( $this, 'wp_enqueue_media' ) );
add_action( 'print_media_templates', array( $this, 'print_media_templates' ) );
}
@@ -32,14 +32,15 @@ class Jetpack_Gallery_Settings {
* Outputs a view template which can be used with wp.media.template
*/
function print_media_templates() {
+ $default_gallery_type = apply_filters( 'jetpack_default_gallery_type', 'default' );
+
?>
<script type="text/html" id="tmpl-jetpack-gallery-settings">
<label class="setting">
<span><?php _e( 'Type', 'jetpack' ); ?></span>
<select class="type" name="type" data-setting="type">
- <option value="default" <?php selected( true ); ?>><?php _e( 'Default', 'jetpack' ); ?></option>
<?php foreach ( $this->gallery_types as $value => $caption ) : ?>
- <option value="<?php echo esc_attr( $value ); ?>"><?php echo esc_html( $caption ); ?></option>
+ <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $default_gallery_type ); ?>><?php echo esc_html( $caption ); ?></option>
<?php endforeach; ?>
</select>
</label>
diff --git a/plugins/jetpack/functions.opengraph.php b/plugins/jetpack/functions.opengraph.php
index 542d01f1..ef610af9 100644
--- a/plugins/jetpack/functions.opengraph.php
+++ b/plugins/jetpack/functions.opengraph.php
@@ -22,14 +22,14 @@ function jetpack_og_tags() {
$og_output = "\n<!-- Jetpack Open Graph Tags -->\n";
$tags = array();
- $image_width = absint( apply_filters( 'jetpack_open_graph_image_width', 200 ) );
- $image_height = absint( apply_filters( 'jetpack_open_graph_image_height', 200 ) );
+ $image_width = absint( apply_filters( 'jetpack_open_graph_image_width', 200 ) );
+ $image_height = absint( apply_filters( 'jetpack_open_graph_image_height', 200 ) );
$description_length = 197;
if ( is_home() || is_front_page() ) {
- $site_type = get_option( 'open_graph_protocol_site_type' );
- $tags['og:type'] = ! empty( $site_type ) ? $site_type : 'blog';
- $tags['og:title'] = get_bloginfo( 'name' );
+ $site_type = get_option( 'open_graph_protocol_site_type' );
+ $tags['og:type'] = ! empty( $site_type ) ? $site_type : 'blog';
+ $tags['og:title'] = get_bloginfo( 'name' );
$tags['og:description'] = get_bloginfo( 'description' );
$front_page_id = get_option( 'page_for_posts' );
@@ -44,13 +44,15 @@ function jetpack_og_tags() {
$tags['fb:admins'] = $facebook_admins;
} else if ( is_author() ) {
- $tags['og:type'] = 'author';
+ $tags['og:type'] = 'profile';
$author = get_queried_object();
- $tags['og:title'] = $author->display_name;
- $tags['og:url'] = get_author_posts_url( $author->ID );
- $tags['og:description'] = $author->description;
+ $tags['og:title'] = $author->display_name;
+ $tags['og:url'] = get_author_posts_url( $author->ID );
+ $tags['og:description'] = $author->description;
+ $tags['profile:first_name'] = get_the_author_meta( 'first_name', $author->ID );
+ $tags['profile:last_name'] = get_the_author_meta( 'last_name', $author->ID );
} else if ( is_singular() ) {
global $post;
@@ -72,7 +74,7 @@ function jetpack_og_tags() {
return;
$tags['og:site_name'] = get_bloginfo( 'name' );
- $tags['og:image'] = jetpack_og_get_image( $image_width, $image_height );
+ $tags['og:image'] = jetpack_og_get_image( $image_width, $image_height );
// Facebook whines if you give it an empty title
if ( empty( $tags['og:title'] ) )
@@ -101,7 +103,7 @@ function jetpack_og_tags() {
echo $og_output;
}
-function jetpack_og_get_image( $width = 50, $height = 50, $max_images = 4 ) { // Facebook requires thumbnails to be a minimum of 50x50
+function jetpack_og_get_image( $width = 200, $height = 200, $max_images = 4 ) { // Facebook requires thumbnails to be a minimum of 200x200
$image = '';
if ( is_singular() && !is_home() && !is_front_page() ) {
diff --git a/plugins/jetpack/functions.photon.php b/plugins/jetpack/functions.photon.php
index fc276b31..bce3b912 100644
--- a/plugins/jetpack/functions.photon.php
+++ b/plugins/jetpack/functions.photon.php
@@ -80,7 +80,7 @@ function jetpack_photon_url( $image_url, $args = array(), $scheme = null ) {
return jetpack_photon_url_scheme( $photon_url, $scheme );
}
-
+add_filter( 'jetpack_photon_url', 'jetpack_photon_url', 10, 3 );
/**
* WordPress.com
@@ -157,4 +157,4 @@ function jetpack_photon_allow_facebook_graph_domain( $allow = false, $domain ) {
}
return $allow;
-} \ No newline at end of file
+}
diff --git a/plugins/jetpack/jetpack.php b/plugins/jetpack/jetpack.php
index 80b6a3ce..7c0fa023 100644
--- a/plugins/jetpack/jetpack.php
+++ b/plugins/jetpack/jetpack.php
@@ -5,7 +5,7 @@
* Plugin URI: http://wordpress.org/extend/plugins/jetpack/
* Description: Bring the power of the WordPress.com cloud to your self-hosted WordPress. Jetpack enables you to connect your blog to a WordPress.com account to use the powerful features normally only available to WordPress.com users.
* Author: Automattic
- * Version: 2.2
+ * Version: 2.3.3
* Author URI: http://jetpack.me
* License: GPL2+
* Text Domain: jetpack
@@ -17,4469 +17,51 @@ define( 'JETPACK__API_VERSION', 1 );
define( 'JETPACK__MINIMUM_WP_VERSION', '3.3' );
defined( 'JETPACK_CLIENT__AUTH_LOCATION' ) or define( 'JETPACK_CLIENT__AUTH_LOCATION', 'header' );
defined( 'JETPACK_CLIENT__HTTPS' ) or define( 'JETPACK_CLIENT__HTTPS', 'AUTO' );
-define( 'JETPACK__VERSION', '2.2' );
+define( 'JETPACK__VERSION', '2.3.3' );
define( 'JETPACK__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) or define( 'JETPACK__GLOTPRESS_LOCALES_PATH', JETPACK__PLUGIN_DIR . 'locales.php' );
define( 'JETPACK_MASTER_USER', true );
-/*
-Options:
-jetpack_options (array)
- An array of options.
- @see Jetpack::get_option_names()
-
-jetpack_register (string)
- Temporary verification secrets.
-
-jetpack_activated (int)
- 1: the plugin was activated normally
- 2: the plugin was activated on this site because of a network-wide activation
- 3: the plugin was auto-installed
- 4: the plugin was manually disconnected (but is still installed)
-
-jetpack_active_modules (array)
- Array of active module slugs.
-
-jetpack_do_activate (bool)
- Flag for "activating" the plugin on sites where the activation hook never fired (auto-installs)
-*/
-
-class Jetpack {
- var $xmlrpc_server = null;
-
- var $HTTP_RAW_POST_DATA = null; // copy of $GLOBALS['HTTP_RAW_POST_DATA']
-
- var $plugins_to_deactivate = array(
- 'stats' => array( 'stats/stats.php', 'WordPress.com Stats' ),
- 'shortlinks' => array( 'stats/stats.php', 'WordPress.com Stats' ),
- 'sharedaddy' => array( 'sharedaddy/sharedaddy.php', 'Sharedaddy' ),
- 'twitter-widget' => array( 'wickett-twitter-widget/wickett-twitter-widget.php', 'Wickett Twitter Widget' ),
- 'after-the-deadline' => array( 'after-the-deadline/after-the-deadline.php', 'After The Deadline' ),
- 'contact-form' => array( 'grunion-contact-form/grunion-contact-form.php', 'Grunion Contact Form' ),
- 'custom-css' => array( 'safecss/safecss.php', 'WordPress.com Custom CSS' ),
- );
-
- var $capability_translations = array(
- 'administrator' => 'manage_options',
- 'editor' => 'edit_others_posts',
- 'author' => 'publish_posts',
- 'contributor' => 'edit_posts',
- 'subscriber' => 'read',
- );
-
- /**
- * Message to display in admin_notice
- * @var string
- */
- var $message = '';
-
- /**
- * Error to display in admin_notice
- * @var string
- */
- var $error = '';
-
- /**
- * Modules that need more privacy description.
- * @var string
- */
- var $privacy_checks = '';
-
- /**
- * Stats to record once the page loads
- *
- * @var array
- */
- var $stats = array();
-
- /**
- * Jetpack_Sync object
- */
- var $sync;
-
- /**
- * Verified data for JSON authorization request
- */
- var $json_api_authorization_request = array();
-
- /**
- * Singleton
- * @static
- */
- public static function init() {
- static $instance = false;
-
- if ( !$instance ) {
- load_plugin_textdomain( 'jetpack', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
- $instance = new Jetpack;
-
- $instance->plugin_upgrade();
- }
-
- return $instance;
- }
-
- /**
- * Must never be called statically
- */
- function plugin_upgrade() {
- // Upgrade: 1.1 -> 1.2
- if ( get_option( 'jetpack_id' ) ) {
- // Move individual jetpack options to single array of options
- $options = array();
- foreach ( Jetpack::get_option_names() as $option ) {
- if ( false !== $value = get_option( "jetpack_$option" ) ) {
- $options[$option] = $value;
- }
- }
-
- if ( $options ) {
- Jetpack::update_options( $options );
-
- foreach ( array_keys( $options ) as $option ) {
- delete_option( "jetpack_$option" );
- }
- }
-
- // Add missing version and old_version options
- if ( !$version = Jetpack::get_option( 'version' ) ) {
- $version = $old_version = '1.1:' . time();
- Jetpack::update_options( compact( 'version', 'old_version' ) );
- }
- }
-
- // Upgrade from a single user token to a user_id-indexed array and a master_user ID
- if ( !Jetpack::get_option( 'user_tokens' ) ) {
- if ( $user_token = Jetpack::get_option( 'user_token' ) ) {
- $token_parts = explode( '.', $user_token );
- if ( isset( $token_parts[2] ) ) {
- $master_user = $token_parts[2];
- $user_tokens = array( $master_user => $user_token );
- Jetpack::update_options( compact( 'master_user', 'user_tokens' ) );
- Jetpack::delete_option( 'user_token' );
- } else {
- // @todo: is this even possible?
- trigger_error( sprintf( 'Jetpack::plugin_upgrade found no user_id in user_token "%s"', $user_token ), E_USER_WARNING );
- }
- }
- }
- }
-
- /**
- * Constructor. Initializes WordPress hooks
- */
- function Jetpack() {
- $this->sync = new Jetpack_Sync;
-
- // Modules should do Jetpack_Sync::sync_options( __FILE__, $option, ... ); instead
- // We access the "internal" method here only because the Jetpack object isn't instantiated yet
- $this->sync->options( __FILE__,
- 'home',
- 'siteurl',
- 'blogname',
- 'gmt_offset',
- 'timezone_string'
- );
-
- if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST && isset( $_GET['for'] ) && 'jetpack' == $_GET['for'] ) {
- @ini_set( 'display_errors', false ); // Display errors can cause the XML to be not well formed.
-
- require_once dirname( __FILE__ ) . '/class.jetpack-xmlrpc-server.php';
- $this->xmlrpc_server = new Jetpack_XMLRPC_Server();
-
- $this->require_jetpack_authentication();
-
- if ( Jetpack::is_active() ) {
- // Hack to preserve $HTTP_RAW_POST_DATA
- add_filter( 'xmlrpc_methods', array( $this, 'xmlrpc_methods' ) );
-
- // The actual API methods.
- add_filter( 'xmlrpc_methods', array( $this->xmlrpc_server, 'xmlrpc_methods' ) );
- } else {
- // The bootstrap API methods.
- add_filter( 'xmlrpc_methods', array( $this->xmlrpc_server, 'bootstrap_xmlrpc_methods' ) );
- }
-
- // Now that no one can authenticate, and we're whitelisting all XML-RPC methods, force enable_xmlrpc on.
- add_filter( 'pre_option_enable_xmlrpc', '__return_true' );
- } elseif ( is_admin() && isset( $_POST['action'] ) && 'jetpack_upload_file' == $_POST['action'] ) {
- $this->require_jetpack_authentication();
- $this->add_remote_request_handlers();
- } else {
- if ( Jetpack::is_active() ) {
- add_action( 'login_form_jetpack_json_api_authorization', array( &$this, 'login_form_json_api_authorization' ) );
- }
- }
-
- add_action( 'jetpack_clean_nonces', array( 'Jetpack', 'clean_nonces' ) );
- if ( !wp_next_scheduled( 'jetpack_clean_nonces' ) ) {
- wp_schedule_event( time(), 'hourly', 'jetpack_clean_nonces' );
- }
-
- add_filter( 'xmlrpc_blog_options', array( $this, 'xmlrpc_options' ) );
-
- add_action( 'admin_menu', array( $this, 'admin_menu' ) );
- add_action( 'admin_init', array( $this, 'admin_init' ) );
- add_action( 'admin_init', array( $this, 'dismiss_jetpack_notice' ) );
-
- add_action( 'wp_ajax_jetpack-check-news-subscription', array( $this, 'check_news_subscription' ) );
- add_action( 'wp_ajax_jetpack-subscribe-to-news', array( $this, 'subscribe_to_news' ) );
-
- add_action( 'wp_loaded', array( $this, 'register_assets' ) );
- add_action( 'wp_enqueue_scripts', array( $this, 'devicepx' ) );
- add_action( 'customize_controls_enqueue_scripts', array( $this, 'devicepx' ) );
- add_action( 'admin_enqueue_scripts', array( $this, 'devicepx' ) );
-
- add_action( 'jetpack_activate_module', array( $this, 'activate_module_actions' ) );
-
- add_action( 'plugins_loaded', array( $this, 'check_open_graph' ), 999 );
- }
-
- function require_jetpack_authentication() {
- // Don't let anyone authenticate
- $_COOKIE = array();
- remove_all_filters( 'authenticate' );
-
- if ( Jetpack::is_active() ) {
- // Allow Jetpack authentication
- add_filter( 'authenticate', array( $this, 'authenticate_jetpack' ), 10, 3 );
- }
- }
-
- /**
- * Register assets for use in various modules and the Jetpack admin page.
- *
- * @uses wp_script_is, wp_register_script, plugins_url
- * @action wp_loaded
- * @return null
- */
- public function register_assets() {
- if ( ! wp_script_is( 'spin', 'registered' ) )
- wp_register_script( 'spin', plugins_url( '_inc/spin.js', __FILE__ ), false, '1.2.4' );
-
- if ( ! wp_script_is( 'jquery.spin', 'registered' ) )
- wp_register_script( 'jquery.spin', plugins_url( '_inc/jquery.spin.js', __FILE__ ) , array( 'jquery', 'spin' ) );
-
- if ( ! wp_script_is( 'jetpack-gallery-settings', 'registered' ) )
- wp_register_script( 'jetpack-gallery-settings', plugins_url( '_inc/gallery-settings.js', __FILE__ ), array( 'media-views' ), '20121225' );
- }
-
- /**
- * Device Pixels support
- * This improves the resolution of gravatars and wordpress.com uploads on hi-res and zoomed browsers.
- */
- function devicepx() {
- wp_enqueue_script( 'devicepx', ( is_ssl() ? 'https' : 'http' ) . '://s0.wp.com/wp-content/js/devicepx-jetpack.js', array(), gmdate('oW'), true );
- }
-
- /**
- * Is Jetpack active?
- */
- public static function is_active() {
- return (bool) Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
- }
-
- /**
- * Is a given user (or the current user if none is specified) linked to a WordPress.com user?
- */
- public static function is_user_connected( $user_id = false ) {
- $user_id = false === $user_id ? get_current_user_id() : absint( $user_id );
- if ( !$user_id ) {
- return false;
- }
- return (bool) Jetpack_Data::get_access_token( $user_id );
- }
-
- function current_user_is_connection_owner() {
- $user_token = Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
- return $user_token && is_object( $user_token ) && isset( $user_token->external_user_id ) && get_current_user_id() === $user_token->external_user_id;
- }
-
- /**
- * Synchronize connected user role changes
- */
- function user_role_change( $user_id ) {
- if ( Jetpack::is_active() && Jetpack::is_user_connected( $user_id ) ) {
-
- $current_user_id = get_current_user_id();
- wp_set_current_user( $user_id );
- $role = $this->translate_current_user_to_role();
- $signed_role = $this->sign_role( $role );
- wp_set_current_user( $current_user_id );
-
- $master_token = Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
- $master_user_id = absint( $master_token->external_user_id );
-
- if ( !$master_user_id )
- return; // this shouldn't happen
-
- Jetpack::xmlrpc_async_call( 'jetpack.updateRole', $user_id, $signed_role );
- //@todo retry on failure
-
- //try to choose a new master if we're demoting the current one
- if ( $user_id == $master_user_id && 'administrator' != $role ) {
- $query = new WP_User_Query( array(
- 'fields' => array( 'id' ),
- 'role' => 'administrator',
- 'orderby' => 'id',
- 'exclude' => array( $master_user_id ),
- )
- );
- $new_master = false;
- foreach ( $query->results as $result ) {
- $uid = absint( $result->id );
- if ( $uid && Jetpack::is_user_connected( $uid ) ) {
- $new_master = $uid;
- break;
- }
- }
-
- if ( $new_master ) {
- Jetpack::update_option( 'master_user', $new_master );
- }
- // else disconnect..?
- }
- }
- }
-
- /**
- * Loads the currently active modules.
- */
- public static function load_modules() {
- if ( !Jetpack::is_active() ) {
- return;
- }
-
- $version = Jetpack::get_option( 'version' );
- if ( !$version ) {
- $version = $old_version = JETPACK__VERSION . ':' . time();
- Jetpack::update_options( compact( 'version', 'old_version' ) );
- }
- list( $version ) = explode( ':', $version );
-
- $modules = array_filter( Jetpack::get_active_modules(), array( 'Jetpack', 'is_module' ) );
-
- // Don't load modules that have had "Major" changes since the stored version until they have been deactivated/reactivated through the lint check.
- if ( version_compare( $version, JETPACK__VERSION, '<' ) ) {
- $updated_modules = array();
- foreach ( $modules as $module ) {
- $module_data = Jetpack::get_module( $module );
- if ( !isset( $module_data['changed'] ) ) {
- continue;
- }
-
- if ( version_compare( $module_data['changed'], $version, '<=' ) ) {
- continue;
- }
-
- $updated_modules[] = $module;
- }
-
- $modules = array_diff( $modules, $updated_modules );
- }
-
- foreach ( $modules as $module ) {
- if ( did_action( 'jetpack_module_loaded_' . $module ) ) {
- continue;
- }
- require Jetpack::get_module_path( $module );
- do_action( 'jetpack_module_loaded_' . $module );
- }
-
- do_action( 'jetpack_modules_loaded' );
-
- // Load module-specific code that is needed even when a module isn't active. Loaded here because code contained therein may need actions such as setup_theme.
- require_once( dirname( __FILE__ ) . '/modules/module-extras.php' );
- }
-
- /**
- * Check if Jetpack's Open Graph tags should be used.
- * If certain plugins are active, Jetpack's og tags are suppressed.
- *
- * @uses Jetpack::get_active_modules, add_filter, get_option, apply_filters
- * @action plugins_loaded
- * @return null
- */
- public function check_open_graph() {
- if ( in_array( 'publicize', Jetpack::get_active_modules() ) || in_array( 'sharedaddy', Jetpack::get_active_modules() ) )
- add_filter( 'jetpack_enable_open_graph', '__return_true', 0 );
-
- $active_plugins = get_option( 'active_plugins', array() );
-
- $conflicting_plugins = array(
- 'facebook/facebook.php', // Official Facebook plugin
- 'wordpress-seo/wp-seo.php', // WordPress SEO by Yoast
- 'add-link-to-facebook/add-link-to-facebook.php', // Add Link to Facebook
- 'facebook-awd/AWD_facebook.php', // Facebook AWD All in one
- 'header-footer/plugin.php', // Header and Footer
- 'nextgen-facebook/nextgen-facebook.php', // NextGEN Facebook OG
- 'seo-facebook-comments/seofacebook.php', // SEO Facebook Comments
- 'seo-ultimate/seo-ultimate.php', // SEO Ultimate
- 'sexybookmarks/sexy-bookmarks.php', // Shareaholic
- 'shareaholic/sexy-bookmarks.php', // Shareaholic
- 'social-discussions/social-discussions.php', // Social Discussions
- 'social-networks-auto-poster-facebook-twitter-g/NextScripts_SNAP.php', // NextScripts SNAP
- 'wordbooker/wordbooker.php', // Wordbooker
- 'socialize/socialize.php', // Socialize
- 'simple-facebook-connect/sfc.php', // Simple Facebook Connect
- 'social-sharing-toolkit/social_sharing_toolkit.php', // Social Sharing Toolkit
- 'wp-facebook-open-graph-protocol/wp-facebook-ogp.php', // WP Facebook Open Graph protocol
- 'opengraph/opengraph.php', // Open Graph
- 'sharepress/sharepress.php', // SharePress
- );
-
- foreach ( $conflicting_plugins as $plugin ) {
- if ( in_array( $plugin, $active_plugins ) ) {
- add_filter( 'jetpack_enable_open_graph', '__return_false', 99 );
- break;
- }
- }
-
- if ( apply_filters( 'jetpack_enable_open_graph', false ) )
- require_once dirname( __FILE__ ) . '/functions.opengraph.php';
- }
-
-/* Jetpack Options API */
-
- public static function get_option_names( $type = 'compact' ) {
- switch ( $type ) {
- case 'non-compact' :
- case 'non_compact' :
- return array(
- 'register',
- 'activated',
- 'active_modules',
- 'do_activate',
- 'publicize',
- 'widget_twitter',
- );
- }
-
- return array(
- 'id', // (int) The Client ID/WP.com Blog ID of this site.
- 'blog_token', // (string) The Client Secret/Blog Token of this site.
- 'user_token', // (string) The User Token of this site. (deprecated)
- 'publicize_connections', // (array) An array of Publicize connections from WordPress.com
- 'master_user', // (int) The local User ID of the user who connected this site to jetpack.wordpress.com.
- 'user_tokens', // (array) User Tokens for each user of this site who has connected to jetpack.wordpress.com.
- 'version', // (string) Used during upgrade procedure to auto-activate new modules. version:time
- 'old_version', // (string) Used to determine which modules are the most recently added. previous_version:time
- 'fallback_no_verify_ssl_certs', // (int) Flag for determining if this host must skip SSL Certificate verification due to misconfigured SSL.
- 'time_diff', // (int) Offset between Jetpack server's clocks and this server's clocks. Jetpack Server Time = time() + (int) Jetpack::get_option( 'time_diff' )
- 'public', // (int|bool) If we think this site is public or not (1, 0), false if we haven't yet tried to figure it out.
- );
- }
-
- /**
- * Returns the requested option. Looks in jetpack_options or jetpack_$name as appropriate.
- *
- * @param string $name Option name
- * @param mixed $default (optional)
- */
- public static function get_option( $name, $default = false ) {
- if ( in_array( $name, Jetpack::get_option_names( 'non_compact' ) ) ) {
- return get_option( "jetpack_$name" );
- } else if ( !in_array( $name, Jetpack::get_option_names() ) ) {
- trigger_error( sprintf( 'Invalid Jetpack option name: %s', $name ), E_USER_WARNING );
- return false;
- }
-
- $options = get_option( 'jetpack_options' );
- if ( is_array( $options ) && isset( $options[$name] ) ) {
- return $options[$name];
- }
-
- return $default;
- }
-
- /**
- * Stores two secrets and a timestamp so WordPress.com can make a request back and verify an action
- * Does some extra verification so urls (such as those to public-api, register, etc) cant just be crafted
- * $name must be a registered option name.
- */
- public static function create_nonce( $name ) {
- $secret = wp_generate_password( 32, false ) . ':' . wp_generate_password( 32, false ) . ':' . ( time() + 600 );
-
- Jetpack::update_option( $name, $secret );
- @list( $secret_1, $secret_2, $eol ) = explode( ':', Jetpack::get_option( $name ) );
- if ( empty( $secret_1 ) || empty( $secret_2 ) || $eol < time() )
- return new Jetpack_Error( 'missing_secrets' );
-
- return array(
- 'secret_1' => $secret_1,
- 'secret_2' => $secret_2,
- 'eol' => $eol,
- );
- }
-
- /**
- * Updates the single given option. Updates jetpack_options or jetpack_$name as appropriate.
- *
- * @param string $name Option name
- * @param mixed $value Option value
- */
- public static function update_option( $name, $value ) {
- if ( in_array( $name, Jetpack::get_option_names( 'non_compact' ) ) ) {
- return update_option( "jetpack_$name", $value );
- } else if ( !in_array( $name, Jetpack::get_option_names() ) ) {
- trigger_error( sprintf( 'Invalid Jetpack option name: %s', $name ), E_USER_WARNING );
- return false;
- }
-
- $options = get_option( 'jetpack_options' );
- if ( !is_array( $options ) ) {
- $options = array();
- }
-
- $options[$name] = $value;
-
- return update_option( 'jetpack_options', $options );
- }
-
- /**
- * Updates the multiple given options. Updates jetpack_options and/or jetpack_$name as appropriate.
- *
- * @param array $array array( option name => option value, ... )
- */
- public static function update_options( $array ) {
- $names = array_keys( $array );
-
- foreach ( array_diff( $names, Jetpack::get_option_names(), Jetpack::get_option_names( 'non_compact' ) ) as $unknown_name ) {
- trigger_error( sprintf( 'Invalid Jetpack option name: %s', $unknown_name ), E_USER_WARNING );
- unset( $array[$unknown_name] );
- }
-
- foreach ( array_intersect( $names, Jetpack::get_option_names( 'non_compact' ) ) as $name ) {
- update_option( "jetpack_$name", $array[$name] );
- unset( $array[$name] );
- }
-
- $options = get_option( 'jetpack_options' );
- if ( !is_array( $options ) ) {
- $options = array();
- }
-
- return update_option( 'jetpack_options', array_merge( $options, $array ) );
- }
-
- /**
- * Deletes the given option. May be passed multiple option names as an array.
- * Updates jetpack_options and/or deletes jetpack_$name as appropriate.
- *
- * @param string|array $names
- */
- public static function delete_option( $names ) {
- $names = (array) $names;
-
- foreach ( array_diff( $names, Jetpack::get_option_names(), Jetpack::get_option_names( 'non_compact' ) ) as $unknown_name ) {
- trigger_error( sprintf( 'Invalid Jetpack option name: %s', $unknown_name ), E_USER_WARNING );
- }
-
- foreach ( array_intersect( $names, Jetpack::get_option_names( 'non_compact' ) ) as $name ) {
- delete_option( "jetpack_$name" );
- }
-
- $options = get_option( 'jetpack_options' );
- if ( !is_array( $options ) ) {
- $options = array();
- }
-
- $to_delete = array_intersect( $names, Jetpack::get_option_names(), array_keys( $options ) );
- if ( $to_delete ) {
- foreach ( $to_delete as $name ) {
- unset( $options[$name] );
- }
-
- return update_option( 'jetpack_options', $options );
- }
-
- return true;
- }
-
- /**
- * Enters a user token into the user_tokens option
- *
- * @param int $user_id
- * @param string $token
- * return bool
- */
- public static function update_user_token( $user_id, $token, $is_master_user ) {
- // not designed for concurrent updates
- $user_tokens = Jetpack::get_option( 'user_tokens' );
- if ( ! is_array( $user_tokens ) )
- $user_tokens = array();
- $user_tokens[$user_id] = $token;
- if ( $is_master_user ) {
- $master_user = $user_id;
- $options = compact('user_tokens', 'master_user');
- } else {
- $options = compact('user_tokens');
- }
- return Jetpack::update_options( $options );
- }
-
- /**
- * Returns an array of all PHP files in the specified absolute path.
- * Equivalent to glob( "$absolute_path/*.php" ).
- *
- * @param string $absolute_path The absolute path of the directory to search.
- * @return array Array of absolute paths to the PHP files.
- */
- public static function glob_php( $absolute_path ) {
- $absolute_path = untrailingslashit( $absolute_path );
- $files = array();
- if ( !$dir = @opendir( $absolute_path ) ) {
- return $files;
- }
-
- while ( false !== $file = readdir( $dir ) ) {
- if ( '.' == substr( $file, 0, 1 ) || '.php' != substr( $file, -4 ) ) {
- continue;
- }
-
- $file = "$absolute_path/$file";
-
- if ( !is_file( $file ) ) {
- continue;
- }
-
- $files[] = $file;
- }
-
- closedir( $dir );
-
- return $files;
- }
-
- public function activate_new_modules() {
- if ( ! Jetpack::is_active() ) {
- return;
- }
-
- $jetpack_old_version = Jetpack::get_option( 'version' ); // [sic]
- if ( !$jetpack_old_version ) {
- $jetpack_old_version = $version = $old_version = '1.1:' . time();
- Jetpack::update_options( compact( 'version', 'old_version' ) );
- }
-
- list( $jetpack_version ) = explode( ':', $jetpack_old_version ); // [sic]
-
- if ( version_compare( JETPACK__VERSION, $jetpack_version, '<=' ) ) {
- return;
- }
-
- $active_modules = Jetpack::get_active_modules();
- $reactivate_modules = array();
- foreach ( $active_modules as $active_module ) {
- $module = Jetpack::get_module( $active_module );
- if ( !isset( $module['changed'] ) ) {
- continue;
- }
-
- if ( version_compare( $module['changed'], $jetpack_version, '<=' ) ) {
- continue;
- }
-
- $reactivate_modules[] = $active_module;
- Jetpack::deactivate_module( $active_module );
- }
-
- if ( version_compare( $jetpack_version, '1.9.2', '<' ) && version_compare( '1.9-something', JETPACK__VERSION, '<' ) ) {
- add_action( 'jetpack_activate_default_modules', array( $this->sync, 'sync_all_registered_options' ), 1000 );
- }
-
- Jetpack::update_options( array(
- 'version' => JETPACK__VERSION . ':' . time(),
- 'old_version' => $jetpack_old_version,
- ) );
-
- Jetpack::state( 'message', 'modules_activated' );
- Jetpack::activate_default_modules( $jetpack_version, JETPACK__VERSION, $reactivate_modules );
- wp_safe_redirect( Jetpack::admin_url() );
- exit;
- }
-
- /**
- * List available Jetpack modules. Simply lists .php files in /modules/.
- * Make sure to tuck away module "library" files in a sub-directory.
- */
- public static function get_available_modules( $min_version = false, $max_version = false ) {
- static $modules = null;
-
- if ( !isset( $modules ) ) {
- $files = Jetpack::glob_php( dirname( __FILE__ ) . '/modules' );
-
- $modules = array();
-
- foreach ( $files as $file ) {
- if ( !$headers = Jetpack::get_module( $file ) ) {
- continue;
- }
-
- $modules[ Jetpack::get_module_slug( $file ) ] = $headers['introduced'];
- }
- }
-
- if ( !$min_version && !$max_version ) {
- return array_keys( $modules );
- }
-
- $r = array();
- foreach ( $modules as $slug => $introduced ) {
- if ( $min_version && version_compare( $min_version, $introduced, '>=' ) ) {
- continue;
- }
-
- if ( $max_version && version_compare( $max_version, $introduced, '<' ) ) {
- continue;
- }
-
- $r[] = $slug;
- }
-
- return $r;
- }
-
- /**
- * Default modules loaded on activation.
- */
- public static function get_default_modules( $min_version = false, $max_version = false ) {
- $return = array();
-
- foreach ( Jetpack::get_available_modules( $min_version, $max_version ) as $module ) {
- // Add special cases here for modules to avoid auto-activation
- switch ( $module ) {
-
- // These modules are default off: they change things blog-side
- case 'comments' :
- case 'carousel' :
- case 'minileven':
- case 'infinite-scroll' :
- case 'photon' :
- case 'tiled-gallery' :
- case 'likes' :
- break;
-
- // These modules are default off if we think the site is a private one
- case 'enhanced-distribution' :
- case 'json-api' :
- if ( !Jetpack::get_option( 'public' ) ) {
- break;
- }
- // else no break
- // The rest are default on
- default :
- $return[] = $module;
- }
- }
-
- return $return;
- }
-
- /**
- * Extract a module's slug from its full path.
- */
- public static function get_module_slug( $file ) {
- return str_replace( '.php', '', basename( $file ) );
- }
-
- /**
- * Generate a module's path from its slug.
- */
- public static function get_module_path( $slug ) {
- return dirname( __FILE__ ) . "/modules/$slug.php";
- }
-
- /**
- * Load module data from module file. Headers differ from WordPress
- * plugin headers to avoid them being identified as standalone
- * plugins on the WordPress plugins page.
- */
- public static function get_module( $module ) {
- $headers = array(
- 'name' => 'Module Name',
- 'description' => 'Module Description',
- 'sort' => 'Sort Order',
- 'introduced' => 'First Introduced',
- 'changed' => 'Major Changes In',
- 'deactivate' => 'Deactivate',
- 'free' => 'Free',
- );
-
- $file = Jetpack::get_module_path( Jetpack::get_module_slug( $module ) );
- if ( !file_exists( $file ) )
- return false;
-
- $mod = get_file_data( $file, $headers );
- if ( empty( $mod['name'] ) )
- return false;
-
- $mod['name'] = translate( $mod['name'], 'jetpack' );
- $mod['description'] = translate( $mod['description'], 'jetpack' );
- if ( empty( $mod['sort'] ) )
- $mod['sort'] = 10;
- $mod['deactivate'] = empty( $mod['deactivate'] );
- $mod['free'] = empty( $mod['free'] );
- return $mod;
- }
-
- /**
- * Get a list of activated modules as an array of module slugs.
- */
- public static function get_active_modules() {
- $active = Jetpack::get_option( 'active_modules' );
- if ( !is_array( $active ) )
- $active = array();
- if ( is_admin() ) {
- $active[] = 'vaultpress';
- } else {
- $active = array_diff( $active, array( 'vaultpress' ) );
- }
- return array_unique( $active );
- }
-
- public static function is_module( $module ) {
- return !empty( $module ) && !validate_file( $module, Jetpack::get_available_modules() );
- }
-
- /**
- * Catches PHP errors. Must be used in conjunction with output buffering.
- *
- * @param bool $catch True to start catching, False to stop.
- *
- * @static
- */
- public static function catch_errors( $catch ) {
- static $display_errors, $error_reporting;
-
- if ( $catch ) {
- $display_errors = @ini_set( 'display_errors', 1 );
- $error_reporting = @error_reporting( E_ALL );
- add_action( 'shutdown', array( 'Jetpack', 'catch_errors_on_shutdown' ), 0 );
- } else {
- @ini_set( 'display_errors', $display_errors );
- @error_reporting( $error_reporting );
- remove_action( 'shutdown', array( 'Jetpack', 'catch_errors_on_shutdown' ), 1 );
- }
- }
-
- /**
- * Saves any generated PHP errors in ::state( 'php_errors', {errors} )
- */
- public static function catch_errors_on_shutdown() {
- Jetpack::state( 'php_errors', ob_get_clean() );
- }
-
- public static function activate_default_modules( $min_version = false, $max_version = false, $other_modules = array() ) {
- $jetpack = Jetpack::init();
-
- $modules = Jetpack::get_default_modules( $min_version, $max_version );
- $modules = array_merge( $other_modules, $modules );
-
- // Look for standalone plugins and disable if active.
-
- $to_deactivate = array();
- foreach ( $modules as $module ) {
- if ( isset( $jetpack->plugins_to_deactivate[$module] ) ) {
- $to_deactivate[$module] = $jetpack->plugins_to_deactivate[$module];
- }
- }
-
- $deactivated = array();
- foreach ( $to_deactivate as $module => $deactivate_me ) {
- list( $probable_file, $probable_title ) = $deactivate_me;
- if ( Jetpack_Client_Server::deactivate_plugin( $probable_file, $probable_title ) ) {
- $deactivated[] = $module;
- }
- }
-
- if ( $deactivated ) {
- Jetpack::state( 'deactivated_plugins', join( ',', $deactivated ) );
-
- $url = add_query_arg( array(
- 'action' => 'activate_default_modules',
- '_wpnonce' => wp_create_nonce( 'activate_default_modules' ),
- ), add_query_arg( compact( 'min_version', 'max_version', 'other_modules' ), Jetpack::admin_url() ) );
- wp_safe_redirect( $url );
- exit;
- }
-
- do_action( 'jetpack_before_activate_default_modules', $min_version, $max_version, $other_modules );
-
- // Check each module for fatal errors, a la wp-admin/plugins.php::activate before activating
- $redirect = menu_page_url( 'jetpack', false );
- Jetpack::restate();
- Jetpack::catch_errors( true );
- foreach ( $modules as $module ) {
- $active = Jetpack::get_active_modules();
- if ( in_array( $module, $active ) ) {
- $module_info = Jetpack::get_module( $module );
- if ( !$module_info['deactivate'] ) {
- $state = in_array( $module, $other_modules ) ? 'reactivated_modules' : 'activated_modules';
- if ( $active_state = Jetpack::state( $state ) ) {
- $active_state = explode( ',', $active_state );
- } else {
- $active_state = array();
- }
- $active_state[] = $module;
- Jetpack::state( $state, implode( ',', $active_state ) );
- }
- continue;
- }
-
- $file = Jetpack::get_module_path( $module );
- if ( !file_exists( $file ) ) {
- continue;
- }
-
- // we'll override this later if the plugin can be included without fatal error
- wp_safe_redirect( Jetpack::admin_url() );
- Jetpack::state( 'error', 'module_activation_failed' );
- Jetpack::state( 'module', $module );
- ob_start();
- require $file;
- do_action( 'jetpack_activate_module', $module );
- $active[] = $module;
- $state = in_array( $module, $other_modules ) ? 'reactivated_modules' : 'activated_modules';
- if ( $active_state = Jetpack::state( $state ) ) {
- $active_state = explode( ',', $active_state );
- } else {
- $active_state = array();
- }
- $active_state[] = $module;
- Jetpack::state( $state, implode( ',', $active_state ) );
- Jetpack::update_option( 'active_modules', array_unique( $active ) );
- ob_end_clean();
- }
- Jetpack::state( 'error', false );
- Jetpack::state( 'module', false );
- Jetpack::catch_errors( false );
- do_action( 'jetpack_activate_default_modules', $min_version, $max_version, $other_modules );
- }
-
- public static function activate_module( $module ) {
- $jetpack = Jetpack::init();
-
- if ( !Jetpack::is_active() )
- return false;
-
- if ( !strlen( $module ) )
- return false;
-
- if ( !Jetpack::is_module( $module ) )
- return false;
-
- // If it's already active, then don't do it again
- $active = Jetpack::get_active_modules();
- foreach ( $active as $act ) {
- if ( $act == $module )
- return true;
- }
-
- // Check and see if the old plugin is active
- if ( isset( $jetpack->plugins_to_deactivate[$module] ) ) {
- // Deactivate the old plugin
- if ( Jetpack_Client_Server::deactivate_plugin( $jetpack->plugins_to_deactivate[$module][0], $jetpack->plugins_to_deactivate[$module][1] ) ) {
- // If we deactivated the old plugin, remembere that with ::state() and redirect back to this page to activate the module
- // We can't activate the module on this page load since the newly deactivated old plugin is still loaded on this page load.
- Jetpack::state( 'deactivated_plugins', $module );
- wp_safe_redirect( add_query_arg( 'jetpack_restate', 1 ) );
- exit;
- }
- }
-
- // Check the file for fatal errors, a la wp-admin/plugins.php::activate
- Jetpack::state( 'module', $module );
- Jetpack::state( 'error', 'module_activation_failed' ); // we'll override this later if the plugin can be included without fatal error
- wp_safe_redirect( Jetpack::admin_url() );
-
- Jetpack::catch_errors( true );
- ob_start();
- require Jetpack::get_module_path( $module );
- do_action( 'jetpack_activate_module', $module );
- $active[] = $module;
- Jetpack::update_option( 'active_modules', array_unique( $active ) );
- Jetpack::state( 'error', false ); // the override
- Jetpack::state( 'message', 'module_activated' );
- Jetpack::state( 'module', $module );
- ob_end_clean();
- Jetpack::catch_errors( false );
- exit;
- }
-
- function activate_module_actions( $module ) {
- do_action( "jetpack_activate_module_$module" );
-
- $this->sync->sync_all_module_options( $module );
- }
-
- public static function deactivate_module( $module ) {
- $active = Jetpack::get_active_modules();
- $new = array();
- foreach ( $active as $check ) {
- if ( !empty( $check ) && $module != $check )
- $new[] = $check;
- }
-
- do_action( "jetpack_deactivate_module_$module" );
- return Jetpack::update_option( 'active_modules', array_unique( $new ) );
- }
-
- public static function enable_module_configurable( $module ) {
- $module = Jetpack::get_module_slug( $module );
- add_filter( 'jetpack_module_configurable_' . $module, '__return_true' );
- }
-
- public static function module_configuration_url( $module ) {
- $module = Jetpack::get_module_slug( $module );
- return Jetpack::admin_url( array( 'configure' => $module ) );
- }
-
- public static function module_configuration_load( $module, $method ) {
- $module = Jetpack::get_module_slug( $module );
- add_action( 'jetpack_module_configuration_load_' . $module, $method );
- }
-
- public static function module_configuration_head( $module, $method ) {
- $module = Jetpack::get_module_slug( $module );
- add_action( 'jetpack_module_configuration_head_' . $module, $method );
- }
-
- public static function module_configuration_screen( $module, $method ) {
- $module = Jetpack::get_module_slug( $module );
- add_action( 'jetpack_module_configuration_screen_' . $module, $method );
- }
-
-/* Installation */
-
- public static function bail_on_activation( $message, $deactivate = true ) {
-?>
-<!doctype html>
-<html>
-<head>
-<meta charset="<?php bloginfo( 'charset' ); ?>">
-<style>
-* {
- text-align: center;
- margin: 0;
- padding: 0;
- font-family: "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;
-}
-p {
- margin-top: 1em;
- font-size: 18px;
-}
-</style>
-<body>
-<p><?php echo esc_html( $message ); ?></p>
-</body>
-</html>
-<?php
- if ( $deactivate ) {
- $plugins = get_option( 'active_plugins' );
- $jetpack = plugin_basename( __FILE__ );
- $update = false;
- foreach ( $plugins as $i => $plugin ) {
- if ( $plugin === $jetpack ) {
- $plugins[$i] = false;
- $update = true;
- }
- }
-
- if ( $update ) {
- update_option( 'active_plugins', array_filter( $plugins ) );
- }
- }
- exit;
- }
-
- /**
- * Attached to activate_{ plugin_basename( __FILES__ ) } by register_activation_hook()
- * @static
- */
- public static function plugin_activation( $network_wide ) {
- Jetpack::update_option( 'activated', 1 );
-
- if ( version_compare( $GLOBALS['wp_version'], JETPACK__MINIMUM_WP_VERSION, '<' ) ) {
- Jetpack::bail_on_activation( sprintf( __( 'Jetpack requires WordPress version %s or later.', 'jetpack' ), JETPACK__MINIMUM_WP_VERSION ) );
- }
-
- if ( $network_wide )
- Jetpack::state( 'network_nag', true );
-
- Jetpack::plugin_initialize();
- }
-
- /**
- * Sets the internal version number and activation state.
- * @static
- */
- public static function plugin_initialize() {
- if ( !Jetpack::get_option( 'activated' ) ) {
- Jetpack::update_option( 'activated', 2 );
- }
-
- if ( !Jetpack::get_option( 'version' ) ) {
- $version = $old_version = JETPACK__VERSION . ':' . time();
- Jetpack::update_options( compact( 'version', 'old_version' ) );
- }
-
- Jetpack::load_modules();
-
- Jetpack::delete_option( 'do_activate' );
- }
-
- /**
- * Removes all connection options
- * @static
- */
- public static function plugin_deactivation( $network_wide ) {
- Jetpack::disconnect( false );
- }
-
- /**
- * Disconnects from the Jetpack servers.
- * Forgets all connection details and tells the Jetpack servers to do the same.
- * @static
- */
- public static function disconnect( $update_activated_state = true ) {
- wp_clear_scheduled_hook( 'jetpack_clean_nonces' );
- Jetpack::clean_nonces( true );
-
- Jetpack::load_xml_rpc_client();
- $xml = new Jetpack_IXR_Client();
- $xml->query( 'jetpack.deregister' );
-
- Jetpack::delete_option( array(
- 'register',
- 'blog_token',
- 'user_token',
- 'user_tokens',
- 'master_user',
- 'time_diff',
- 'fallback_no_verify_ssl_certs',
- ) );
-
- if ( $update_activated_state ) {
- Jetpack::update_option( 'activated', 4 );
- }
- }
-
- /**
- * Unlinks the current user from the linked WordPress.com user
- */
- function unlink_user() {
- if ( !$tokens = Jetpack::get_option( 'user_tokens' ) )
- return false;
-
- $user_id = get_current_user_id();
-
- if ( Jetpack::get_option( 'master_user' ) == $user_id )
- return false;
-
- if ( !isset( $tokens[$user_id] ) )
- return false;
-
- Jetpack::load_xml_rpc_client();
- $xml = new Jetpack_IXR_Client( compact( 'user_id' ) );
- $xml->query( 'jetpack.unlink_user', $user_id );
-
- unset( $tokens[$user_id] );
-
- Jetpack::update_option( 'user_tokens', $tokens );
-
- return true;
- }
-
- /**
- * Attempts Jetpack registration. If it fail, a state flag is set: @see ::admin_page_load()
- */
- public static function try_registration() {
- $result = Jetpack::register();
-
- // If there was an error with registration and the site was not registered, record this so we can show a message.
- if ( !$result || is_wp_error( $result ) ) {
- return $result;
- } else {
- return true;
- }
- }
-
-/* Admin Pages */
-
- function admin_init() {
- // If the plugin is not connected, display a connect message.
- if (
- // the plugin was auto-activated and needs its candy
- Jetpack::get_option( 'do_activate' )
- ||
- // the plugin is active, but was never activated. Probably came from a site-wide network activation
- !Jetpack::get_option( 'activated' )
- ) {
- Jetpack::plugin_initialize();
- }
-
- if ( !Jetpack::is_active() ) {
- if ( 4 != Jetpack::get_option( 'activated' ) ) {
- // Show connect notice on dashboard and plugins pages
- add_action( 'load-index.php', array( $this, 'prepare_connect_notice' ) );
- add_action( 'load-plugins.php', array( $this, 'prepare_connect_notice' ) );
- }
- } elseif ( false === Jetpack::get_option( 'fallback_no_verify_ssl_certs' ) ) {
- // Upgrade: 1.1 -> 1.1.1
- // Check and see if host can verify the Jetpack servers' SSL certificate
- $args = array();
- Jetpack_Client::_wp_remote_request(
- Jetpack::fix_url_for_bad_hosts( Jetpack::api_url( 'test' ), $args ),
- $args,
- true
- );
- }
-
- add_action( 'load-plugins.php', array( $this, 'intercept_plugin_error_scrape_init' ) );
- add_action( 'admin_head', array( $this, 'admin_menu_css' ) );
- add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
-
- add_action( 'wp_ajax_jetpack_debug', array( $this, 'ajax_debug' ) );
-
- if ( Jetpack::is_active() ) {
- // Artificially throw errors in certain whitelisted cases during plugin activation
- add_action( 'activate_plugin', array( $this, 'throw_error_on_activate_plugin' ) );
-
- // Kick off synchronization of user role when it changes
- add_action( 'set_user_role', array( $this, 'user_role_change' ) );
-
- // Add retina images hotfix to admin
- global $wp_db_version;
- if ( $wp_db_version > 19470 ) {
- // WP 3.4.x
- // TODO will need to add && $wp_db_version < xxxxx when 3.5 comes out.
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_retina_scripts' ) );
- // /wp-admin/customize.php omits the action above.
- add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_retina_scripts' ) );
- }
- }
- }
-
- function prepare_connect_notice() {
- add_action( 'admin_print_styles', array( $this, 'admin_styles' ) );
-
- add_action( 'admin_notices', array( $this, 'admin_connect_notice' ) );
-
- if ( Jetpack::state( 'network_nag' ) )
- add_action( 'network_admin_notices', array( $this, 'network_connect_notice' ) );
- }
-
- /**
- * Sometimes a plugin can activate without causing errors, but it will cause errors on the next page load.
- * This function artificially throws errors for such cases (whitelisted).
- *
- * @param string $plugin The activated plugin.
- */
- function throw_error_on_activate_plugin( $plugin ) {
- $active_modules = Jetpack::get_active_modules();
-
- // The Shortlinks module and the Stats plugin conflict, but won't cause errors on activation because of some function_exists() checks.
- if ( function_exists( 'stats_get_api_key' ) && in_array( 'shortlinks', $active_modules ) ) {
- $throw = false;
-
- // Try and make sure it really was the stats plugin
- if ( !class_exists( 'ReflectionFunction' ) ) {
- if ( 'stats.php' == basename( $plugin ) ) {
- $throw = true;
- }
- } else {
- $reflection = new ReflectionFunction( 'stats_get_api_key' );
- if ( basename( $plugin ) == basename( $reflection->getFileName() ) ) {
- $throw = true;
- }
- }
-
- if ( $throw ) {
- trigger_error( sprintf( __( 'Jetpack contains the most recent version of the old &#8220;%1$s&#8221; plugin.', 'jetpack' ), 'WordPress.com Stats' ), E_USER_ERROR );
- }
- }
- }
-
- function intercept_plugin_error_scrape_init() {
- add_action( 'check_admin_referer', array( $this, 'intercept_plugin_error_scrape' ), 10, 2 );
- }
-
- function intercept_plugin_error_scrape( $action, $result ) {
- if ( !$result ) {
- return;
- }
-
- foreach ( $this->plugins_to_deactivate as $module => $deactivate_me ) {
- if ( "plugin-activation-error_{$deactivate_me[0]}" == $action ) {
- Jetpack::bail_on_activation( sprintf( __( 'Jetpack contains the most recent version of the old &#8220;%1$s&#8221; plugin.', 'jetpack' ), $deactivate_me[1] ), false );
- }
- }
- }
-
- function admin_menu() {
- list( $jetpack_version ) = explode( ':', Jetpack::get_option( 'version' ) );
- if (
- $jetpack_version
- &&
- $jetpack_version != JETPACK__VERSION
- &&
- ( $new_modules = Jetpack::get_default_modules( $jetpack_version, JETPACK__VERSION ) )
- &&
- is_array( $new_modules )
- &&
- ( $new_modules_count = count( $new_modules ) )
- &&
- Jetpack::is_active()
- ) {
- $new_modules_count_i18n = number_format_i18n( $new_modules_count );
- $span_title = esc_attr( sprintf( _n( 'One New Jetpack Module', '%s New Jetpack Modules', $new_modules_count, 'jetpack' ), $new_modules_count_i18n ) );
- $title = sprintf( 'Jetpack %s', "<span class='update-plugins count-{$new_modules_count}' title='$span_title'><span class='update-count'>$new_modules_count_i18n</span></span>" );
- } else {
- $title = __( 'Jetpack', 'jetpack' );
- }
-
- $hook = add_menu_page( 'Jetpack', $title, 'read', 'jetpack', array( $this, 'admin_page' ), 'div' );
-
- add_action( "load-$hook", array( $this, 'admin_page_load' ) );
-
- if ( version_compare( $GLOBALS['wp_version'], '3.3', '<' ) ) {
- if ( isset( $_GET['page'] ) && 'jetpack' == $_GET['page'] ) {
- add_contextual_help( $hook, $this->jetpack_help() );
- }
- } else {
- add_action( "load-$hook", array( $this, 'admin_help' ) );
- }
- add_action( "admin_head-$hook", array( $this, 'admin_head' ) );
- add_filter( 'custom_menu_order', array( $this, 'admin_menu_order' ) );
- add_filter( 'menu_order', array( $this, 'jetpack_menu_order' ) );
-
- add_action( "admin_print_styles-$hook", array( $this, 'admin_styles' ) );
-
- add_action( "admin_print_scripts-$hook", array( $this, 'admin_scripts' ) );
-
- do_action( 'jetpack_admin_menu' );
- }
-
- function add_remote_request_handlers() {
- add_action( 'wp_ajax_nopriv_jetpack_upload_file', array( $this, 'remote_request_handlers' ) );
- }
-
- function remote_request_handlers() {
- switch ( current_filter() ) {
- case 'wp_ajax_nopriv_jetpack_upload_file' :
- $response = $this->upload_handler();
- break;
- default :
- $response = new Jetpack_Error( 'unknown_handler', 'Unknown Handler', 400 );
- break;
- }
-
- if ( !$response ) {
- $response = new Jetpack_Error( 'unknown_error', 'Unknown Error', 400 );
- }
-
- if ( is_wp_error( $response ) ) {
- $status_code = $response->get_error_data();
- $error = $response->get_error_code();
- $error_description = $response->get_error_message();
-
- if ( !is_int( $status_code ) ) {
- $status_code = 400;
- }
-
- status_header( $status_code );
- die( json_encode( (object) compact( 'error', 'error_description' ) ) );
- }
-
- status_header( 200 );
- if ( true === $response ) {
- exit;
- }
-
- die( json_encode( (object) $response ) );
- }
-
- function upload_handler() {
- if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
- return new Jetpack_Error( 405, get_status_header_desc( 405 ), 405 );
- }
-
- $user = wp_authenticate( '', '' );
- if ( !$user || is_wp_error( $user ) ) {
- return new Jetpack_Error( 403, get_status_header_desc( 403 ), 403 );
- }
-
- wp_set_current_user( $user->ID );
-
- if ( !current_user_can( 'upload_files' ) ) {
- return new Jetpack_Error( 'cannot_upload_files', 'User does not have permission to upload files', 403 );
- }
-
- if ( empty( $_FILES ) ) {
- return new Jetpack_Error( 'no_files_uploaded', 'No files were uploaded: nothing to process', 400 );
- }
-
- foreach ( array_keys( $_FILES ) as $files_key ) {
- if ( !isset( $_POST["_jetpack_file_hmac_{$files_key}"] ) ) {
- return new Jetpack_Error( 'missing_hmac', 'An HMAC for one or more files is missing', 400 );
- }
- }
-
- $media_keys = array_keys( $_FILES['media'] );
-
- $token = Jetpack_Data::get_access_token( get_current_user_id() );
- if ( !$token || is_wp_error( $token ) ) {
- return new Jetpack_Error( 'unknown_token', 'Unknown Jetpack token', 403 );
- }
-
- $uploaded_files = array();
- $global_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] : null;
- unset( $GLOBALS['post'] );
- foreach ( $_FILES['media']['name'] as $index => $name ) {
- $file = array();
- foreach ( $media_keys as $media_key ) {
- $file[$media_key] = $_FILES['media'][$media_key][$index];
- }
-
- list( $hmac_provided, $salt ) = explode( ':', $_POST['_jetpack_file_hmac_media'][$index] );
-
- $hmac_file = hash_hmac_file( 'sha1', $file['tmp_name'], $salt . $token->secret );
- if ( $hmac_provided !== $hmac_file ) {
- $uploaded_files[$index] = (object) array( 'error' => 'invalid_hmac', 'error_description' => 'The corresponding HMAC for this file does not match' );
- continue;
- }
-
- $_FILES['.jetpack.upload.'] = $file;
- $post_id = isset( $_POST['post_id'][$index] ) ? absint( $_POST['post_id'][$index] ) : 0;
- if ( !current_user_can( 'edit_post', $post_id ) ) {
- $post_id = 0;
- }
- $attachment_id = media_handle_upload( '.jetpack.upload.', $post_id, array(), array(
- 'action' => 'jetpack_upload_file',
- ) );
-
- if ( !$attachment_id ) {
- $uploaded_files[$index] = (object) array( 'error' => 'unknown', 'error_description' => 'An unknown problem occurred processing the upload on the Jetpack site' );
- } elseif ( is_wp_error( $attachment_id ) ) {
- $uploaded_files[$index] = (object) array( 'error' => 'attachment_' . $attachment_id->get_error_code(), 'error_description' => $attachment_id->get_error_message() );
- } else {
- $attachment = get_post( $attachment_id );
- $uploaded_files[$index] = (object) array(
- 'id' => (string) $attachment_id,
- 'file' => $attachment->post_title,
- 'url' => wp_get_attachment_url( $attachment_id ),
- 'type' => $attachment->post_mime_type,
- 'meta' => wp_get_attachment_metadata( $attachment_id ),
- );
- }
- }
- if ( !is_null( $global_post ) ) {
- $GLOBALS['post'] = $global_post;
- }
-
- return $uploaded_files;
- }
-
- /**
- * Add help to the Jetpack page
- *
- * Deprecated. Remove when Jetpack requires WP 3.3+
- */
- function jetpack_help() {
- return
- '<p><strong>' . __( 'Jetpack by WordPress.com', 'jetpack' ) . '</strong></p>' .
- '<p>' . __( 'Jetpack supercharges your self-hosted WordPress site with the awesome cloud power of WordPress.com.', 'jetpack' ) . '</p>' .
- '<p>' . __( 'On this page, you are able to view the modules available within Jetpack, learn more about them, and activate or deactivate them as needed.', 'jetpack' ) . '</p>' .
- '<p><strong>' . __( 'Jetpack Module Options', 'jetpack' ) . '</strong></p>' .
- '<p>' . __( '<strong>To Activate/Deactivate a Module</strong> - Click on Learn More. An Activate or Deactivate button will now appear next to the Learn More button. Click the Activate/Deactivate button.', 'jetpack' ) . '</p>' .
- '<p><strong>' . __( 'For more information:', 'jetpack' ) . '</strong></p>' .
- '<p><a href="http://jetpack.me/faq/" target="_blank">' . __( 'Jetpack FAQ', 'jetpack' ) . '</a></p>' .
- '<p><a href="http://jetpack.me/support/" target="_blank">' . __( 'Jetpack Support', 'jetpack' ) . '</a></p>';
- }
-
- /**
- * Add help to the Jetpack page
- *
- * @since Jetpack (1.2.3)
- * @return false if not the Jetpack page
- */
- function admin_help() {
- $current_screen = get_current_screen();
-
- // Overview
- $current_screen->add_help_tab( array(
- 'id' => 'overview',
- 'title' => __( 'Overview', 'jetpack' ),
- 'content' =>
- '<p><strong>' . __( 'Jetpack by WordPress.com', 'jetpack' ) . '</strong></p>' .
- '<p>' . __( 'Jetpack supercharges your self-hosted WordPress site with the awesome cloud power of WordPress.com.', 'jetpack' ) . '</p>' .
- '<p>' . __( 'On this page, you are able to view the modules available within Jetpack, learn more about them, and activate or deactivate them as needed.', 'jetpack' ) . '</p>'
- ) );
-
- // Screen Content
- if ( current_user_can( 'manage_options' ) ) {
- $current_screen->add_help_tab( array(
- 'id' => 'modules',
- 'title' => __( 'Modules', 'jetpack' ),
- 'content' =>
- '<p><strong>' . __( 'Jetpack by WordPress.com', 'jetpack' ) . '</strong></p>' .
- '<p>' . __( 'You can activate or deactivate individual Jetpack modules to suit your needs.', 'jetpack' ) . '</p>' .
- '<ol>' .
- '<li>' . __( 'Find the component you want to manage', 'jetpack' ) . '</li>' .
- '<li>' . __( 'Click on Learn More', 'jetpack' ) . '</li>' .
- '<li>' . __( 'An Activate or Deactivate button will appear', 'jetpack' ) . '</li>' .
- '<li>' . __( 'If additional settings are available, a link to them will appear', 'jetpack' ) . '</li>' .
- '</ol>'
- ) );
- }
-
- // Help Sidebar
- $current_screen->set_help_sidebar(
- '<p><strong>' . __( 'For more information:', 'jetpack' ) . '</strong></p>' .
- '<p><a href="http://jetpack.me/faq/" target="_blank">' . __( 'Jetpack FAQ', 'jetpack' ) . '</a></p>' .
- '<p><a href="http://jetpack.me/support/" target="_blank">' . __( 'Jetpack Support', 'jetpack' ) . '</a></p>'
- );
- }
-
- function admin_menu_css() { ?>
- <style type="text/css" id="jetpack-menu-css">
- #toplevel_page_jetpack .wp-menu-image {
- background: url( <?php echo plugins_url( basename( dirname( __FILE__ ) ) . '/_inc/images/menuicon-sprite.png' ) ?> ) 0 90% no-repeat;
- }
- /* Retina Jetpack Menu Icon */
- @media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- #toplevel_page_jetpack .wp-menu-image {
- background: url( <?php echo plugins_url( basename( dirname( __FILE__ ) ) . '/_inc/images/menuicon-sprite-2x.png' ) ?> ) 0 90% no-repeat;
- background-size:30px 64px;
- }
- }
- #toplevel_page_jetpack.current .wp-menu-image,
- #toplevel_page_jetpack.wp-has-current-submenu .wp-menu-image,
- #toplevel_page_jetpack:hover .wp-menu-image {
- background-position: top left;
- }
- </style><?php
- }
-
- function admin_menu_order() {
- return true;
- }
-
- function jetpack_menu_order( $menu_order ) {
- $jp_menu_order = array();
-
- foreach ( $menu_order as $index => $item ) {
- if ( $item != 'jetpack' )
- $jp_menu_order[] = $item;
-
- if ( $index == 0 )
- $jp_menu_order[] = 'jetpack';
- }
-
- return $jp_menu_order;
- }
-
- function admin_head() {
- if ( isset( $_GET['configure'] ) && Jetpack::is_module( $_GET['configure'] ) && current_user_can( 'manage_options' ) )
- do_action( 'jetpack_module_configuration_head_' . $_GET['configure'] );
- }
-
- function admin_styles() {
- global $wp_styles;
- wp_enqueue_style( 'jetpack', plugins_url( basename( dirname( __FILE__ ) ) . '/_inc/jetpack.css' ), false, JETPACK__VERSION . '-20121016' );
- $wp_styles->add_data( 'jetpack', 'rtl', true );
- }
-
- function admin_scripts() {
- wp_enqueue_script( 'jetpack-js', plugins_url( basename( dirname( __FILE__ ) ) ) . '/_inc/jetpack.js', array( 'jquery' ), JETPACK__VERSION . '-20121111' );
- wp_localize_script( 'jetpack-js', 'jetpackL10n', array(
- 'ays_disconnect' => "This will deactivate all Jetpack modules.\nAre you sure you want to disconnect?",
- 'ays_unlink' => "This will prevent user-specific modules such as Publicize, Notifications and Post By Email from working.\nAre you sure you want to unlink?",
- 'ays_dismiss' => "This will deactivate Jetpack.\nAre you sure you want to deactivate Jetpack?",
- ) );
- add_action( 'admin_footer', array( $this, 'do_stats' ) );
- }
-
- function enqueue_retina_scripts() {
- wp_enqueue_style( 'jetpack-retina', plugins_url( basename( dirname( __FILE__ ) ) . '/_inc/jetpack-retina.css' ), false, JETPACK__VERSION . '-20120730' );
- }
-
- function plugin_action_links( $actions ) {
- return array_merge(
- array( 'settings' => sprintf( '<a href="%s">%s</a>', Jetpack::admin_url(), __( 'Settings', 'jetpack' ) ) ),
- $actions
- );
- return $actions;
- }
-
- function admin_connect_notice() {
- // Don't show the connect notice on the jetpack settings page. @todo: must be a better way?
- if ( false !== strpos( $_SERVER['QUERY_STRING'], 'page=jetpack' ) )
- return;
-
- if ( !current_user_can( 'manage_options' ) )
- return;
- ?>
-
- <div id="message" class="updated jetpack-message jp-connect">
- <div id="jp-dismiss" class="jetpack-close-button-container">
- <a class="jetpack-close-button" href="?page=jetpack&jetpack-notice=dismiss" title="<?php _e( 'Dismiss this notice and deactivate Jetpack.', 'jetpack' ); ?>"><?php _e( 'Dismiss this notice and deactivate Jetpack.', 'jetpack' ); ?></a>
- </div>
- <div class="jetpack-wrap-container">
- <div class="jetpack-text-container">
- <h4>
- <?php if ( 1 == Jetpack::get_option( 'activated' ) ) : ?>
- <p><?php _e( '<strong>Your Jetpack is almost ready</strong> &#8211; A connection to WordPress.com is needed to enable features like Stats, Contact Forms, and Subscriptions. Connect now to get fueled up!', 'jetpack' ); ?></p>
- <?php else : ?>
- <p><?php _e( '<strong>Jetpack is installed</strong> and ready to bring awesome, WordPress.com cloud-powered features to your site.', 'jetpack' ) ?></p>
- <?php endif; ?>
- </h4>
- </div>
- <div class="jetpack-install-container">
- <?php if ( 1 == Jetpack::get_option( 'activated' ) ) : ?>
- <p class="submit"><a href="<?php echo $this->build_connect_url() ?>" class="button-connector" id="wpcom-connect"><?php _e( 'Connect to WordPress.com', 'jetpack' ); ?></a></p>
- <?php else : ?>
- <p class="submit"><a href="<?php echo Jetpack::admin_url() ?>" class="button-connector" id="wpcom-connect"><?php _e( 'Learn More', 'jetpack' ); ?></a></p>
- <?php endif; ?>
- </div>
- </div>
- </div>
-
- <?php
- }
-
- function network_connect_notice() {
- ?>
- <div id="message" class="updated jetpack-message">
- <div class="squeezer">
- <h4><?php _e( '<strong>Jetpack is activated!</strong> Each site on your network must be connected individually by an admin on that site.', 'jetpack' ) ?></h4>
- </div>
- </div>
- <?php
- }
-
- public static function jetpack_comment_notice() {
- if ( in_array( 'comments', Jetpack::get_active_modules() ) ) {
- return '';
- }
-
- $jetpack_old_version = explode( ':', Jetpack::get_option( 'old_version' ) );
- $jetpack_new_version = explode( ':', Jetpack::get_option( 'version' ) );
-
- if ( $jetpack_old_version ) {
- if ( version_compare( $jetpack_old_version[0], '1.4', '>=' ) ) {
- return '';
- }
- }
-
- if ( $jetpack_new_version ) {
- if ( version_compare( $jetpack_new_version[0], '1.4-something', '<' ) ) {
- return '';
- }
- }
-
- return '<br /><br />' . sprintf(
- __( 'Jetpack now includes Jetpack Comments, which enables your visitors to use their WordPress.com, Twitter, or Facebook accounts when commenting on your site. To activate Jetpack Comments, <a href="%s">%s</a>.', 'jetpack' ),
- wp_nonce_url(
- Jetpack::admin_url( array(
- 'action' => 'activate',
- 'module' => 'comments',
- ) ),
- "jetpack_activate-comments"
- ),
- __( 'click here', 'jetpack' )
- );
- }
-
- /*
- * Registration flow:
- * 1 - ::admin_page_load() action=register
- * 2 - ::try_registration()
- * 3 - ::register()
- * - Creates jetpack_register option containing two secrets and a timestamp
- * - Calls https://jetpack.wordpress.com/jetpack.register/1/ with
- * siteurl, home, gmt_offset, timezone_string, site_name, secret_1, secret_2, site_lang, timeout, stats_id
- * - That request to jetpack.wordpress.com does not immediately respond. It first makes a request BACK to this site's
- * xmlrpc.php?for=jetpack: RPC method: jetpack.verifyRegistration, Parameters: secret_1
- * - The XML-RPC request verifies secret_1, deletes both secrets and responds with: secret_2
- * - https://jetpack.wordpress.com/jetpack.register/1/ verifies that XML-RPC response (secret_2) then finally responds itself with
- * jetpack_id, jetpack_secret, jetpack_public
- * - ::register() then stores jetpack_options: id => jetpack_id, blog_token => jetpack_secret
- * 4 - redirect to https://jetpack.wordpress.com/jetpack.authorize/1/
- * 5 - user logs in with WP.com account
- * 6 - redirect to this site's wp-admin/index.php?page=jetpack&action=authorize with
- * code <-- OAuth2 style authorization code
- * 7 - ::admin_page_load() action=authorize
- * 8 - Jetpack_Client_Server::authorize()
- * 9 - Jetpack_Client_Server::get_token()
- * 10- GET https://jetpack.wordpress.com/jetpack.token/1/ with
- * client_id, client_secret, grant_type, code, redirect_uri:action=authorize, state, scope, user_email, user_login
- * 11- which responds with
- * access_token, token_type, scope
- * 12- Jetpack_Client_Server::authorize() stores jetpack_options: user_token => access_token.$user_id
- * 13- Jetpack::activate_default_modules()
- * Deactivates deprecated plugins
- * Activates all default modules
- * Catches errors: redirects to wp-admin/index.php?page=jetpack state:error=something
- * 14- redirect to this site's wp-admin/index.php?page=jetpack with state:message=authorized
- * Done!
- */
-
- /**
- * Handles the page load events for the Jetpack admin page
- */
- function admin_page_load() {
- $error = false;
-
- if ( !empty( $_GET['jetpack_restate'] ) ) {
- // Should only be used in intermediate redirects to preserve state across redirects
- Jetpack::restate();
- }
-
- if ( isset( $_GET['connect_url_redirect'] ) ) {
- // User clicked in the iframe to link their accounts
- if ( ! Jetpack::is_user_connected() ) {
- $connect_url = $this->build_connect_url( true );
- if ( isset( $_GET['notes_iframe'] ) )
- $connect_url .= '&notes_iframe';
- wp_redirect( $connect_url );
- exit;
- } else {
- Jetpack::state( 'message', 'already_authorized' );
- wp_safe_redirect( Jetpack::admin_url() );
- exit;
- }
- }
-
- if ( isset( $_GET['action'] ) ) {
- switch ( $_GET['action'] ) {
- case 'authorize' :
- if ( Jetpack::is_active() && Jetpack::is_user_connected() ) {
- Jetpack::state( 'message', 'already_authorized' );
- wp_safe_redirect( Jetpack::admin_url() );
- exit;
- }
- $client_server = new Jetpack_Client_Server;
- $client_server->authorize();
- exit;
- case 'register' :
- check_admin_referer( 'jetpack-register' );
- $registered = Jetpack::try_registration();
- if ( is_wp_error( $registered ) ) {
- $error = $registered->get_error_code();
- Jetpack::state( 'error_description', $registered->get_error_message() );
- break;
- }
-
- wp_redirect( $this->build_connect_url( true ) );
- exit;
- case 'activate' :
- $module = stripslashes( $_GET['module'] );
- check_admin_referer( "jetpack_activate-$module" );
- Jetpack::activate_module( $module );
- wp_safe_redirect( Jetpack::admin_url() );
- exit;
- case 'activate_default_modules' :
- check_admin_referer( 'activate_default_modules' );
- Jetpack::restate();
- $min_version = isset( $_GET['min_version'] ) ? $_GET['min_version'] : false;
- $max_version = isset( $_GET['max_version'] ) ? $_GET['max_version'] : false;
- $other_modules = isset( $_GET['other_modules'] ) && is_array( $_GET['other_modules'] ) ? $_GET['other_modules'] : array();
- Jetpack::activate_default_modules( $min_version, $max_version, $other_modules );
- wp_safe_redirect( Jetpack::admin_url() );
- exit;
- case 'disconnect' :
- check_admin_referer( 'jetpack-disconnect' );
- Jetpack::disconnect();
- wp_safe_redirect( Jetpack::admin_url() );
- exit;
- case 'deactivate' :
- $modules = stripslashes( $_GET['module'] );
- check_admin_referer( "jetpack_deactivate-$modules" );
- foreach ( explode( ',', $modules ) as $module ) {
- Jetpack::deactivate_module( $module );
- Jetpack::state( 'message', 'module_deactivated' );
- }
- Jetpack::state( 'module', $modules );
- wp_safe_redirect( Jetpack::admin_url() );
- exit;
- case 'unlink' :
- check_admin_referer( 'jetpack-unlink' );
- $this->unlink_user();
- Jetpack::state( 'message', 'unlinked' );
- wp_safe_redirect( Jetpack::admin_url() );
- exit;
- }
- }
-
- if ( !$error = $error ? $error : Jetpack::state( 'error' ) ) {
- $this->activate_new_modules();
- }
-
- switch ( $error ) {
- case 'access_denied' :
- $this->error = __( 'You need to authorize the Jetpack connection between your site and WordPress.com to enable the awesome features.', 'jetpack' );
- break;
- case 'wrong_state' :
- $this->error = __( "Don&#8217;t cross the streams! You need to stay logged in to your WordPress blog while you authorize Jetpack.", 'jetpack' );
- break;
- case 'invalid_client' :
- // @todo re-register instead of deactivate/reactivate
- $this->error = __( 'Return to sender. Whoops! It looks like you got the wrong Jetpack in the mail; deactivate then reactivate the Jetpack plugin to get a new one.', 'jetpack' );
- break;
- case 'invalid_grant' :
- $this->error = __( "Wrong size. Hm&#8230; it seems your Jetpack doesn&#8217;t quite fit. Have you lost weight? Click &#8220;Connect to WordPress.com&#8221; again to get your Jetpack adjusted.", 'jetpack' );
- break;
- case 'site_inaccessible' :
- case 'site_requires_authorization' :
- $this->error = sprintf( __( 'Your website needs to be publicly accessible to use Jetpack: %s', 'jetpack' ), "<code>$error</code>" );
- break;
- case 'module_activation_failed' :
- $module = Jetpack::state( 'module' );
- if ( !empty( $module ) && $mod = Jetpack::get_module( $module ) ) {
- $this->error = sprintf( __( '%s could not be activated because it triggered a <strong>fatal error</strong>. Perhaps there is a conflict with another plugin you have installed?', 'jetpack' ), $mod['name'] );
- if ( isset( $this->plugins_to_deactivate[$module] ) ) {
- $this->error .= ' ' . sprintf( __( 'Do you still have the %s plugin installed?', 'jetpack' ), $this->plugins_to_deactivate[$module][1] );
- }
- } else {
- $this->error = __( 'Module could not be activated because it triggered a <strong>fatal error</strong>. Perhaps there is a conflict with another plugin you have installed?', 'jetpack' );
- }
- if ( $php_errors = Jetpack::state( 'php_errors' ) ) {
- $this->error .= "<br />\n";
- $this->error .= $php_errors;
- }
- break;
- case 'not_public' :
- $this->error = __( "<strong>Your Jetpack has a glitch.</strong> Connecting this site with WordPress.com is not possible. This usually means your site is not publicly accessible (localhost).", 'jetpack' );
- break;
- case 'wpcom_408' :
- case 'wpcom_5??' :
- case 'wpcom_bad_response' :
- case 'wpcom_outage' :
- $this->error = __( 'WordPress.com is currently having problems and is unable to fuel up your Jetpack. Please try again later.', 'jetpack' );
- break;
- case 'register_http_request_failed' :
- case 'token_http_request_failed' :
- $this->error = sprintf( __( 'Jetpack could not contact WordPress.com: %s. This usually means something is incorrectly configured on your web host.', 'jetpack' ), "<code>$error</code>" );
- break;
- default :
- if ( empty( $error ) ) {
- break;
- }
- $error = trim( substr( strip_tags( $error ), 0, 20 ) );
- // no break: fall through
- case 'no_role' :
- case 'no_cap' :
- case 'no_code' :
- case 'no_state' :
- case 'invalid_state' :
- case 'invalid_request' :
- case 'invalid_scope' :
- case 'unsupported_response_type' :
- case 'invalid_token' :
- case 'no_token' :
- case 'missing_secrets' :
- case 'home_missing' :
- case 'siteurl_missing' :
- case 'gmt_offset_missing' :
- case 'site_name_missing' :
- case 'secret_1_missing' :
- case 'secret_2_missing' :
- case 'site_lang_missing' :
- case 'home_malformed' :
- case 'siteurl_malformed' :
- case 'gmt_offset_malformed' :
- case 'timezone_string_malformed' :
- case 'site_name_malformed' :
- case 'secret_1_malformed' :
- case 'secret_2_malformed' :
- case 'site_lang_malformed' :
- case 'secrets_mismatch' :
- case 'verify_secret_1_missing' :
- case 'verify_secret_1_malformed' :
- case 'verify_secrets_missing' :
- case 'verify_secrets_mismatch' :
- $error = esc_html( $error );
- $this->error = sprintf( __( "<strong>Your Jetpack has a glitch.</strong> Something went wrong that&#8217;s never supposed to happen. Guess you&#8217;re just lucky: %s", 'jetpack' ), "<code>$error</code>" );
- if ( !Jetpack::is_active() ) {
- $this->error .= '<br />';
- $this->error .= sprintf( __( 'Try connecting again.', 'jetpack' ) );
- }
- break;
- }
-
- $message_code = Jetpack::state( 'message' );
-
- $active_state = Jetpack::state( 'activated_modules' );
- if ( !empty( $active_state ) ) {
- $available = Jetpack::get_available_modules();
- $active_state = explode( ',', $active_state );
- $active_state = array_intersect( $active_state, $available );
- if ( count( $active_state ) ) {
- foreach ( $active_state as $mod ) {
- $this->stat( 'module-activated', $mod );
- }
- } else {
- $active_state = false;
- }
- }
-
- switch ( $message_code ) {
- case 'modules_activated' :
- $this->message = sprintf(
- __( 'Welcome to <strong>Jetpack %s</strong>!', 'jetpack' ),
- JETPACK__VERSION
- );
-
- if ( $active_state ) {
- $titles = array();
- foreach ( $active_state as $mod ) {
- if ( $mod_headers = Jetpack::get_module( $mod ) ) {
- $titles[] = '<strong>' . preg_replace( '/\s+(?![^<>]++>)/', '&nbsp;', $mod_headers['name'] ) . '</strong>';
- }
- }
- if ( $titles ) {
- $this->message .= '<br /><br />' . wp_sprintf( __( 'The following new modules have been activated: %l.', 'jetpack' ), $titles );
- }
- }
-
- if ( $reactive_state = Jetpack::state( 'reactivated_modules' ) ) {
- $titles = array();
- foreach ( explode( ',', $reactive_state ) as $mod ) {
- if ( $mod_headers = Jetpack::get_module( $mod ) ) {
- $titles[] = '<strong>' . preg_replace( '/\s+(?![^<>]++>)/', '&nbsp;', $mod_headers['name'] ) . '</strong>';
- }
- }
- if ( $titles ) {
- $this->message .= '<br /><br />' . wp_sprintf( __( 'The following modules have been updated: %l.', 'jetpack' ), $titles );
- }
- }
-
- $this->message .= Jetpack::jetpack_comment_notice();
- break;
-
- case 'module_activated' :
- if ( $module = Jetpack::get_module( Jetpack::state( 'module' ) ) ) {
- $this->message = sprintf( __( '<strong>%s Activated!</strong> You can deactivate at any time by clicking Learn More and then Deactivate on the module card.', 'jetpack' ), $module['name'] );
- $this->stat( 'module-activated', Jetpack::state( 'module' ) );
- }
- break;
-
- case 'module_deactivated' :
- $modules = Jetpack::state( 'module' );
- if ( !$modules ) {
- break;
- }
-
- $module_names = array();
- foreach ( explode( ',', $modules ) as $module_slug ) {
- $module = Jetpack::get_module( $module_slug );
- if ( $module ) {
- $module_names[] = $module['name'];
- }
-
- $this->stat( 'module-deactivated', $module_slug );
- }
-
- if ( !$module_names ) {
- break;
- }
-
- $this->message = wp_sprintf(
- _nx(
- '<strong>%l Deactivated!</strong> You can activate it again at any time using the activate button on the module card.',
- '<strong>%l Deactivated!</strong> You can activate them again at any time using the activate buttons on their module cards.',
- count( $module_names ),
- '%l = list of Jetpack module/feature names',
- 'jetpack'
- ),
- $module_names
- );
- break;
-
- case 'module_configured' :
- $this->message = __( '<strong>Module settings were saved.</strong> ', 'jetpack' );
- break;
-
- case 'already_authorized' :
- $this->message = __( '<strong>Your Jetpack is already connected.</strong> ', 'jetpack' );
- break;
-
- case 'authorized' :
- $this->message = __( "<strong>You&#8217;re fueled up and ready to go.</strong> ", 'jetpack' );
- $this->message .= "<br />\n";
- $this->message .= __( 'The features below are now active. Click the learn more buttons to explore each feature.', 'jetpack' );
- $this->message .= Jetpack::jetpack_comment_notice();
- break;
-
- case 'linked' :
- $this->message = __( "<strong>You&#8217;re fueled up and ready to go.</strong> ", 'jetpack' );
- $this->message .= Jetpack::jetpack_comment_notice();
- break;
-
- case 'unlinked' :
- $user = wp_get_current_user();
- $this->message = sprintf( __( '<strong>You have unlinked your account (%s) from WordPress.com.</strong>', 'jetpack' ), $user->user_login );
- break;
- }
-
- $deactivated_plugins = Jetpack::state( 'deactivated_plugins' );
-
- if ( !empty( $deactivated_plugins ) ) {
- $deactivated_plugins = explode( ',', $deactivated_plugins );
- $deactivated_titles = array();
- foreach ( $deactivated_plugins as $deactivated_plugin ) {
- if ( !isset( $this->plugins_to_deactivate[$deactivated_plugin] ) ) {
- continue;
- }
-
- $deactivated_titles[] = '<strong>' . str_replace( ' ', '&nbsp;', $this->plugins_to_deactivate[$deactivated_plugin][1] ) . '</strong>';
- }
-
- if ( $deactivated_titles ) {
- if ( $this->message ) {
- $this->message .= "<br /><br />\n";
- }
-
- $this->message .= wp_sprintf( _n(
- 'Jetpack contains the most recent version of the old %l plugin.',
- 'Jetpack contains the most recent versions of the old %l plugins.',
- count( $deactivated_titles ),
- 'jetpack'
- ), $deactivated_titles );
-
- $this->message .= "<br />\n";
-
- $this->message .= _n(
- 'The old version has been deactivated and can be removed from your site.',
- 'The old versions have been deactivated and can be removed from your site.',
- count( $deactivated_titles ),
- 'jetpack'
- );
- }
- }
-
- $this->privacy_checks = Jetpack::state( 'privacy_checks' );
-
- if ( $this->message || $this->error || $this->privacy_checks ) {
- add_action( 'jetpack_notices', array( $this, 'admin_notices' ) );
- }
-
- if ( isset( $_GET['configure'] ) && Jetpack::is_module( $_GET['configure'] ) && current_user_can( 'manage_options' ) ) {
- do_action( 'jetpack_module_configuration_load_' . $_GET['configure'] );
- }
-
- add_filter( 'jetpack_short_module_description', 'wptexturize' );
- }
-
- function admin_notices() {
-
- if ( $this->error ) {
-?>
-<div id="message" class="jetpack-message jetpack-err">
- <div class="squeezer">
- <h4><?php echo wp_kses( $this->error, array( 'code' => true, 'strong' => true, 'br' => true, 'b' => true ) ); ?></h4>
-<?php if ( $desc = Jetpack::state( 'error_description' ) ) : ?>
- <p><?php echo esc_html( stripslashes( $desc ) ); ?></p>
-<?php endif; ?>
- </div>
-</div>
-<?php
- }
-
- if ( $this->message ) {
-?>
-<div id="message" class="jetpack-message">
- <div class="squeezer">
- <h4><?php echo wp_kses( $this->message, array( 'strong' => array(), 'a' => array( 'href' => true ), 'br' => true ) ); ?></h4>
- </div>
-</div>
-<?php
-
- }
-
- if ( $this->privacy_checks ) :
- $module_names = $module_slugs = array();
-
- $privacy_checks = explode( ',', $this->privacy_checks );
- foreach ( $privacy_checks as $module_slug ) {
- $module = Jetpack::get_module( $module_slug );
- if ( !$module ) {
- continue;
- }
-
- $module_slugs[] = $module_slug;
- $module_names[] = "<strong>{$module['name']}</strong>";
- }
-
- $module_slugs = join( ',', $module_slugs );
-?>
-<div id="message" class="jetpack-message jetpack-err">
- <div class="squeezer">
- <h4><strong><?php esc_html_e( 'Is this site private?', 'jetpack' ); ?></strong></h4><br />
- <p><?php
- echo wp_kses( wptexturize( wp_sprintf(
- _nx(
- "Like your site's RSS feeds, %l allows access to your posts and other content to third parties.",
- "Like your site's RSS feeds, %l allow access to your posts and other content to third parties.",
- count( $privacy_checks ),
- '%l = list of Jetpack module/feature names',
- 'jetpack'
- ),
- $module_names
- ) ), array( 'strong' => true ) );
-
- echo "\n<br />\n";
-
- echo wp_kses( sprintf(
- _nx(
- 'If your site is not publicly accessible, consider <a href="%1$s" title="%2$s">deactivating this feature</a>.',
- 'If your site is not publicly accessible, consider <a href="%1$s" title="%2$s">deactivating these features</a>.',
- count( $privacy_checks ),
- '%1$s = deactivation URL, %2$s = "Deactivate {list of Jetpack module/feature names}',
- 'jetpack'
- ),
- wp_nonce_url(
- Jetpack::admin_url( array(
- 'action' => 'deactivate',
- 'module' => urlencode( $module_slugs ),
- ) ),
- "jetpack_deactivate-$module_slugs"
- ),
- esc_attr( wp_kses( wp_sprintf( _x( 'Deactivate %l', '%l = list of Jetpack module/feature names', 'jetpack' ), $module_names ), array() ) )
- ), array( 'a' => array( 'href' => true, 'title' => true ) ) );
- ?></p>
- </div>
-</div>
-<?php
- endif;
- }
-
- /**
- * Record a stat for later output
- */
- function stat( $group, $detail ) {
- if ( !isset( $this->stats[ $group ] ) )
- $this->stats[ $group ] = array();
- $this->stats[ $group ][] = $detail;
- }
-
- /**
- * Load stats pixels. $group is auto-prefixed with "jetpack-"
- */
- function do_stats() {
- if ( is_array( $this->stats ) && count( $this->stats ) ) {
- foreach ( $this->stats as $group => $stats ) {
- if ( is_array( $stats ) && count( $stats ) )
- echo '<img src="' . ( is_ssl() ? 'https' : 'http' ) . '://stats.wordpress.com/g.gif?v=wpcom2&x_jetpack-' . esc_attr( $group ) . '=' . esc_attr( implode( ',', $stats ) ) . '&rand=' . md5( mt_rand( 0, 999 ) . time() ) . '" width="1" height="1" style="display:none;" />';
- }
- }
- }
-
- function translate_current_user_to_role() {
- foreach ( $this->capability_translations as $role => $cap ) {
- if ( current_user_can( $role ) || current_user_can( $cap ) ) {
- return $role;
- }
- }
-
- return false;
- }
-
- function translate_role_to_cap( $role ) {
- if ( !isset( $this->capability_translations[$role] ) ) {
- return false;
- }
-
- return $this->capability_translations[$role];
- }
-
- function sign_role( $role ) {
- if ( !$user_id = (int) get_current_user_id() ) {
- return false;
- }
-
- $token = Jetpack_Data::get_access_token();
- if ( !$token || is_wp_error( $token ) ) {
- return false;
- }
-
- return $role . ':' . hash_hmac( 'md5', "{$role}|{$user_id}", $token->secret );
- }
-
- function build_connect_url( $raw = false, $redirect = false ) {
- if ( !Jetpack::get_option( 'blog_token' ) ) {
- $url = wp_nonce_url( add_query_arg( 'action', 'register', menu_page_url( 'jetpack', false ) ), 'jetpack-register' );
- } else {
- $role = $this->translate_current_user_to_role();
- $signed_role = $this->sign_role( $role );
-
- $user = wp_get_current_user();
-
- $redirect = $redirect ? esc_url_raw( $redirect ) : '';
-
- $args = urlencode_deep( array(
- 'response_type' => 'code',
- 'client_id' => Jetpack::get_option( 'id' ),
- 'redirect_uri' => add_query_arg( array(
- 'action' => 'authorize',
- '_wpnonce' => wp_create_nonce( "jetpack-authorize_{$role}_{$redirect}" ),
- 'redirect' => $redirect ? urlencode( $redirect ) : false,
- ), menu_page_url( 'jetpack', false ) ),
- 'state' => $user->ID,
- 'scope' => $signed_role,
- 'user_email' => $user->user_email,
- 'user_login' => $user->user_login,
- 'is_active' => Jetpack::is_active(),
- ) );
-
- $url = add_query_arg( $args, Jetpack::api_url( 'authorize' ) );
- }
-
- return $raw ? $url : esc_url( $url );
- }
-
- public static function admin_url( $args = null ) {
- $url = admin_url( 'admin.php?page=jetpack' );
- if ( is_array( $args ) )
- $url = add_query_arg( $args, $url );
- return $url;
- }
-
- function dismiss_jetpack_notice() {
- if ( isset( $_GET['jetpack-notice'] ) && 'dismiss' == $_GET['jetpack-notice'] && ! is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
-
- deactivate_plugins( plugin_basename( __FILE__ ), false, false );
-
- wp_safe_redirect( admin_url() . 'plugins.php?deactivate=true&plugin_status=all&paged=1&s=' );
- exit;
- }
- }
-
- function admin_page() {
- global $current_user;
-
- $role = $this->translate_current_user_to_role();
- $is_connected = Jetpack::is_active();
- $user_token = Jetpack_Data::get_access_token($current_user->ID);
- $is_user_connected = $user_token && !is_wp_error($user_token);
- $is_master_user = $current_user->ID == Jetpack::get_option( 'master_user' );
- $module = false;
- ?>
- <div class="wrap" id="jetpack-settings">
-
- <h2 style="display: none"></h2> <!-- For WP JS message relocation -->
-
- <div id="jp-header"<?php if ( $is_connected ) : ?> class="small"<?php endif; ?>>
- <div id="jp-clouds">
- <?php if ( $is_connected ) : ?>
- <div id="jp-disconnectors">
- <?php if ( current_user_can( 'manage_options' ) ) : ?>
- <div id="jp-disconnect" class="jp-disconnect">
- <a href="<?php echo wp_nonce_url( Jetpack::admin_url( array( 'action' => 'disconnect' ) ), 'jetpack-disconnect' ); ?>"><div class="deftext"><?php _e( 'Connected to WordPress.com', 'jetpack' ); ?></div><div class="hovertext"><?php _e( 'Disconnect from WordPress.com', 'jetpack' ) ?></div></a>
- </div>
- <?php endif; ?>
- <?php if ( $is_user_connected && !$is_master_user ) : ?>
- <div id="jp-unlink" class="jp-disconnect">
- <a href="<?php echo wp_nonce_url( Jetpack::admin_url( array( 'action' => 'unlink' ) ), 'jetpack-unlink' ); ?>"><div class="deftext"><?php _e( 'User linked to WordPress.com', 'jetpack' ); ?></div><div class="hovertext"><?php _e( 'Unlink user from WordPress.com', 'jetpack' ) ?></div></a>
- </div>
- <?php endif; ?>
- </div>
- <?php endif; ?>
- <h3><?php _e( 'Jetpack by WordPress.com', 'jetpack' ) ?></h3>
- <?php if ( !$is_connected ) : ?>
- <div id="jp-notice">
- <p><?php _e( 'Jetpack supercharges your self-hosted WordPress site with the awesome cloud power of WordPress.com.', 'jetpack' ); ?></p>
- </div>
- <?php endif; ?>
- </div>
- </div>
-
- <?php if ( isset( $_GET['jetpack-notice'] ) && 'dismiss' == $_GET['jetpack-notice'] ) : ?>
- <div id="message" class="error">
- <p><?php _e( 'Jetpack is network activated and notices can not be dismissed.', 'jetpack' ); ?></p>
- </div>
- <?php endif; ?>
-
- <?php do_action( 'jetpack_notices' ) ?>
-
- <?php // If the connection has not been made then show the marketing text. ?>
- <?php if ( ! $is_connected ) : ?>
-
- <div id="message" class="updated jetpack-message jp-connect">
- <div id="jp-dismiss" class="jetpack-close-button-container">
- <a class="jetpack-close-button" href="?page=jetpack&jetpack-notice=dismiss" title="<?php _e( 'Dismiss this notice.', 'jetpack' ); ?>"><?php _e( 'Dismiss this notice.', 'jetpack' ); ?></a>
- </div>
- <div class="jetpack-wrap-container">
- <div class="jetpack-text-container">
- <h4>
- <p><?php _e( "To enable all of the Jetpack features you&#8217;ll need to connect your website to WordPress.com using the button to the right. Once you&#8217;ve made the connection you&#8217;ll activate all the delightful features below.", 'jetpack' ) ?></p>
- </h4>
- </div>
- <div class="jetpack-install-container">
- <p class="submit"><a href="<?php echo $this->build_connect_url() ?>" class="button-connector" id="wpcom-connect"><?php _e( 'Connect to WordPress.com', 'jetpack' ); ?></a></p>
- </div>
- </div>
- </div>
-
- <?php elseif ( ! $is_user_connected ) : ?>
-
- <div id="message" class="updated jetpack-message jp-connect">
- <div class="jetpack-wrap-container">
- <div class="jetpack-text-container">
- <h4>
- <p><?php _e( "To enable all of the Jetpack features you&#8217;ll need to link your account here to your WordPress.com account using the button to the right.", 'jetpack' ) ?></p>
- </h4>
- </div>
- <div class="jetpack-install-container">
- <p class="submit"><a href="<?php echo $this->build_connect_url() ?>" class="button-connector" id="wpcom-connect"><?php _e( 'Link account with WordPress.com', 'jetpack' ); ?></a></p>
- </div>
- </div>
- </div>
-
- <?php else /* blog and user are connected */ : ?>
- <?php /* TODO: if not master user, show user disconnect button? */ ?>
- <?php endif; ?>
-
- <?php
- // If we select the configure option for a module, show the configuration screen.
- if ( isset( $_GET['configure'] ) && Jetpack::is_module( $_GET['configure'] ) && current_user_can( 'manage_options' ) ) :
- $this->admin_screen_configure_module( $_GET['configure'] );
-
- // List all the available modules.
- else :
- $this->admin_screen_list_modules();
- ?>
-
- <div id="survey" class="jp-survey">
- <div class="jp-survey-container">
- <div class="jp-survey-text">
- <h4><?php _e( 'Have feedback on Jetpack?', 'jetpack' ); ?></h4>
- <br />
- <?php _e( 'Answer a short survey to let us know how we&#8217;re doing and what to add in the future.', 'jetpack' ); ?>
- </div>
- <div class="jp-survey-button-container">
- <p class="submit"><?php printf( '<a id="jp-survey-button" class="button-primary" target="_blank" href="%1$s">%2$s</a>', 'http://jetpack.me/survey/?rel=' . JETPACK__VERSION, __( 'Take Survey', 'jetpack' ) ); ?></p>
- </div>
- </div>
- </div>
-
- <?php if ( $is_connected && $this->current_user_is_connection_owner() ) : ?>
- <p id="news-sub"><?php _e( 'Checking email updates status&hellip;', 'jetpack' ); ?></p>
- <script type="text/javascript">
- jQuery(document).ready(function($){
- $.get( ajaxurl, { action: 'jetpack-check-news-subscription', rand: jQuery.now().toString() + Math.random().toString() }, function( data ) {
- if ( 'subscribed' == data ) {
- $( '#news-sub' ).html( '<?php printf(
- esc_js( _x( 'You are currently subscribed to email updates. %s', '%s = Unsubscribe link', 'jetpack' ) ),
- '<a href="#" class="jp-news-link button">' . esc_js( __( 'Unsubscribe', 'jetpack' ) ) . '</a>'
- ); ?>' );
- } else {
- $( '#news-sub' ).html( '<?php printf(
- esc_js( _x( 'Want to receive updates about Jetpack by email? %s', '%s = Subscribe link', 'jetpack' ) ),
- '<a href="#" class="jp-news-link button-primary">' . esc_js( __( 'Subscribe', 'jetpack' ) ) . '</a>'
- ); ?>' );
- }
- $( '.jp-news-link' ).click( function() {
- $( '#news-sub' ).append( ' <img src="<?php echo esc_js( esc_url( admin_url( 'images/loading.gif' ) ) ); ?>" align="absmiddle" id="jp-news-loading" />' );
- $.get( ajaxurl, { action: 'jetpack-subscribe-to-news', rand: jQuery.now().toString() + Math.random().toString() }, function( data ) {
- if ( 'subscribed' == data ) {
- $( '#news-sub' ).text( '<?php echo esc_js( __( 'You have been subscribed to receive email updates.', 'jetpack' ) ); ?>' );
- } else {
- $( '#news-sub' ).text( '<?php echo esc_js( __( 'You will no longer receive email updates about Jetpack.', 'jetpack' ) ); ?>' );
- }
- $( '#jp-news-loading' ).remove();
- } );
- return false;
- } );
- } );
- } );
- </script>
- <?php endif; ?>
- <?php endif; ?>
-
- <div id="jp-footer">
- <p class="automattic"><?php _e( 'An <span>Automattic</span> Airline', 'jetpack' ) ?></p>
- <p class="small">
- <a href="http://jetpack.me/" target="_blank">Jetpack <?php echo esc_html( JETPACK__VERSION ); ?></a> |
- <a href="http://automattic.com/privacy/" target="_blank"><?php _e( 'Privacy Policy', 'jetpack' ); ?></a> |
- <a href="http://wordpress.com/tos/" target="_blank"><?php _e( 'Terms of Service', 'jetpack' ); ?></a> |
-<?php if ( current_user_can( 'manage_options' ) ) : ?>
- <a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin-ajax.php?action=jetpack_debug' ), 'jetpack_debug' ) ); ?>" id="jp-debug"><?php _e( 'Debug', 'jetpack' ); ?></a> |
-<?php endif; ?>
- <a href="http://jetpack.me/support/" target="_blank"><?php _e( 'Support', 'jetpack' ); ?></a>
- </p>
- </div>
-
- <div id="jetpack-configuration" style="display:none;">
- <p><img width="16" src="<?php echo esc_url( plugins_url( '_inc/images/wpspin_light-2x.gif', __FILE__ ) ); ?>" alt="Loading ..." /></p>
- </div>
- </div>
- <?php
- }
-
- function ajax_debug() {
- nocache_headers();
-
- check_ajax_referer( 'jetpack_debug' );
-
- if ( !current_user_can( 'manage_options' ) ) {
- die( '-1' );
- }
-?>
- <p><?php esc_html_e( 'This is sensitive information. Please do not post your BLOG_TOKEN or USER_TOKEN publicly; they are like passwords.', 'jetpack' ); ?></p>
- <ul>
- <?php
- // Extract the current_user's token
- $user_id = get_current_user_id();
- $user_tokens = Jetpack::get_option( 'user_tokens' );
- if ( is_array( $user_tokens ) && array_key_exists( $user_id, $user_tokens ) ) {
- $user_token = $user_tokens[$user_id];
- } else {
- $user_token = '[this user has no token]';
- }
- unset( $user_tokens );
-
- foreach ( array(
- 'CLIENT_ID' => 'id',
- 'BLOG_TOKEN' => 'blog_token',
- 'MASTER_USER' => 'master_user',
- 'CERT' => 'fallback_no_verify_ssl_certs',
- 'TIME_DIFF' => 'time_diff',
- 'VERSION' => 'version',
- 'OLD_VERSION' => 'old_version',
- 'PUBLIC' => 'public',
- ) as $label => $option_name ) :
- ?>
- <li><?php echo esc_html( $label ); ?>: <code><?php echo esc_html( Jetpack::get_option( $option_name ) ); ?></code></li>
- <?php endforeach; ?>
- <li>USER_ID: <code><?php echo esc_html( $user_id ); ?></code></li>
- <li>USER_TOKEN: <code><?php echo esc_html( $user_token ); ?></code></li>
- <li>PHP_VERSION: <code><?php echo esc_html( PHP_VERSION ); ?></code></li>
- <li>WORDPRESS_VERSION: <code><?php echo esc_html( $GLOBALS['wp_version'] ); ?></code></li>
- </ul>
-<?php
- exit;
- }
-
- function admin_screen_configure_module( $module_id ) {
- if ( !in_array( $module_id, Jetpack::get_active_modules() ) || !current_user_can( 'manage_options' ) )
- return false; ?>
-
- <div id="jp-settings-screen" style="position: relative">
- <h3>
- <?php
- $module = Jetpack::get_module( $module_id );
- echo '<a href="' . menu_page_url( 'jetpack', false ) . '">' . __( 'Jetpack by WordPress.com', 'jetpack' ) . '</a> &rarr; ';
- printf( __( 'Configure %s', 'jetpack' ), $module['name'] );
- ?>
- </h3>
-
- <?php do_action( 'jetpack_module_configuration_screen_' . $module_id ); ?>
- </div><?php
- }
-
- public static function sort_modules( $a, $b ) {
- if ( $a['sort'] == $b['sort'] )
- return 0;
-
- return ( $a['sort'] < $b['sort'] ) ? -1 : 1;
- }
-
- function admin_screen_list_modules() {
- require_once dirname( __FILE__ ) . '/modules/module-info.php';
- $jetpack_connected = true;
- if ( !Jetpack::is_active() )
- $jetpack_connected = false;
-
- ?>
- <div class="module-container">
- <?php
-
- $avail_raw = Jetpack::get_available_modules();
- $available = array();
- $active = Jetpack::get_active_modules();
- $counter = 0;
-
- foreach ( (array) $avail_raw as $module ) {
- if ( $plugin = Jetpack::get_module( $module ) ) {
- $plugin['module'] = $module;
- $available[] = $plugin;
- }
- }
- unset( $avail_raw );
- usort( $available, array( 'Jetpack', 'sort_modules' ) );
- $jetpack_version = Jetpack::get_option( 'version' );
- if ( $jetpack_version ) {
- list( $jetpack_version, $jetpack_version_time ) = explode( ':', $jetpack_version );
- } else {
- $jetpack_version = 0;
- $jetpack_version_time = 0;
- }
-
- $jetpack_old_version = Jetpack::get_option( 'old_version' );
- if ( $jetpack_old_version ) {
- list( $jetpack_old_version ) = explode( ':', $jetpack_old_version );
- } else {
- $jetpack_old_version = 0;
- }
- $now = time();
-
- foreach ( (array) $available as $module_data ) {
- $module = $module_data['module'];
- $activated = in_array( $module, $active );
- if ( $activated ) {
- $css = 'active';
- $toggle = __( 'Deactivate', 'jetpack' );
- $toggle_url = wp_nonce_url(
- Jetpack::admin_url( array(
- 'action' => 'deactivate',
- 'module' => $module
- ) ),
- "jetpack_deactivate-$module"
- );
- } else {
- $css = 'inactive';
- $toggle = __( 'Activate', 'jetpack' );
- $toggle_url = wp_nonce_url(
- Jetpack::admin_url( array(
- 'action' => 'activate',
- 'module' => $module
- ) ),
- "jetpack_activate-$module"
- );
- }
-
- if ( $counter % 4 == 0 ) {
- $classes = $css . ' jetpack-newline';
- $counter = 0;
- } else {
- $classes = $css;
- }
-
- $free_text = esc_html( $module_data['free'] ? __( 'Free', 'jetpack' ) : __( 'Purchase', 'jetpack' ) );
- $free_text = apply_filters( 'jetpack_module_free_text_' . $module, $free_text );
- $badge_text = $free_text;
-
- if ( !$jetpack_connected ) {
- $classes = 'x disabled';
- } else if ( $jetpack_version_time + 604800 > $now ) { // 1 week
- if ( version_compare( $module_data['introduced'], $jetpack_old_version, '>' ) ) {
- $badge_text = esc_html__( 'New', 'jetpack' );
- $classes .= ' jetpack-new-module';
- } elseif ( isset( $module_data['changed'] ) && version_compare( $module_data['changed'], $jetpack_old_version, '>' ) ) {
- $badge_text = esc_html__( 'Updated', 'jetpack' );
- $classes .= ' jetpack-updated-module';
- } else {
- $badge_text = $free_text;
- }
- }
-
- ?>
- <div class="jetpack-module jetpack-<?php echo $classes; ?>" id="<?php echo $module ?>">
- <h3><?php echo $module_data['name']; ?></h3>
- <div class="jetpack-module-description">
- <div class="module-image">
- <p><span class="module-image-badge"><?php echo $badge_text; ?></span><span class="module-image-free" style="display: none"><?php echo $free_text; ?></span></p>
- </div>
-
- <p><?php echo apply_filters( 'jetpack_short_module_description', $module_data['description'], $module ); ?></p>
- </div>
-
- <div class="jetpack-module-actions">
- <?php if ( $jetpack_connected ) : ?>
- <?php if ( !$activated && current_user_can( 'manage_options' ) && apply_filters( 'jetpack_can_activate_' . $module, true ) ) : ?>
- <a href="<?php echo esc_url( $toggle_url ); ?>" class="<?php echo ( 'inactive' == $css ? ' button-primary' : ' button-secondary' ); ?>"><?php echo $toggle; ?></a>&nbsp;
- <?php endif; ?>
-
- <?php do_action( 'jetpack_learn_more_button_' . $module ) ?>
-
- <?php
- if ( current_user_can( 'manage_options' ) && apply_filters( 'jetpack_module_configurable_' . $module, false ) ) {
- echo '<a href="' . esc_attr( Jetpack::module_configuration_url( $module ) ) . '" class="jetpack-configure-button button-secondary">' . __( 'Configure', 'jetpack' ) . '</a>';
- }
- ?><?php if ( $activated && $module_data['deactivate'] && current_user_can( 'manage_options' ) ) : ?><a style="display: none;" href="<?php echo esc_url( $toggle_url ); ?>" class="jetpack-deactivate-button button-secondary"><?php echo $toggle; ?></a>&nbsp;<?php endif; ?>
-
- <?php else : ?>
- <?php do_action( 'jetpack_learn_more_button_' . $module ) ?>
- <?php endif; ?>
- </div>
- </div>
- <?php if ( 'inactive' == $css && $jetpack_connected ) : ?>
- <script type="text/javascript">
- jQuery( '#<?php echo esc_js( $module ); ?>' ).bind( 'click', function(e){
- if ( !jQuery(e.target).hasClass('more-info-link') )
- document.location.href = '<?php echo str_replace( '&amp;', '&', esc_js( esc_url( $toggle_url ) ) ); ?>';
- } );
- </script>
- <?php endif; ?>
-
- <div id="jp-more-info-<?php echo esc_attr( $module ); ?>" style="display:none;">
- <?php
- if ( $jetpack_connected && has_action( 'jetpack_module_more_info_connected_' . $module ) )
- do_action( 'jetpack_module_more_info_connected_' . $module );
- else
- do_action( 'jetpack_module_more_info_' . $module );
- ?>
- </div>
-
- <?php
- $counter++;
- }
-
- // Add in some "Coming soon..." placeholders to fill up the current row and one more
- for ( $i = 0; $i < 4; $i++ ) { ?>
- <div class="jetpack-module placeholder"<?php if ( $i > 8 - $counter ) echo ' style="display: none;"'; ?>>
- <h3><?php _e( 'Coming soon&#8230;', 'jetpack' ) ?></h3>
- </div>
- <?php
- }
-
- echo '</div><!-- .module-container -->';
- }
-
- function check_news_subscription() {
- if ( !$this->current_user_is_connection_owner() ) {
- exit;
- }
-
- Jetpack::load_xml_rpc_client();
- $xml = new Jetpack_IXR_Client( array(
- 'user_id' => JETPACK_MASTER_USER,
- ) );
- $xml->query( 'jetpack.checkNewsSubscription' );
- if ( $xml->isError() ) {
- printf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() );
- } else {
- print_r( $xml->getResponse() );
- }
- exit;
- }
-
- function subscribe_to_news() {
- if ( !$this->current_user_is_connection_owner() ) {
- exit;
- }
-
- Jetpack::load_xml_rpc_client();
- $xml = new Jetpack_IXR_Client( array(
- 'user_id' => JETPACK_MASTER_USER,
- ) );
- $xml->query( 'jetpack.subscribeToNews' );
- if ( $xml->isError() ) {
- printf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() );
- } else {
- print_r( $xml->getResponse() );
- }
- exit;
- }
-
-/* Client API */
-
- /**
- * Returns the requested Jetpack API URL
- *
- * @return string
- */
- public static function api_url( $relative_url ) {
- return trailingslashit( JETPACK__API_BASE . $relative_url ) . JETPACK__API_VERSION . '/';
- }
-
- /**
- * Some hosts disable the OpenSSL extension and so cannot make outgoing HTTPS requsets
- */
- public static function fix_url_for_bad_hosts( $url, &$args ) {
- if ( 0 !== strpos( $url, 'https://' ) ) {
- return $url;
- }
-
- switch ( JETPACK_CLIENT__HTTPS ) {
- case 'ALWAYS' :
- return $url;
- case 'NEVER' :
- return substr_replace( $url, '', 4, 1 );
- // default : case 'AUTO' :
- }
-
- $jetpack = Jetpack::init();
-
- // Yay! Your host is good!
- if ( wp_http_supports( array( 'ssl' => true ) ) ) {
- return $url;
- }
-
- // Boo! Your host is bad and makes Jetpack cry!
- return substr_replace( $url, '', 4, 1 );
- }
-
- /**
- * Returns the Jetpack XML-RPC API
- *
- * @return string
- */
- public static function xmlrpc_api_url() {
- $base = preg_replace( '#(https?://[^?/]+)(/?.*)?$#', '\\1', JETPACK__API_BASE );
- return untrailingslashit( $base ) . '/xmlrpc.php';
- }
-
- /**
- * @return bool|WP_Error
- */
- public static function register() {
- Jetpack::update_option( 'register', wp_generate_password( 32, false ) . ':' . wp_generate_password( 32, false ) . ':' . ( time() + 600 ) );
-
- @list( $secret_1, $secret_2, $secret_eol ) = explode( ':', Jetpack::get_option( 'register' ) );
- if ( empty( $secret_1 ) || empty( $secret_2 ) || empty( $secret_eol ) || $secret_eol < time() )
- return new Jetpack_Error( 'missing_secrets' );
-
- $timeout = (int) ini_get( 'max_execution_time' );
- if ( !$timeout )
- $timeout = 30;
- $timeout = intval( $timeout / 2 );
-
- $gmt_offset = get_option( 'gmt_offset' );
- if ( !$gmt_offset ) {
- $gmt_offset = 0;
- }
-
- $stats_options = get_option( 'stats_options' );
- $stats_id = isset($stats_options['blog_id']) ? $stats_options['blog_id'] : null;
-
- $args = array(
- 'method' => 'POST',
- 'body' => array(
- 'siteurl' => site_url(),
- 'home' => home_url(),
- 'gmt_offset' => $gmt_offset,
- 'timezone_string' => (string) get_option( 'timezone_string' ),
- 'site_name' => (string) get_option( 'blogname' ),
- 'secret_1' => $secret_1,
- 'secret_2' => $secret_2,
- 'site_lang' => get_locale(),
- 'timeout' => $timeout,
- 'stats_id' => $stats_id,
- ),
- 'headers' => array(
- 'Accept' => 'application/json',
- ),
- 'timeout' => $timeout,
- );
- $response = Jetpack_Client::_wp_remote_request( Jetpack::fix_url_for_bad_hosts( Jetpack::api_url( 'register' ), $args ), $args, true );
-
- if ( is_wp_error( $response ) ) {
- return new Jetpack_Error( 'register_http_request_failed', $response->get_error_message() );
- }
-
- $code = wp_remote_retrieve_response_code( $response );
- $entity = wp_remote_retrieve_body( $response );
-
- if ( $entity )
- $json = json_decode( $entity );
- else
- $json = false;
-
- $code_type = intval( $code / 100 );
- if ( 5 == $code_type ) {
- return new Jetpack_Error( 'wpcom_5??', sprintf( __( 'Error Details: %s', 'jetpack' ), $code ), $code );
- } elseif ( 408 == $code ) {
- return new Jetpack_Error( 'wpcom_408', sprintf( __( 'Error Details: %s', 'jetpack' ), $code ), $code );
- } elseif ( !empty( $json->error ) ) {
- $error_description = isset( $json->error_description ) ? sprintf( __( 'Error Details: %s', 'jetpack' ), (string) $json->error_description ) : '';
- return new Jetpack_Error( (string) $json->error, $error_description, $code );
- } elseif ( 200 != $code ) {
- return new Jetpack_Error( 'wpcom_bad_response', sprintf( __( 'Error Details: %s', 'jetpack' ), $code ), $code );
- }
-
- // Jetpack ID error block
- if ( empty( $json->jetpack_id ) ) {
- return new Jetpack_Error( 'jetpack_id', sprintf( __( 'Error Details: Jetpack ID is empty. Do not publicly post this error message! %s', 'jetpack' ), $entity ), $entity );
- } elseif ( ! is_scalar( $json->jetpack_id ) ) {
- return new Jetpack_Error( 'jetpack_id', sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ) , $entity ), $entity );
- } elseif ( preg_match( '/[^0-9]/', $json->jetpack_id ) ) {
- return new Jetpack_Error( 'jetpack_id', sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ) , $entity ), $entity);
- }
-
- if ( empty( $json->jetpack_secret ) || !is_string( $json->jetpack_secret ) )
- return new Jetpack_Error( 'jetpack_secret', '', $code );
-
- if ( isset( $json->jetpack_public ) ) {
- $jetpack_public = (int) $json->jetpack_public;
- } else {
- $jetpack_public = false;
- }
-
- Jetpack::update_options( array(
- 'id' => (int) $json->jetpack_id,
- 'blog_token' => (string) $json->jetpack_secret,
- 'public' => $jetpack_public,
- ) );
-
- return true;
- }
-
-
-/* Client Server API */
-
- /**
- * Loads the Jetpack XML-RPC client
- */
- public static function load_xml_rpc_client() {
- require_once ABSPATH . WPINC . '/class-IXR.php';
- require_once dirname( __FILE__ ) . '/class.jetpack-ixr-client.php';
- }
-
- /**
- * Authenticates XML-RPC and other requests from the Jetpack Server
- */
- function authenticate_jetpack( $user, $username, $password ) {
- if ( is_a( $user, 'WP_User' ) ) {
- return $user;
- }
-
- // It's not for us
- if ( !isset( $_GET['token'] ) || empty( $_GET['signature'] ) ) {
- return $user;
- }
-
- @list( $token_key, $version, $user_id ) = explode( ':', $_GET['token'] );
- if (
- empty( $token_key )
- ||
- empty( $version ) || strval( JETPACK__API_VERSION ) !== $version
- ||
- empty( $user_id ) || !ctype_digit( $user_id ) || !get_userdata( $user_id ) // only handle user_tokens for now, not blog_tokens
- ) {
- return $user;
- }
-
- $token = Jetpack_Data::get_access_token( $user_id );
- if ( !$token ) {
- return $user;
- }
-
- if ( 0 !== strpos( $token->secret, "$token_key." ) ) {
- return $user;
- }
-
- require_once dirname( __FILE__ ) . '/class.jetpack-signature.php';
-
- $jetpack_signature = new Jetpack_Signature( $token->secret, (int) Jetpack::get_option( 'time_diff' ) );
- if ( isset( $_POST['_jetpack_is_multipart'] ) ) {
- $post_data = $_POST;
- $file_hashes = array();
- foreach ( $post_data as $post_data_key => $post_data_value ) {
- if ( 0 !== strpos( $post_data_key, '_jetpack_file_hmac_' ) ) {
- continue;
- }
- $post_data_key = substr( $post_data_key, strlen( '_jetpack_file_hmac_' ) );
- $file_hashes[$post_data_key] = $post_data_value;
- }
-
- foreach ( $file_hashes as $post_data_key => $post_data_value ) {
- unset( $post_data["_jetpack_file_hmac_{$post_data_key}"] );
- $post_data[$post_data_key] = $post_data_value;
- }
-
- ksort( $post_data );
-
- $body = http_build_query( stripslashes_deep( $post_data ) );
- } elseif ( is_null( $this->HTTP_RAW_POST_DATA ) ) {
- $body = file_get_contents( 'php://input' );
- } else {
- $body = null;
- }
- $signature = $jetpack_signature->sign_current_request( array(
- 'body' => is_null( $body ) ? $this->HTTP_RAW_POST_DATA : $body
- ) );
-
- if ( !$signature ) {
- return $user;
- } else if ( is_wp_error( $signature ) ) {
- return $signature;
- } else if ( $signature !== $_GET['signature'] ) {
- return $user;
- }
-
- $timestamp = (int) $_GET['timestamp'];
- $nonce = stripslashes( (string) $_GET['nonce'] );
-
- if ( !$this->add_nonce( $timestamp, $nonce ) ) {
- return $user;
- }
-
- nocache_headers();
-
- return new WP_User( $token->external_user_id );
- }
-
- function add_nonce( $timestamp, $nonce ) {
- global $wpdb;
- static $nonces_used_this_request = array();
-
- if ( isset( $nonces_used_this_request["$timestamp:$nonce"] ) ) {
- return $nonces_used_this_request["$timestamp:$nonce"];
- }
-
- // This should always have gone through Jetpack_Signature::sign_request() first to check $timestamp an $nonce
- $timestamp = (int) $timestamp;
- $nonce = $wpdb->escape( $nonce );
-
- // Raw query so we can avoid races: add_option will also update
- $show_errors = $wpdb->show_errors( false );
- $return = $wpdb->query( $wpdb->prepare(
- "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s)",
- "jetpack_nonce_{$timestamp}_{$nonce}",
- time(),
- 'no'
- ) );
- $wpdb->show_errors( $show_errors );
-
- $nonces_used_this_request["$timestamp:$nonce"] = $return;
-
- return $return;
- }
-
- /**
- * In some setups, $HTTP_RAW_POST_DATA can be emptied during some IXR_Server paths since it is passed by reference to various methods.
- * Capture it here so we can verify the signature later.
- */
- function xmlrpc_methods( $methods ) {
- $this->HTTP_RAW_POST_DATA = $GLOBALS['HTTP_RAW_POST_DATA'];
- return $methods;
- }
-
- function xmlrpc_options( $options ) {
- $options['jetpack_version'] = array(
- 'desc' => __( 'Jetpack Plugin Version' , 'jetpack'),
- 'readonly' => true,
- 'value' => JETPACK__VERSION,
- );
-
- $options['jetpack_client_id'] = array(
- 'desc' => __( 'The Client ID/WP.com Blog ID of this site' , 'jetpack'),
- 'readonly' => true,
- 'value' => Jetpack::get_option( 'id' ),
- );
- return $options;
- }
-
- public static function clean_nonces( $all = false ) {
- global $wpdb;
-
- $sql = "DELETE FROM `$wpdb->options` WHERE `option_name` LIKE %s";
- $sql_args = array( like_escape( 'jetpack_nonce_' ) . '%' );
-
- if ( true !== $all ) {
- $sql .= ' AND CAST( `option_value` AS UNSIGNED ) < %d';
- $sql_args[] = time() - 3600;
- }
-
- $sql .= ' LIMIT 100';
-
- $sql = $wpdb->prepare( $sql, $sql_args );
-
- for ( $i = 0; $i < 1000; $i++ ) {
- if ( !$wpdb->query( $sql ) ) {
- break;
- }
- }
- }
-
- /**
- * State is passed via cookies from one request to the next, but never to subsequent requests.
- * SET: state( $key, $value );
- * GET: $value = state( $key );
- *
- * @param string $key
- * @param string $value
- * @param bool $restate private
- */
- public static function state( $key = null, $value = null, $restate = false ) {
- static $state = array();
- static $path, $domain;
- if ( !isset( $path ) ) {
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
- $admin_url = Jetpack::admin_url();
- $bits = parse_url( $admin_url );
-
- if ( is_array( $bits ) ) {
- $path = ( isset( $bits['path'] ) ) ? dirname( $bits['path'] ) : null;
- $domain = ( isset( $bits['host'] ) ) ? $bits['host'] : null;
- } else {
- $path = $domain = null;
- }
- }
-
- // Extract state from cookies and delete cookies
- if ( isset( $_COOKIE[ 'jetpackState' ] ) && is_array( $_COOKIE[ 'jetpackState' ] ) ) {
- $yum = $_COOKIE[ 'jetpackState' ];
- unset( $_COOKIE[ 'jetpackState' ] );
- foreach ( $yum as $k => $v ) {
- if ( strlen( $v ) )
- $state[ $k ] = $v;
- setcookie( "jetpackState[$k]", false, 0, $path, $domain );
- }
- }
-
- if ( $restate ) {
- foreach ( $state as $k => $v ) {
- setcookie( "jetpackState[$k]", $v, 0, $path, $domain );
- }
- return;
- }
-
- // Get a state variable
- if ( isset( $key ) && !isset( $value ) ) {
- if ( array_key_exists( $key, $state ) )
- return $state[ $key ];
- return null;
- }
-
- // Set a state variable
- if ( isset ( $key ) && isset( $value ) ) {
- $state[ $key ] = $value;
- setcookie( "jetpackState[$key]", $value, 0, $path, $domain );
- }
- }
-
- public static function restate() {
- Jetpack::state( null, null, true );
- }
-
- public static function check_privacy( $file ) {
- static $is_site_publicly_accessible = null;
-
- if ( is_null( $is_site_publicly_accessible ) ) {
- $is_site_publicly_accessible = false;
-
- Jetpack::load_xml_rpc_client();
- $rpc = new Jetpack_IXR_Client();
-
- $success = $rpc->query( 'jetpack.isSitePubliclyAccessible', home_url() );
- if ( $success ) {
- $response = $rpc->getResponse();
- if ( $response ) {
- $is_site_publicly_accessible = true;
- }
- }
-
- Jetpack::update_option( 'public', (int) $is_site_publicly_accessible );
- }
-
- if ( $is_site_publicly_accessible ) {
- return;
- }
-
- $module_slug = self::get_module_slug( $file );
-
- $privacy_checks = Jetpack::state( 'privacy_checks' );
- if ( !$privacy_checks ) {
- $privacy_checks = $module_slug;
- } else {
- $privacy_checks .= ",$module_slug";
- }
-
- Jetpack::state( 'privacy_checks', $privacy_checks );
- }
-
- /**
- * Helper method for multicall XMLRPC.
- */
- public static function xmlrpc_async_call() {
- global $blog_id;
- static $clients = array();
-
- $client_blog_id = is_multisite() ? $blog_id : 0;
-
- if ( !isset( $clients[$client_blog_id] ) ) {
- Jetpack::load_xml_rpc_client();
- $clients[$client_blog_id] = new Jetpack_IXR_ClientMulticall( array(
- 'user_id' => JETPACK_MASTER_USER,
- ) );
- ignore_user_abort( true );
- add_action( 'shutdown', array( 'Jetpack', 'xmlrpc_async_call' ) );
- }
-
- $args = func_get_args();
-
- if ( !empty( $args[0] ) ) {
- call_user_func_array( array( $clients[$client_blog_id], 'addCall' ), $args );
- } elseif ( is_multisite() ) {
- foreach ( $clients as $client_blog_id => $client ) {
- if ( !$client_blog_id || empty( $client->calls ) ) {
- continue;
- }
-
- $switch_success = switch_to_blog( $client_blog_id, true );
- if ( !$switch_success ) {
- continue;
- }
-
- flush();
- $client->query();
-
- restore_current_blog();
- }
- } else {
- if ( isset( $clients[0] ) && !empty( $clients[0]->calls ) ) {
- flush();
- $clients[0]->query();
- }
- }
- }
-
- public static function staticize_subdomain( $url ) {
- $host = parse_url( $url, PHP_URL_HOST );
- if ( !preg_match( '/.?(?:wordpress|wp)\.com$/', $host ) ) {
- return $url;
- }
-
- if ( is_ssl() ) {
- return preg_replace( '|https?://[^/]++/|', 'https://s-ssl.wordpress.com/', $url );
- }
-
- srand( crc32( basename( $url ) ) );
- $static_counter = rand( 0, 2 );
- srand(); // this resets everything that relies on this, like array_rand() and shuffle()
-
- return preg_replace( '|://[^/]+?/|', "://s$static_counter.wp.com/", $url );
- }
-
-/* JSON API Authorization */
-
- /**
- * Handles the login action for Authorizing the JSON API
- */
- function login_form_json_api_authorization() {
- $this->verify_json_api_authorization_request();
-
- add_action( 'wp_login', array( &$this, 'store_json_api_authorization_token' ), 10, 2 );
-
- add_action( 'login_message', array( &$this, 'login_message_json_api_authorization' ) );
- add_action( 'login_form', array( &$this, 'preserve_action_in_login_form_for_json_api_authorization' ) );
- add_filter( 'site_url', array( &$this, 'post_login_form_to_signed_url' ), 10, 3 );
- }
-
- // Make sure the login form is POSTed to the signed URL so we can reverify the request
- function post_login_form_to_signed_url( $url, $path, $scheme ) {
- if ( 'wp-login.php' !== $path || 'login_post' !== $scheme ) {
- return $url;
- }
-
- return "$url?{$_SERVER['QUERY_STRING']}";
- }
-
- // Make sure the POSTed request is handled by the same action
- function preserve_action_in_login_form_for_json_api_authorization() {
- echo "<input type='hidden' name='action' value='jetpack_json_api_authorization' />\n";
- }
-
- // If someone logs in to approve API access, store the Access Code in usermeta
- function store_json_api_authorization_token( $user_login, $user ) {
- add_filter( 'login_redirect', array( &$this, 'add_token_to_login_redirect_json_api_authorization' ), 10, 3 );
- add_filter( 'allowed_redirect_hosts', array( &$this, 'allow_wpcom_public_api_domain' ) );
- $token = wp_generate_password( 32, false );
- update_user_meta( $user->ID, 'jetpack_json_api_' . $this->json_api_authorization_request['client_id'], $token );
- }
-
- // Add public-api.wordpress.com to the safe redirect whitelist - only added when someone allows API access
- function allow_wpcom_public_api_domain( $domains ) {
- $domains[] = 'public-api.wordpress.com';
- return $domains;
- }
-
- // Add the Access Code details to the public-api.wordpress.com redirect
- function add_token_to_login_redirect_json_api_authorization( $redirect_to, $original_redirect_to, $user ) {
- return add_query_arg( urlencode_deep( array(
- 'jetpack-code' => get_user_meta( $user->ID, 'jetpack_json_api_' . $this->json_api_authorization_request['client_id'], true ),
- 'jetpack-user-id' => (int) $user->ID,
- 'jetpack-state' => $this->json_api_authorization_request['state'],
- ) ), $redirect_to );
- }
-
- // Verifies the request by checking the signature
- function verify_json_api_authorization_request() {
- require_once dirname( __FILE__ ) . '/class.jetpack-signature.php';
-
- $token = Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
- if ( !$token || empty( $token->secret ) ) {
- wp_die( __( 'You must connect your Jetpack plugin to WordPress.com to use this feature.' , 'jetpack') );
- }
-
- $die_error = __( 'Someone may be trying to trick you into giving them access to your site. Or it could be you just encountered a bug :). Either way, please close this window.', 'jetpack' );
-
- $jetpack_signature = new Jetpack_Signature( $token->secret, (int) Jetpack::get_option( 'time_diff' ) );
- $signature = $jetpack_signature->sign_current_request( array( 'body' => null, 'method' => 'GET' ) );
- if ( !$signature ) {
- wp_die( $die_error );
- } else if ( is_wp_error( $signature ) ) {
- wp_die( $die_error );
- } else if ( $signature !== $_GET['signature'] ) {
- if ( is_ssl() ) {
- // If we signed an HTTP request on the Jetpack Servers, but got redirected to HTTPS by the local blog, check the HTTP signature as well
- $signature = $jetpack_signature->sign_current_request( array( 'scheme' => 'http', 'body' => null, 'method' => 'GET' ) );
- if ( !$signature || is_wp_error( $signature ) || $signature !== $_GET['signature'] ) {
- wp_die( $die_error );
- }
- } else {
- wp_die( $die_error );
- }
- }
-
- $timestamp = (int) $_GET['timestamp'];
- $nonce = stripslashes( (string) $_GET['nonce'] );
-
- if ( !$this->add_nonce( $timestamp, $nonce ) ) {
- // De-nonce the nonce, at least for 5 minutes.
- // We have to reuse this nonce at least once (used the first time when the initial request is made, used a second time when the login form is POSTed)
- $old_nonce_time = get_option( "jetpack_nonce_{$timestamp}_{$nonce}" );
- if ( $old_nonce_time < time() - 300 ) {
- wp_die( __( 'The authorization process expired. Please go back and try again.' , 'jetpack') );
- }
- }
-
- $data = json_decode( base64_decode( stripslashes( $_GET['data'] ) ) );
- $data_filters = array(
- 'state' => 'opaque',
- 'client_id' => 'int',
- 'client_title' => 'string',
- 'client_image' => 'url',
- );
-
- foreach ( $data_filters as $key => $sanitation ) {
- if ( !isset( $data->$key ) ) {
- wp_die( $die_error );
- }
-
- switch ( $sanitation ) {
- case 'int' :
- $this->json_api_authorization_request[$key] = (int) $data->$key;
- break;
- case 'opaque' :
- $this->json_api_authorization_request[$key] = (string) $data->$key;
- break;
- case 'string' :
- $this->json_api_authorization_request[$key] = wp_kses( (string) $data->$key, array() );
- break;
- case 'url' :
- $this->json_api_authorization_request[$key] = esc_url_raw( (string) $data->$key );
- break;
- }
- }
-
- if ( empty( $this->json_api_authorization_request['client_id'] ) ) {
- wp_die( $die_error );
- }
- }
-
- function login_message_json_api_authorization( $message ) {
- return '<p class="message">' . sprintf(
- esc_html__( '%s wants to access your site&#8217;s data. Log in to authorize that access.' , 'jetpack'),
- '<strong>' . esc_html( $this->json_api_authorization_request['client_title'] ) . '</strong>'
- ) . '<img src="' . esc_url( $this->json_api_authorization_request['client_image'] ) . '" /></p>';
- }
-}
-
-class Jetpack_Client {
- /**
- * Makes an authorized remote request using Jetpack_Signature
- *
- * @return array|WP_Error WP HTTP response on success
- */
- public static function remote_request( $args, $body = null ) {
- $defaults = array(
- 'url' => '',
- 'user_id' => 0,
- 'blog_id' => 0,
- 'auth_location' => JETPACK_CLIENT__AUTH_LOCATION,
- 'method' => 'POST',
- 'timeout' => 10,
- 'redirection' => 0,
- );
-
- $args = wp_parse_args( $args, $defaults );
-
- $args['blog_id'] = (int) $args['blog_id'];
-
- if ( 'header' != $args['auth_location'] ) {
- $args['auth_location'] = 'query_string';
- }
-
- $token = Jetpack_Data::get_access_token( $args['user_id'] );
- if ( !$token ) {
- return new Jetpack_Error( 'missing_token' );
- }
-
- $method = strtoupper( $args['method'] );
-
- $timeout = intval( $args['timeout'] );
-
- $redirection = $args['redirection'];
-
- $request = compact( 'method', 'body', 'timeout', 'redirection' );
-
- @list( $token_key, $secret ) = explode( '.', $token->secret );
- if ( empty( $token ) || empty( $secret ) ) {
- return new Jetpack_Error( 'malformed_token' );
- }
-
- $token_key = sprintf( '%s:%d:%d', $token_key, JETPACK__API_VERSION, $token->external_user_id );
-
- require_once dirname( __FILE__ ) . '/class.jetpack-signature.php';
-
- $time_diff = (int) Jetpack::get_option( 'time_diff' );
- $jetpack_signature = new Jetpack_Signature( $token->secret, $time_diff );
-
- $timestamp = time() + $time_diff;
- $nonce = wp_generate_password( 10, false );
-
- // Kind of annoying. Maybe refactor Jetpack_Signature to handle body-hashing
- if ( is_null( $body ) ) {
- $body_hash = '';
- } else {
- if ( !is_string( $body ) ) {
- return new Jetpack_Error( 'invalid_body', 'Body is malformed.' );
- }
- $body_hash = jetpack_sha1_base64( $body );
- }
-
- $auth = array(
- 'token' => $token_key,
- 'timestamp' => $timestamp,
- 'nonce' => $nonce,
- 'body-hash' => $body_hash,
- );
-
- if ( false !== strpos( $args['url'], 'xmlrpc.php' ) ) {
- $url_args = array( 'for' => 'jetpack' );
- } else {
- $url_args = array();
- }
-
- if ( 'header' != $args['auth_location'] ) {
- $url_args += $auth;
- }
-
- $url = add_query_arg( urlencode_deep( $url_args ), $args['url'] );
- $url = Jetpack::fix_url_for_bad_hosts( $url, $request );
-
- $signature = $jetpack_signature->sign_request( $token_key, $timestamp, $nonce, $body_hash, $method, $url, $body, false );
-
- if ( !$signature || is_wp_error( $signature ) ) {
- return $signature;
- }
-
- // Send an Authorization header so various caches/proxies do the right thing
- $auth['signature'] = $signature;
- $auth['version'] = JETPACK__VERSION;
- $header_pieces = array();
- foreach ( $auth as $key => $value ) {
- $header_pieces[] = sprintf( '%s="%s"', $key, $value );
- }
- $request['headers'] = array(
- 'Authorization' => "X_JETPACK " . join( ' ', $header_pieces ),
- );
-
- if ( 'header' != $args['auth_location'] ) {
- $url = add_query_arg( 'signature', urlencode( $signature ), $url );
- }
-
- return Jetpack_Client::_wp_remote_request( $url, $request );
- }
-
- /**
- * Wrapper for wp_remote_request(). Turns off SSL verification for certain SSL errors.
- * This is lame, but many, many, many hosts have misconfigured SSL.
- *
- * When Jetpack is registered, the jetpack_fallback_no_verify_ssl_certs option is set to the current time if:
- * 1. a certificate error is found AND
- * 2. not verifying the certificate works around the problem.
- *
- * The option is checked on each request.
- *
- * @internal
- * @todo: Better fallbacks (bundled certs?), feedback, UI, ....
- * @see Jetpack::fix_url_for_bad_hosts()
- *
- * @return array|WP_Error WP HTTP response on success
- */
- public static function _wp_remote_request( $url, $args, $set_fallback = false ) {
- $fallback = Jetpack::get_option( 'fallback_no_verify_ssl_certs' );
- if ( false === $fallback ) {
- Jetpack::update_option( 'fallback_no_verify_ssl_certs', 0 );
- }
-
- if ( (int) $fallback ) {
- // We're flagged to fallback
- $args['sslverify'] = false;
- }
-
- $response = wp_remote_request( $url, $args );
-
- if (
- !$set_fallback // We're not allowed to set the flag on this request, so whatever happens happens
- ||
- isset( $args['sslverify'] ) && !$args['sslverify'] // No verification - no point in doing it again
- ||
- !is_wp_error( $response ) // Let it ride
- ) {
- Jetpack_Client::set_time_diff( $response, $set_fallback );
- return $response;
- }
-
- // At this point, we're not flagged to fallback and we are allowed to set the flag on this request.
-
- $message = $response->get_error_message();
-
- // Is it an SSL Certificate verification error?
- if (
- false === strpos( $message, '14090086' ) // OpenSSL SSL3 certificate error
- &&
- false === strpos( $message, '1407E086' ) // OpenSSL SSL2 certificate error
- &&
- false === strpos( $message, 'error setting certificate verify locations' ) // cURL CA bundle not found
- &&
- false === strpos( $message, 'Peer certificate cannot be authenticated with' ) // cURL CURLE_SSL_CACERT: CA bundle found, but not helpful
- // different versions of curl have different error messages
- // this string should catch them all
- &&
- false === strpos( $message, 'Problem with the SSL CA cert' ) // cURL CURLE_SSL_CACERT_BADFILE: probably access rights
- ) {
- // No, it is not.
- return $response;
- }
-
- // Redo the request without SSL certificate verification.
- $args['sslverify'] = false;
- $response = wp_remote_request( $url, $args );
-
- if ( !is_wp_error( $response ) ) {
- // The request went through this time, flag for future fallbacks
- Jetpack::update_option( 'fallback_no_verify_ssl_certs', time() );
- Jetpack_Client::set_time_diff( $response, $set_fallback );
- }
-
- return $response;
- }
-
- public static function set_time_diff( &$response, $force_set = false ) {
- $code = wp_remote_retrieve_response_code( $response );
-
- // Only trust the Date header on some responses
- if ( 200 != $code && 304 != $code && 400 != $code && 401 != $code ) {
- return;
- }
-
- if ( !$date = wp_remote_retrieve_header( $response, 'date' ) ) {
- return;
- }
-
- if ( 0 >= $time = (int) strtotime( $date ) ) {
- return;
- }
-
- $time_diff = $time - time();
-
- if ( $force_set ) { // during register
- Jetpack::update_option( 'time_diff', $time_diff );
- } else { // otherwise
- $old_diff = Jetpack::get_option( 'time_diff' );
- if ( false === $old_diff || abs( $time_diff - (int) $old_diff ) > 10 ) {
- Jetpack::update_option( 'time_diff', $time_diff );
- }
- }
- }
-}
-
-class Jetpack_Data {
- /**
- * Gets locally stored token
- *
- * @return object|false
- */
- public static function get_access_token( $user_id = false ) {
- if ( $user_id ) {
- if ( !$tokens = Jetpack::get_option( 'user_tokens' ) ) {
- return false;
- }
- if ( $user_id === JETPACK_MASTER_USER ) {
- if ( !$user_id = Jetpack::get_option( 'master_user' ) ) {
- return false;
- }
- }
- if ( !isset( $tokens[$user_id] ) || !$token = $tokens[$user_id] ) {
- return false;
- }
- $token_chunks = explode( '.', $token );
- if ( empty( $token_chunks[1] ) || empty( $token_chunks[2] ) ) {
- return false;
- }
- if ( $user_id != $token_chunks[2] ) {
- return false;
- }
- $token = "{$token_chunks[0]}.{$token_chunks[1]}";
- } else {
- $token = Jetpack::get_option( 'blog_token' );
- if ( empty( $token ) ) {
- return false;
- }
- }
-
- return (object) array(
- 'secret' => $token,
- 'external_user_id' => (int) $user_id,
- );
- }
-}
-
-/**
- * Client = Plugin
- * Client Server = API Methods the Plugin must respond to
- *
- * @todo Roll this into Jetpack? There's only one 'public' method now: ::authorize().
- */
-class Jetpack_Client_Server {
- function authorize() {
- $data = stripslashes_deep( $_GET );
-
- $args = array();
-
- $redirect = isset( $data['redirect'] ) ? esc_url_raw( (string) $data['redirect'] ) : '';
-
- do {
- $jetpack = Jetpack::init();
- $role = $jetpack->translate_current_user_to_role();
- if ( !$role ) {
- Jetpack::state( 'error', 'no_role' );
- break;
- }
-
- $cap = $jetpack->translate_role_to_cap( $role );
- if ( !$cap ) {
- Jetpack::state( 'error', 'no_cap' );
- break;
- }
-
- check_admin_referer( "jetpack-authorize_{$role}_{$redirect}" );
-
- if ( !empty( $data['error'] ) ) {
- Jetpack::state( 'error', $data['error'] );
- break;
- }
-
- if ( empty( $data['state'] ) ) {
- Jetpack::state( 'error', 'no_state' );
- break;
- }
-
- if ( !ctype_digit( $data['state'] ) ) {
- Jetpack::state( 'error', 'invalid_state' );
- break;
- }
-
- $current_user_id = get_current_user_id();
- if ( $current_user_id != $data['state'] ) {
- Jetpack::state( 'error', 'wrong_state' );
- break;
- }
-
- if ( empty( $data['code'] ) ) {
- Jetpack::state( 'error', 'no_code' );
- break;
- }
-
- $token = $this->get_token( $data );
-
- if ( is_wp_error( $token ) ) {
- if ( $error = $token->get_error_code() )
- Jetpack::state( 'error', $error );
- else
- Jetpack::state( 'error', 'invalid_token' );
-
- Jetpack::state( 'error_description', $token->get_error_message() );
-
- break;
- }
-
- if ( !$token ) {
- Jetpack::state( 'error', 'no_token' );
- break;
- }
-
- $is_master_user = ! Jetpack::is_active();
-
- Jetpack::update_user_token( $current_user_id, sprintf( '%s.%d', $token, $current_user_id ), $is_master_user );
-
-
- if ( $is_master_user ) {
- Jetpack::state( 'message', 'authorized' );
- } else {
- Jetpack::state( 'message', 'linked' );
- // Don't activate anything since we are just connecting a user.
- break;
- }
-
- if ( $active_modules = Jetpack::get_option( 'active_modules' ) ) {
- Jetpack::delete_option( 'active_modules' );
-
- Jetpack::activate_default_modules( 999, 1, $active_modules );
- } else {
- Jetpack::activate_default_modules();
- }
-
- $jetpack->sync->register( 'noop' ); // Spawn a sync to make sure the Jetpack Servers know what modules are active.
-
- // Start nonce cleaner
- wp_clear_scheduled_hook( 'jetpack_clean_nonces' );
- wp_schedule_event( time(), 'hourly', 'jetpack_clean_nonces' );
- } while ( false );
-
- if ( wp_validate_redirect( $redirect ) ) {
- wp_safe_redirect( $redirect );
- } else {
- wp_safe_redirect( Jetpack::admin_url() );
- }
-
- exit;
- }
-
- public static function deactivate_plugin( $probable_file, $probable_title ) {
- if ( is_plugin_active( $probable_file ) ) {
- deactivate_plugins( $probable_file );
- return 1;
- } else {
- // If the plugin is not in the usual place, try looking through all active plugins.
- $active_plugins = get_option( 'active_plugins', array() );
- foreach ( $active_plugins as $plugin ) {
- $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
- if ( $data['Name'] == $probable_title ) {
- deactivate_plugins( $plugin );
- return 1;
- }
- }
- }
-
- return 0;
- }
-
- /**
- * @return object|WP_Error
- */
- function get_token( $data ) {
- $jetpack = Jetpack::init();
- $role = $jetpack->translate_current_user_to_role();
-
- if ( !$role ) {
- return new Jetpack_Error( 'role', __( 'An administrator for this blog must set up the Jetpack connection.', 'jetpack' ) );
- }
-
- $client_secret = Jetpack_Data::get_access_token();
- if ( !$client_secret ) {
- return new Jetpack_Error( 'client_secret', __( 'You need to register your Jetpack before connecting it.', 'jetpack' ) );
- }
-
- $redirect = isset( $data['redirect'] ) ? esc_url_raw( (string) $data['redirect'] ) : '';
-
- $body = array(
- 'client_id' => Jetpack::get_option( 'id' ),
- 'client_secret' => $client_secret->secret,
- 'grant_type' => 'authorization_code',
- 'code' => $data['code'],
- 'redirect_uri' => add_query_arg( array(
- 'action' => 'authorize',
- '_wpnonce' => wp_create_nonce( "jetpack-authorize_{$role}_{$redirect}" ),
- 'redirect' => $redirect ? urlencode( $redirect ) : false,
- ), menu_page_url( 'jetpack', false ) ),
- );
-
- $args = array(
- 'method' => 'POST',
- 'body' => $body,
- 'headers' => array(
- 'Accept' => 'application/json',
- ),
- );
- $response = Jetpack_Client::_wp_remote_request( Jetpack::fix_url_for_bad_hosts( Jetpack::api_url( 'token' ), $args ), $args );
-
- if ( is_wp_error( $response ) ) {
- return new Jetpack_Error( 'token_http_request_failed', $response->get_error_message() );
- }
-
- $code = wp_remote_retrieve_response_code( $response );
- $entity = wp_remote_retrieve_body( $response );
-
- if ( $entity )
- $json = json_decode( $entity );
- else
- $json = false;
-
- if ( 200 != $code || !empty( $json->error ) ) {
- if ( empty( $json->error ) )
- return new Jetpack_Error( 'unknown', '', $code );
-
- $error_description = isset( $json->error_description ) ? sprintf( __( 'Error Details: %s', 'jetpack' ), (string) $json->error_description ) : '';
-
- return new Jetpack_Error( (string) $json->error, $error_description, $code );
- }
-
- if ( empty( $json->access_token ) || !is_scalar( $json->access_token ) ) {
- return new Jetpack_Error( 'access_token', '', $code );
- }
-
- if ( empty( $json->token_type ) || 'X_JETPACK' != strtoupper( $json->token_type ) ) {
- return new Jetpack_Error( 'token_type', '', $code );
- }
-
- if ( empty( $json->scope ) ) {
- return new Jetpack_Error( 'scope', 'No Scope', $code );
- }
- @list( $role, $hmac ) = explode( ':', $json->scope );
- if ( empty( $role ) || empty( $hmac ) ) {
- return new Jetpack_Error( 'scope', 'Malformed Scope', $code );
- }
- if ( $jetpack->sign_role( $role ) !== $json->scope ) {
- return new Jetpack_Error( 'scope', 'Invalid Scope', $code );
- }
-
- if ( !$cap = $jetpack->translate_role_to_cap( $role ) )
- return new Jetpack_Error( 'scope', 'No Cap', $code );
- if ( !current_user_can( $cap ) )
- return new Jetpack_Error( 'scope', 'current_user_cannot', $code );
-
- return (string) $json->access_token;
- }
-}
-
-
-/**
- * Request that a piece of data on this WordPress install be synced back to the
- * Jetpack server for remote processing/notifications/etc
- */
-class Jetpack_Sync {
- // What modules want to sync what content
- var $sync_conditions = array( 'posts' => array(), 'comments' => array() );
-
- // We keep track of all the options registered for sync so that we can sync them all if needed
- var $sync_options = array();
-
- // Keep trac of status transitions, which we wouldn't always know about on the Jetpack Servers but are important when deciding what to do with the sync.
- var $post_transitions = array();
- var $comment_transitions = array();
-
- // Objects to sync
- var $sync = array();
-
- function __construct() {
- // WP Cron action. Only used on upgrade
- add_action( 'jetpack_sync_all_registered_options', array( $this, 'sync_all_registered_options' ) );
- }
-
-/* Static Methods for Modules */
-
- /**
- * @param string $file __FILE__
- * @param array settings:
- * post_types => array( post_type slugs ): The post types to sync. Default: post, page
- * post_stati => array( post_status slugs ): The post stati to sync. Default: publish
- */
- static function sync_posts( $file, array $settings = null ) {
- $jetpack = Jetpack::init();
- $args = func_get_args();
- return call_user_func_array( array( $jetpack->sync, 'posts' ), $args );
- }
-
- /**
- * @param string $file __FILE__
- * @param array settings:
- * post_types => array( post_type slugs ): The post types to sync. Default: post, page
- * post_stati => array( post_status slugs ): The post stati to sync. Default: publish
- * comment_types => array( comment_type slugs ): The comment types to sync. Default: '', comment, trackback, pingback
- * comment_stati => array( comment_status slugs ): The comment stati to sync. Default: approved
- */
- static function sync_comments( $file, array $settings = null ) {
- $jetpack = Jetpack::init();
- $args = func_get_args();
- return call_user_func_array( array( $jetpack->sync, 'comments' ), $args );
- }
-
- /**
- * @param string $file __FILE__
- * @param string $option, Option name to sync
- * @param string $option ...
- */
- static function sync_options( $file, $option /*, $option, ... */ ) {
- $jetpack = Jetpack::init();
- $args = func_get_args();
- return call_user_func_array( array( $jetpack->sync, 'options' ), $args );
- }
-
-/* Internal Methods */
-
- /**
- * Create a sync object/request
- *
- * @param string $object Type of object to sync -- [ post | comment | option ]
- * @param int $id Unique identifier
- * @param array $settings
- */
- function register( $object, $id = false, array $settings = null ) {
- // Since we've registered something for sync, hook it up to execute on shutdown if we haven't already
- if ( !$this->sync ) {
- ignore_user_abort( true );
- add_action( 'shutdown', array( $this, 'sync' ), 9 ); // Right before async XML-RPC
- }
-
- $defaults = array(
- 'on_behalf_of' => array(), // What modules want this data
- );
- $settings = wp_parse_args( $settings, $defaults );
-
- if ( !isset( $this->sync[$object] ) ) {
- $this->sync[$object] = array();
- }
-
- // Store the settings for this object
- if (
- // First time for this object
- !isset( $this->sync[$object][$id] )
- ) {
- // Easy: store the current settings
- $this->sync[$object][$id] = $settings;
- } else {
- // Not as easy: we have to manually merge the settings from previous runs for this object with the settings for this run
-
- $this->sync[$object][$id]['on_behalf_of'] = array_unique( array_merge( $this->sync[$object][$id]['on_behalf_of'], $settings['on_behalf_of'] ) );
- }
-
- $delete_prefix = 'delete_';
- if ( 0 === strpos( $object, $delete_prefix ) ) {
- $unset_object = substr( $object, strlen( $delete_prefix ) );
- } else {
- $unset_object = "{$delete_prefix}{$object}";
- }
-
- // Ensure post ... delete_post yields a delete operation
- // Ensure delete_post ... post yields a sync post operation
- // Ensure update_option() ... delete_option() ends up as a delete
- // Ensure delete_option() ... update_option() ends up as an update
- // Etc.
- unset( $this->sync[$unset_object][$id] );
-
- return true;
- }
-
- function get_common_sync_data() {
- $available_modules = Jetpack::get_available_modules();
- $active_modules = Jetpack::get_active_modules();
- $modules = array();
- foreach ( $available_modules as $available_module ) {
- $modules[$available_module] = in_array( $available_module, $active_modules );
- }
- $modules['vaultpress'] = class_exists( 'VaultPress' ) || function_exists( 'vaultpress_contact_service' );
-
- $sync_data = array(
- 'modules' => $modules,
- 'version' => JETPACK__VERSION,
- );
-
- return $sync_data;
- }
-
- /**
- * Set up all the data and queue it for the outgoing XML-RPC request
- */
- function sync() {
- if ( !$this->sync ) {
- return false;
- }
-
- $sync_data = $this->get_common_sync_data();
-
- $wp_importing = defined( 'WP_IMPORTING' ) && WP_IMPORTING;
-
- foreach ( $this->sync as $sync_operation_type => $sync_operations ) {
- switch ( $sync_operation_type ) {
- case 'post':
- if ( $wp_importing ) {
- break;
- }
-
- $global_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] : null;
- $GLOBALS['post'] = null;
- foreach ( $sync_operations as $post_id => $settings ) {
- $sync_data['post'][$post_id] = $this->get_post( $post_id );
- if ( isset( $this->post_transitions[$post_id] ) ) {
- $sync_data['post'][$post_id]['transitions'] = $this->post_transitions[$post_id];
- } else {
- $sync_data['post'][$post_id]['transitions'] = array( false, false );
- }
- $sync_data['post'][$post_id]['on_behalf_of'] = $settings['on_behalf_of'];
- }
- $GLOBALS['post'] = $global_post;
- unset( $global_post );
- break;
- case 'comment':
- if ( $wp_importing ) {
- break;
- }
-
- $global_comment = isset( $GLOBALS['comment'] ) ? $GLOBALS['comment'] : null;
- unset( $GLOBALS['comment'] );
- foreach ( $sync_operations as $comment_id => $settings ) {
- $sync_data['comment'][$comment_id] = $this->get_comment( $comment_id );
- if ( isset( $this->comment_transitions[$comment_id] ) ) {
- $sync_data['comment'][$comment_id]['transitions'] = $this->comment_transitions[$comment_id];
- } else {
- $sync_data['comment'][$comment_id]['transitions'] = array( false, false );
- }
- $sync_data['comment'][$comment_id]['on_behalf_of'] = $settings['on_behalf_of'];
- }
- $GLOBALS['comment'] = $global_comment;
- unset( $global_comment );
- break;
- case 'option' :
- foreach ( $sync_operations as $option => $settings ) {
- $sync_data['option'][$option] = array( 'value' => get_option( $option ) );
- }
- break;
-
- case 'delete_post':
- case 'delete_comment':
- foreach ( $sync_operations as $object_id => $settings ) {
- $sync_data[$sync_operation_type][$object_id] = array( 'on_behalf_of' => $settings['on_behalf_of'] );
- }
- break;
- case 'delete_option' :
- foreach ( $sync_operations as $object_id => $settings ) {
- $sync_data[$sync_operation_type][$object_id] = true;
- }
- break;
- }
- }
-
- Jetpack::xmlrpc_async_call( 'jetpack.syncContent', $sync_data );
- }
-
- /**
- * Format and return content data from a direct xmlrpc request for it.
- *
- * @param array $content_ids: array( 'posts' => array of ids, 'comments' => array of ids, 'options' => array of options )
- */
- function get_content( $content_ids ) {
- $sync_data = $this->get_common_sync_data();
-
- if ( isset( $content_ids['posts'] ) ) {
- foreach ( $content_ids['posts'] as $id ) {
- $sync_data['post'][$id] = $this->get_post( $id );
- }
- }
-
- if ( isset( $content_ids['comments'] ) ) {
- foreach ( $content_ids['comments'] as $id ) {
- $sync_data['comment'][$id] = $this->get_post( $id );
- }
- }
-
- if ( isset( $content_ids['options'] ) ) {
- foreach ( $content_ids['options'] as $option ) {
- $sync_data['option'][$option] = array( 'value' => get_option( $option ) );
- }
- }
-
- return $sync_data;
- }
-
- /**
- * Helper method for registering a post for sync
- *
- * @param int $id wp_posts.ID
- * @param array $settings Sync data
- */
- function register_post( $id, array $settings = null ) {
- $id = (int) $id;
- if ( !$id ) {
- return false;
- }
-
- $post = get_post( $id );
- if ( !$post ) {
- return false;
- }
-
- $settings = wp_parse_args( $settings, array(
- 'on_behalf_of' => array(),
- ) );
-
- return $this->register( 'post', $id, $settings );
- }
-
- /**
- * Helper method for registering a comment for sync
- *
- * @param int $id wp_comments.comment_ID
- * @param array $settings Sync data
- */
- function register_comment( $id, array $settings = null ) {
- $id = (int) $id;
- if ( !$id ) {
- return false;
- }
-
- $comment = get_comment( $id );
- if ( !$comment || empty( $comment->comment_post_ID ) ) {
- return false;
- }
-
- $post = get_post( $comment->comment_post_ID );
- if ( !$post ) {
- return false;
- }
-
- $settings = wp_parse_args( $settings, array(
- 'on_behalf_of' => array(),
- ) );
-
- return $this->register( 'comment', $id, $settings );
- }
-
-/* Posts Sync */
-
- function posts( $file, array $settings = null ) {
- $module_slug = Jetpack::get_module_slug( $file );
-
- $defaults = array(
- 'post_types' => array( 'post', 'page' ),
- 'post_stati' => array( 'publish' ),
- );
-
- $this->sync_conditions['posts'][$module_slug] = wp_parse_args( $settings, $defaults );
-
- add_action( 'transition_post_status', array( $this, 'transition_post_status_action' ), 10, 3 );
- add_action( 'delete_post', array( $this, 'delete_post_action' ) );
- }
-
- function delete_post_action( $post_id ) {
- $post = get_post( $post_id );
- if ( !$post ) {
- return $this->register( 'delete_post', (int) $post_id );
- }
-
- $this->transition_post_status_action( 'delete', $post->post_status, $post );
- }
-
- function transition_post_status_action( $new_status, $old_status, $post ) {
- $sync = $this->get_post_sync_operation( $new_status, $old_status, $post, $this->sync_conditions['posts'] );
- if ( !$sync ) {
- // No module wants to sync this post
- return false;
- }
-
- // Track post transitions
- if ( isset( $this->post_transitions[$post->ID] ) ) {
- // status changed more than once - keep tha most recent $new_status
- $this->post_transitions[$post->ID][0] = $new_status;
- } else {
- $this->post_transitions[$post->ID] = array( $new_status, $old_status );
- }
-
- $operation = $sync['operation'];
- unset( $sync['operation'] );
-
- switch ( $operation ) {
- case 'delete' :
- return $this->register( 'delete_post', (int) $post->ID, $sync );
- case 'submit' :
- return $this->register_post( (int) $post->ID, $sync );
- }
- }
-
- function get_post_sync_operation( $new_status, $old_status, $post, $module_conditions ) {
- $delete_on_behalf_of = array();
- $submit_on_behalf_of = array();
- $delete_stati = array( 'delete' );
-
- foreach ( $module_conditions as $module => $conditions ) {
- if ( !in_array( $post->post_type, $conditions['post_types'] ) ) {
- continue;
- }
-
- $deleted_post = in_array( $new_status, $delete_stati );
-
- if ( $deleted_post ) {
- $delete_on_behalf_of[] = $module;
- } else {
- clean_post_cache( $post->ID );
- $new_status = get_post_status( $post->ID ); // Inherited status is resolved here
- }
-
- $old_status_in_stati = in_array( $old_status, $conditions['post_stati'] );
- $new_status_in_stati = in_array( $new_status, $conditions['post_stati'] );
-
- if ( $old_status_in_stati && !$new_status_in_stati ) {
- // Jetpack no longer needs the post
- if ( !$deleted_post ) {
- $delete_on_behalf_of[] = $module;
- } // else, we've already flagged it above
- continue;
- }
-
- if ( !$new_status_in_stati ) {
- continue;
- }
-
- // At this point, we know we want to sync the post, not delete it
- $submit_on_behalf_of[] = $module;
- }
-
- if ( !empty( $submit_on_behalf_of ) ) {
- return array( 'operation' => 'submit', 'on_behalf_of' => $submit_on_behalf_of );
- }
-
- if ( !empty( $delete_on_behalf_of ) ) {
- return array( 'operation' => 'delete', 'on_behalf_of' => $delete_on_behalf_of );
- }
-
- return false;
- }
-
- /**
- * Get a post and associated data in the standard JP format.
- * Cannot be called statically
- *
- * @param int $id Post ID
- * @return Array containing full post details
- */
- function get_post( $id ) {
- $post_obj = get_post( $id );
- if ( !$post_obj )
- return false;
-
- if ( is_callable( $post_obj, 'to_array' ) ) {
- // WP >= 3.5
- $post = $post_obj->to_array();
- } else {
- // WP < 3.5
- $post = get_object_vars( $post_obj );
- }
-
- if ( 0 < strlen( $post['post_password'] ) ) {
- $post['post_password'] = 'auto-' . wp_generate_password( 10, false ); // We don't want the real password. Just pass something random.
- }
-
- // local optimizations
- unset(
- $post['filter'],
- $post['ancestors'],
- $post['post_content_filtered'],
- $post['to_ping'],
- $post['pinged']
- );
-
- if ( $this->is_post_public( $post ) ) {
- $post['post_is_public'] = Jetpack::get_option( 'public' );
- } else {
- //obscure content
- $post['post_content'] = '';
- $post['post_excerpt'] = '';
- $post['post_is_public'] = false;
- }
- $post_type_obj = get_post_type_object( $post['post_type'] );
- $post['post_is_excluded_from_search'] = $post_type_obj->exclude_from_search;
-
- $post['tax'] = array();
- $taxonomies = get_object_taxonomies( $post_obj );
- foreach ( $taxonomies as $taxonomy ) {
- $terms = get_object_term_cache( $post_obj->ID, $taxonomy );
- if ( empty( $terms ) )
- $terms = wp_get_object_terms( $post_obj->ID, $taxonomy );
- $term_names = array();
- foreach ( $terms as $term ) {
- $term_names[] = $term->name;
- }
- $post['tax'][$taxonomy] = $term_names;
- }
-
- $meta = get_post_meta( $post_obj->ID, false );
- $post['meta'] = array();
- foreach ( $meta as $key => $value ) {
- $post['meta'][$key] = array_map( 'maybe_unserialize', $value );
- }
-
- $post['extra'] = array(
- 'author' => get_the_author_meta( 'display_name', $post_obj->post_author ),
- 'author_email' => get_the_author_meta( 'email', $post_obj->post_author ),
- );
-
- if ( $fid = get_post_thumbnail_id( $id ) ) {
- $feature = wp_get_attachment_image_src( $fid, 'large' );
- if ( !empty( $feature[0] ) )
- $post['extra']['featured_image'] = $feature[0];
- }
-
- $post['permalink'] = get_permalink( $post_obj->ID );
- $post['shortlink'] = wp_get_shortlink( $post_obj->ID );
- return $post;
- }
-
- /**
- * Decide whether a post/page/attachment is visible to the public.
- *
- * @param array $post
- * @return bool
- */
- function is_post_public( $post ) {
- if ( !is_array( $post ) ) {
- $post = (array) $post;
- }
-
- if ( 0 < strlen( $post['post_password'] ) )
- return false;
- if ( ! in_array( $post['post_type'], get_post_types( array( 'public' => true ) ) ) )
- return false;
- $post_status = get_post_status( $post['ID'] ); // Inherited status is resolved here.
- if ( ! in_array( $post_status, get_post_stati( array( 'public' => true ) ) ) )
- return false;
- return true;
- }
-
-/* Comments Sync */
-
- function comments( $file, array $settings = null ) {
- $module_slug = Jetpack::get_module_slug( $file );
-
- $defaults = array(
- 'post_types' => array( 'post', 'page' ), // For what post types will we sync comments?
- 'post_stati' => array( 'publish' ), // For what post stati will we sync comments?
- 'comment_types' => array( '', 'comment', 'trackback', 'pingback' ), // What comment types will we sync?
- 'comment_stati' => array( 'approved' ), // What comment stati will we sync?
- );
-
- $settings = wp_parse_args( $settings, $defaults );
-
- $this->sync_conditions['comments'][$module_slug] = $settings;
-
- add_action( 'wp_insert_comment', array( $this, 'wp_insert_comment_action' ), 10, 2 );
- add_action( 'transition_comment_status', array( $this, 'transition_comment_status_action' ), 10, 3 );
- add_action( 'edit_comment', array( $this, 'edit_comment_action' ) );
- }
-
- /*
- * This is really annoying. If you edit a comment, but don't change the status, WordPress doesn't fire the transition_comment_status hook.
- * That means we have to catch these comments on the edit_comment hook, but ignore comments on that hook when the transition_comment_status does fire.
- */
- function edit_comment_action( $comment_id ) {
- $comment = get_comment( $comment_id );
- $new_status = $this->translate_comment_status( $comment->comment_approved );
- add_action( "comment_{$new_status}_{$comment->comment_type}", array( $this, 'transition_comment_status_for_comments_whose_status_does_not_change' ), 10, 2 );
- }
-
- function wp_insert_comment_action( $comment_id, $comment ) {
- $this->transition_comment_status_action( $comment->comment_approved, 'new', $comment );
- }
-
- function transition_comment_status_for_comments_whose_status_does_not_change( $comment_id, $comment ) {
- if ( isset( $this->comment_transitions[$comment_id] ) ) {
- return $this->transition_comment_status_action( $comment->comment_approved, $this->comment_transitions[$comment_id][1], $comment );
- }
-
- return $this->transition_comment_status_action( $comment->comment_approved, $comment->comment_approved, $comment );
- }
-
- function translate_comment_status( $status ) {
- switch ( (string) $status ) {
- case '0' :
- case 'hold' :
- return 'unapproved';
- case '1' :
- case 'approve' :
- return 'approved';
- }
-
- return $status;
- }
-
- function transition_comment_status_action( $new_status, $old_status, $comment ) {
- $post = get_post( $comment->comment_post_ID );
- if ( !$post ) {
- return false;
- }
-
- foreach ( array( 'new_status', 'old_status' ) as $_status ) {
- $$_status = $this->translate_comment_status( $$_status );
- }
-
- // Track comment transitions
- if ( isset( $this->comment_transitions[$comment->comment_ID] ) ) {
- // status changed more than once - keep tha most recent $new_status
- $this->comment_transitions[$comment->comment_ID][0] = $new_status;
- } else {
- $this->comment_transitions[$comment->comment_ID] = array( $new_status, $old_status );
- }
-
- $post_sync = $this->get_post_sync_operation( $post->post_status, '_jetpack_test_sync', $post, $this->sync_conditions['comments'] );
-
- if ( !$post_sync ) {
- // No module wants to sync this comment because its post doesn't match any sync conditions
- return false;
- }
-
- if ( 'delete' == $post_sync['operation'] ) {
- // Had we been looking at post sync operations (instead of comment sync operations),
- // this comment's post would have been deleted. Don't sync the comment.
- return false;
- }
-
- $delete_on_behalf_of = array();
- $submit_on_behalf_of = array();
- $delete_stati = array( 'delete' );
-
- foreach ( $this->sync_conditions['comments'] as $module => $conditions ) {
- if ( !in_array( $comment->comment_type, $conditions['comment_types'] ) ) {
- continue;
- }
-
- $deleted_comment = in_array( $new_status, $delete_stati );
-
- if ( $deleted_comment ) {
- $delete_on_behalf_of[] = $module;
- }
-
- $old_status_in_stati = in_array( $old_status, $conditions['comment_stati'] );
- $new_status_in_stati = in_array( $new_status, $conditions['comment_stati'] );
-
- if ( $old_status_in_stati && !$new_status_in_stati ) {
- // Jetpack no longer needs the comment
- if ( !$deleted_comment ) {
- $delete_on_behalf_of[] = $module;
- } // else, we've already flagged it above
- continue;
- }
-
- if ( !$new_status_in_stati ) {
- continue;
- }
-
- // At this point, we know we want to sync the comment, not delete it
- $submit_on_behalf_of[] = $module;
- }
-
- if ( ! empty( $submit_on_behalf_of ) ) {
- $this->register_post( $comment->comment_post_ID, array( 'on_behalf_of' => $submit_on_behalf_of ) );
- return $this->register_comment( $comment->comment_ID, array( 'on_behalf_of' => $submit_on_behalf_of ) );
- }
-
- if ( !empty( $delete_on_behalf_of ) ) {
- return $this->register( 'delete_comment', $comment->comment_ID, array( 'on_behalf_of' => $delete_on_behalf_of ) );
- }
-
- return false;
- }
-
- /**
- * Get a comment and associated data in the standard JP format.
- * Cannot be called statically
- *
- * @param int $id Comment ID
- * @return Array containing full comment details
- */
- function get_comment( $id ) {
- $comment_obj = get_comment( $id );
- if ( !$comment_obj )
- return false;
- $comment = get_object_vars( $comment_obj );
-
- $meta = get_comment_meta( $id, false );
- $comment['meta'] = array();
- foreach ( $meta as $key => $value ) {
- $comment['meta'][$key] = array_map( 'maybe_unserialize', $value );
- }
-
- return $comment;
- }
-
-/* Options Sync */
-
- /* Ah... so much simpler than Posts and Comments :) */
- function options( $file, $option /*, $option, ... */ ) {
- $options = func_get_args();
- $file = array_shift( $options );
-
- $module_slug = Jetpack::get_module_slug( $file );
-
- if ( !isset( $this->sync_options[$module_slug] ) ) {
- $this->sync_options[$module_slug] = array();
- }
-
- foreach ( $options as $option ) {
- $this->sync_options[$module_slug][] = $option;
- add_action( "delete_option_{$option}", array( $this, 'deleted_option_action' ) );
- add_action( "update_option_{$option}", array( $this, 'updated_option_action' ) );
- add_action( "add_option_{$option}", array( $this, 'added_option_action' ) );
- }
-
- $this->sync_options[$module_slug] = array_unique( $this->sync_options[$module_slug] );
- }
-
- function deleted_option_action( $option ) {
- $this->register( 'delete_option', $option );
- }
-
- function updated_option_action( $old_value ) {
- // The value of $option isn't passed to the filter
- // Calculate it
- $option = current_filter();
- $prefix = 'update_option_';
- if ( 0 !== strpos( $option, $prefix ) ) {
- return;
- }
- $option = substr( $option, strlen( $prefix ) );
-
- $this->added_option_action( $option );
- }
-
- function added_option_action( $option ) {
- $this->register( 'option', $option );
- }
-
- function sync_all_module_options( $module_slug ) {
- if ( empty( $this->sync_options[$module_slug] ) ) {
- return;
- }
-
- foreach ( $this->sync_options[$module_slug] as $option ) {
- $this->added_option_action( $option );
- }
- }
-
- function sync_all_registered_options( $options = array() ) {
- if ( 'jetpack_sync_all_registered_options' == current_filter() ) {
- $all_registered_options = array_unique( call_user_func_array( 'array_merge', $this->sync_options ) );
- foreach ( $all_registered_options as $option ) {
- $this->added_option_action( $option );
- }
- } else {
- wp_schedule_single_event( time(), 'jetpack_sync_all_registered_options', array( $this->sync_options ) );
- }
- }
-}
-
-require_once dirname( __FILE__ ) . '/class.jetpack-user-agent.php';
-require_once dirname( __FILE__ ) . '/class.jetpack-post-images.php';
-require_once dirname( __FILE__ ) . '/class.photon.php';
-require dirname( __FILE__ ) . '/functions.photon.php';
-require dirname( __FILE__ ) . '/functions.compat.php';
-require dirname( __FILE__ ) . '/functions.gallery.php';
-
-class Jetpack_Error extends WP_Error {}
+// Constants for expressing human-readable intervals
+// in their respective number of seconds.
+// Introduced in WordPress 3.5, specified here for backward compatability.
+defined( 'MINUTE_IN_SECONDS' ) or define( 'MINUTE_IN_SECONDS', 60 );
+defined( 'HOUR_IN_SECONDS' ) or define( 'HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS );
+defined( 'DAY_IN_SECONDS' ) or define( 'DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS );
+defined( 'WEEK_IN_SECONDS' ) or define( 'WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS );
+defined( 'YEAR_IN_SECONDS' ) or define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS );
+
+// @todo: Abstract out the admin functions, and only include them if is_admin()
+// @todo: Only include things like class.jetpack-sync.php if we're connected.
+require_once( JETPACK__PLUGIN_DIR . 'class.jetpack.php' );
+require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-client.php' );
+require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-data.php' );
+require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-client-server.php' );
+require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-sync.php' );
+require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-options.php' );
+require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-user-agent.php' );
+require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-post-images.php' );
+require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-error.php' );
+require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-debugger.php' );
+require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-heartbeat.php' );
+require_once( JETPACK__PLUGIN_DIR . 'class.photon.php' );
+require_once( JETPACK__PLUGIN_DIR . 'functions.photon.php' );
+require_once( JETPACK__PLUGIN_DIR . 'functions.compat.php' );
+require_once( JETPACK__PLUGIN_DIR . 'functions.gallery.php' );
register_activation_hook( __FILE__, array( 'Jetpack', 'plugin_activation' ) );
register_deactivation_hook( __FILE__, array( 'Jetpack', 'plugin_deactivation' ) );
add_action( 'init', array( 'Jetpack', 'init' ) );
+add_action( 'init', array( 'Jetpack_Heartbeat', 'init' ), 100 );
add_action( 'plugins_loaded', array( 'Jetpack', 'load_modules' ), 100 );
add_filter( 'jetpack_static_url', array( 'Jetpack', 'staticize_subdomain' ) );
+/*
+if ( is_admin() && ! Jetpack::check_identity_crisis() ) {
+ Jetpack_Sync::sync_options( __FILE__, 'db_version', 'jetpack_active_modules', 'active_plugins' );
+}
+*/
+
Jetpack_Sync::sync_options( __FILE__, 'widget_twitter' );
diff --git a/plugins/jetpack/languages/jetpack-ar.mo b/plugins/jetpack/languages/jetpack-ar.mo
index 254be8e6..e057c917 100644
--- a/plugins/jetpack/languages/jetpack-ar.mo
+++ b/plugins/jetpack/languages/jetpack-ar.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-az.mo b/plugins/jetpack/languages/jetpack-az.mo
index 033f8593..1a17b7b7 100644
--- a/plugins/jetpack/languages/jetpack-az.mo
+++ b/plugins/jetpack/languages/jetpack-az.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-bs_BA.mo b/plugins/jetpack/languages/jetpack-bs_BA.mo
index 67cd4468..40cc45bd 100644
--- a/plugins/jetpack/languages/jetpack-bs_BA.mo
+++ b/plugins/jetpack/languages/jetpack-bs_BA.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-ca.mo b/plugins/jetpack/languages/jetpack-ca.mo
index 2daa9e1c..68167b29 100644
--- a/plugins/jetpack/languages/jetpack-ca.mo
+++ b/plugins/jetpack/languages/jetpack-ca.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-cs_CZ.mo b/plugins/jetpack/languages/jetpack-cs_CZ.mo
index 5e088773..220421d8 100644
--- a/plugins/jetpack/languages/jetpack-cs_CZ.mo
+++ b/plugins/jetpack/languages/jetpack-cs_CZ.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-da_DK.mo b/plugins/jetpack/languages/jetpack-da_DK.mo
index 773e5b51..c5af6d83 100644
--- a/plugins/jetpack/languages/jetpack-da_DK.mo
+++ b/plugins/jetpack/languages/jetpack-da_DK.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-de_DE.mo b/plugins/jetpack/languages/jetpack-de_DE.mo
index a93c1c7c..c9b11ee7 100644
--- a/plugins/jetpack/languages/jetpack-de_DE.mo
+++ b/plugins/jetpack/languages/jetpack-de_DE.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-el.mo b/plugins/jetpack/languages/jetpack-el.mo
index 8538e68c..6487268b 100644
--- a/plugins/jetpack/languages/jetpack-el.mo
+++ b/plugins/jetpack/languages/jetpack-el.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-es_ES.mo b/plugins/jetpack/languages/jetpack-es_ES.mo
index 3cc9243e..4f8be590 100644
--- a/plugins/jetpack/languages/jetpack-es_ES.mo
+++ b/plugins/jetpack/languages/jetpack-es_ES.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-fa_IR.mo b/plugins/jetpack/languages/jetpack-fa_IR.mo
index f34c74e6..096ac421 100644
--- a/plugins/jetpack/languages/jetpack-fa_IR.mo
+++ b/plugins/jetpack/languages/jetpack-fa_IR.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-fi.mo b/plugins/jetpack/languages/jetpack-fi.mo
index 591c0472..913b15a1 100644
--- a/plugins/jetpack/languages/jetpack-fi.mo
+++ b/plugins/jetpack/languages/jetpack-fi.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-fr_FR.mo b/plugins/jetpack/languages/jetpack-fr_FR.mo
index 165c2b9e..5fa71ada 100644
--- a/plugins/jetpack/languages/jetpack-fr_FR.mo
+++ b/plugins/jetpack/languages/jetpack-fr_FR.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-gl_ES.mo b/plugins/jetpack/languages/jetpack-gl_ES.mo
index e5f4c09a..2e88f28f 100644
--- a/plugins/jetpack/languages/jetpack-gl_ES.mo
+++ b/plugins/jetpack/languages/jetpack-gl_ES.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-he_IL.mo b/plugins/jetpack/languages/jetpack-he_IL.mo
index 90d820c7..cf18acd8 100644
--- a/plugins/jetpack/languages/jetpack-he_IL.mo
+++ b/plugins/jetpack/languages/jetpack-he_IL.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-hr.mo b/plugins/jetpack/languages/jetpack-hr.mo
index 8765f205..d1608ba4 100644
--- a/plugins/jetpack/languages/jetpack-hr.mo
+++ b/plugins/jetpack/languages/jetpack-hr.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-hu_HU.mo b/plugins/jetpack/languages/jetpack-hu_HU.mo
index 11715656..27fbc982 100644
--- a/plugins/jetpack/languages/jetpack-hu_HU.mo
+++ b/plugins/jetpack/languages/jetpack-hu_HU.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-id_ID.mo b/plugins/jetpack/languages/jetpack-id_ID.mo
index 8d3427dd..c0cddc06 100644
--- a/plugins/jetpack/languages/jetpack-id_ID.mo
+++ b/plugins/jetpack/languages/jetpack-id_ID.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-it_IT.mo b/plugins/jetpack/languages/jetpack-it_IT.mo
index 7165de10..fc6d8f41 100644
--- a/plugins/jetpack/languages/jetpack-it_IT.mo
+++ b/plugins/jetpack/languages/jetpack-it_IT.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-ja.mo b/plugins/jetpack/languages/jetpack-ja.mo
index f715cc91..698be13f 100644
--- a/plugins/jetpack/languages/jetpack-ja.mo
+++ b/plugins/jetpack/languages/jetpack-ja.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-ko_KR.mo b/plugins/jetpack/languages/jetpack-ko_KR.mo
index 3a7a5295..46a7b085 100644
--- a/plugins/jetpack/languages/jetpack-ko_KR.mo
+++ b/plugins/jetpack/languages/jetpack-ko_KR.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-lt_LT.mo b/plugins/jetpack/languages/jetpack-lt_LT.mo
index 55f190a5..3917f2f6 100644
--- a/plugins/jetpack/languages/jetpack-lt_LT.mo
+++ b/plugins/jetpack/languages/jetpack-lt_LT.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-mk_MK.mo b/plugins/jetpack/languages/jetpack-mk_MK.mo
index 804e8a3b..4fc204dc 100644
--- a/plugins/jetpack/languages/jetpack-mk_MK.mo
+++ b/plugins/jetpack/languages/jetpack-mk_MK.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-my_MM.mo b/plugins/jetpack/languages/jetpack-my_MM.mo
index 1d1604b7..02d9ab35 100644
--- a/plugins/jetpack/languages/jetpack-my_MM.mo
+++ b/plugins/jetpack/languages/jetpack-my_MM.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-nb_NO.mo b/plugins/jetpack/languages/jetpack-nb_NO.mo
index 5600cf1d..ba9a07ea 100644
--- a/plugins/jetpack/languages/jetpack-nb_NO.mo
+++ b/plugins/jetpack/languages/jetpack-nb_NO.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-nl_NL.mo b/plugins/jetpack/languages/jetpack-nl_NL.mo
index a125514d..3e5b3235 100644
--- a/plugins/jetpack/languages/jetpack-nl_NL.mo
+++ b/plugins/jetpack/languages/jetpack-nl_NL.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-nn_NO.mo b/plugins/jetpack/languages/jetpack-nn_NO.mo
index 1157c955..e97633a0 100644
--- a/plugins/jetpack/languages/jetpack-nn_NO.mo
+++ b/plugins/jetpack/languages/jetpack-nn_NO.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-pl_PL.mo b/plugins/jetpack/languages/jetpack-pl_PL.mo
index 3a5df93c..3e686606 100644
--- a/plugins/jetpack/languages/jetpack-pl_PL.mo
+++ b/plugins/jetpack/languages/jetpack-pl_PL.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-pt_BR.mo b/plugins/jetpack/languages/jetpack-pt_BR.mo
index da51355f..a4aa2278 100644
--- a/plugins/jetpack/languages/jetpack-pt_BR.mo
+++ b/plugins/jetpack/languages/jetpack-pt_BR.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-pt_PT.mo b/plugins/jetpack/languages/jetpack-pt_PT.mo
index 62d6331b..8afc9be6 100644
--- a/plugins/jetpack/languages/jetpack-pt_PT.mo
+++ b/plugins/jetpack/languages/jetpack-pt_PT.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-ro_RO.mo b/plugins/jetpack/languages/jetpack-ro_RO.mo
index 6a76116e..6b6b6e34 100644
--- a/plugins/jetpack/languages/jetpack-ro_RO.mo
+++ b/plugins/jetpack/languages/jetpack-ro_RO.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-ru_RU.mo b/plugins/jetpack/languages/jetpack-ru_RU.mo
index 392de6d0..12ab4527 100644
--- a/plugins/jetpack/languages/jetpack-ru_RU.mo
+++ b/plugins/jetpack/languages/jetpack-ru_RU.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-sa_IN.mo b/plugins/jetpack/languages/jetpack-sa_IN.mo
index f7bfee62..6e87f221 100644
--- a/plugins/jetpack/languages/jetpack-sa_IN.mo
+++ b/plugins/jetpack/languages/jetpack-sa_IN.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-sk_SK.mo b/plugins/jetpack/languages/jetpack-sk_SK.mo
index 0f6a8ea8..8cb30748 100644
--- a/plugins/jetpack/languages/jetpack-sk_SK.mo
+++ b/plugins/jetpack/languages/jetpack-sk_SK.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-sq.mo b/plugins/jetpack/languages/jetpack-sq.mo
index 795f5abb..87856508 100644
--- a/plugins/jetpack/languages/jetpack-sq.mo
+++ b/plugins/jetpack/languages/jetpack-sq.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-sr_RS.mo b/plugins/jetpack/languages/jetpack-sr_RS.mo
index 62d2959a..c6d753d8 100644
--- a/plugins/jetpack/languages/jetpack-sr_RS.mo
+++ b/plugins/jetpack/languages/jetpack-sr_RS.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-sv_SE.mo b/plugins/jetpack/languages/jetpack-sv_SE.mo
index 382cbc3e..60b01b1c 100644
--- a/plugins/jetpack/languages/jetpack-sv_SE.mo
+++ b/plugins/jetpack/languages/jetpack-sv_SE.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-th.mo b/plugins/jetpack/languages/jetpack-th.mo
index 13499189..f747b319 100644
--- a/plugins/jetpack/languages/jetpack-th.mo
+++ b/plugins/jetpack/languages/jetpack-th.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-tr_TR.mo b/plugins/jetpack/languages/jetpack-tr_TR.mo
index 24eeccec..09c04155 100644
--- a/plugins/jetpack/languages/jetpack-tr_TR.mo
+++ b/plugins/jetpack/languages/jetpack-tr_TR.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-zh_CN.mo b/plugins/jetpack/languages/jetpack-zh_CN.mo
index 17900fb1..d4fa8db8 100644
--- a/plugins/jetpack/languages/jetpack-zh_CN.mo
+++ b/plugins/jetpack/languages/jetpack-zh_CN.mo
Binary files differ
diff --git a/plugins/jetpack/languages/jetpack-zh_TW.mo b/plugins/jetpack/languages/jetpack-zh_TW.mo
index 38662136..fda55d22 100644
--- a/plugins/jetpack/languages/jetpack-zh_TW.mo
+++ b/plugins/jetpack/languages/jetpack-zh_TW.mo
Binary files differ
diff --git a/plugins/jetpack/locales.php b/plugins/jetpack/locales.php
index e910fbfc..5c306d49 100644
--- a/plugins/jetpack/locales.php
+++ b/plugins/jetpack/locales.php
@@ -1773,28 +1773,28 @@ class GP_Locales {
}
}
- function &instance() {
+ static function instance() {
if ( !isset( $GLOBALS['gp_locales'] ) )
$GLOBALS['gp_locales'] = new GP_Locales;
return $GLOBALS['gp_locales'];
}
- function locales() {
+ static function locales() {
$instance = GP_Locales::instance();
return $instance->locales;
}
- function exists( $slug ) {
+ static function exists( $slug ) {
$instance = GP_Locales::instance();
return isset( $instance->locales[$slug] );
}
- function by_slug( $slug ) {
+ static function by_slug( $slug ) {
$instance = GP_Locales::instance();
return isset( $instance->locales[$slug] )? $instance->locales[$slug] : null;
}
- function by_field( $field_name, $field_value ) {
+ static function by_field( $field_name, $field_value ) {
$instance = GP_Locales::instance();
$result = false;
foreach( $instance->locales() as $locale ) {
diff --git a/plugins/jetpack/modules/after-the-deadline.php b/plugins/jetpack/modules/after-the-deadline.php
index 606f6488..cf98ec0c 100644
--- a/plugins/jetpack/modules/after-the-deadline.php
+++ b/plugins/jetpack/modules/after-the-deadline.php
@@ -4,21 +4,22 @@
* Module Description: Improve your spelling, style, and grammar with the <a href="http://www.afterthedeadline.com/">After&nbsp;the&nbsp;Deadline</a> Proofreading service.
* Sort Order: 6
* First Introduced: 1.1
+ * Requires Connection: Yes
*/
-
+
add_action( 'jetpack_modules_loaded', 'AtD_load' );
function AtD_load() {
- Jetpack::enable_module_configurable( __FILE__ );
- Jetpack::module_configuration_load( __FILE__, 'AtD_configuration_load' );
+ Jetpack::enable_module_configurable( __FILE__ );
+ Jetpack::module_configuration_load( __FILE__, 'AtD_configuration_load' );
}
function AtD_configuration_load() {
wp_safe_redirect( get_edit_profile_url( get_current_user_id() ) . '#atd' );
- exit;
+ exit;
}
-/*
+/*
* Load necessary include files
*/
include( 'after-the-deadline/config-options.php' );
@@ -56,7 +57,7 @@ function AtD_addbuttons() {
/* Don't bother doing this stuff if the current user lacks permissions */
if ( ! AtD_is_allowed() )
return;
-
+
/* Add only in Rich Editor mode */
if ( get_user_option( 'rich_editing' ) == 'true' ) {
add_filter( 'mce_external_plugins', 'add_AtD_tinymce_plugin' );
@@ -85,16 +86,16 @@ function register_AtD_button( $buttons ) {
array_push( $buttons, '|', 'AtD' );
return $buttons;
}
-
+
/*
- * Load the TinyMCE plugin : editor_plugin.js (wp2.5)
+ * Load the TinyMCE plugin : editor_plugin.js (wp2.5)
*/
function add_AtD_tinymce_plugin( $plugin_array ) {
$plugin_array['AtD'] = plugins_url( 'after-the-deadline/tinymce/editor_plugin.js?v=' . ATD_VERSION, __FILE__ );
return $plugin_array;
}
-/*
+/*
* Update the TinyMCE init block with AtD specific settings
*/
function AtD_change_mce_settings( $init_array ) {
@@ -116,15 +117,15 @@ function AtD_change_mce_settings( $init_array ) {
return $init_array;
}
-/*
+/*
* Sanitizes AtD AJAX data to acceptable chars, caller needs to make sure ' is escaped
*/
function AtD_sanitize( $untrusted ) {
return preg_replace( '/[^a-zA-Z0-9\-\',_ ]/i', "", $untrusted );
}
-/*
- * AtD HTML Editor Stuff
+/*
+ * AtD HTML Editor Stuff
*/
function AtD_settings() {
$user = wp_get_current_user();
@@ -156,20 +157,20 @@ function AtD_load_javascripts() {
wp_enqueue_script( 'AtD_jquery', plugins_url( '/after-the-deadline/jquery.atd.js', __FILE__ ), array('jquery'), ATD_VERSION );
wp_enqueue_script( 'AtD_settings', admin_url() . 'admin-ajax.php?action=atd_settings', array('AtD_jquery'), ATD_VERSION );
wp_enqueue_script( 'AtD_autoproofread', plugins_url( '/after-the-deadline/atd-autoproofread.js', __FILE__ ), array('AtD_jquery'), ATD_VERSION );
- }
+ }
}
/* Spits out user options for auto-proofreading on publish/update */
function AtD_load_submit_check_javascripts() {
global $pagenow;
-
+
$user = wp_get_current_user();
if ( ! $user || $user->ID == 0 )
return;
-
+
if ( AtD_should_load_on_page() ) {
$atd_check_when = AtD_get_setting( $user->ID, 'AtD_check_when' );
-
+
if ( !empty( $atd_check_when ) ) {
$check_when = array();
/* Set up the options in json */
@@ -238,7 +239,7 @@ add_action( 'init', 'AtD_addbuttons' );
/* setup hooks for our PHP functions we want to make available via an AJAX call */
add_action( 'wp_ajax_proxy_atd', 'AtD_redirect_call' );
-add_action( 'wp_ajax_atd_ignore', 'AtD_ignore_call' );
+add_action( 'wp_ajax_atd_ignore', 'AtD_ignore_call' );
add_action( 'wp_ajax_atd_settings', 'AtD_settings' );
/* load and install the localization stuff */
diff --git a/plugins/jetpack/modules/after-the-deadline/atd-autoproofread.js b/plugins/jetpack/modules/after-the-deadline/atd-autoproofread.js
index b76a757c..53ef766d 100644
--- a/plugins/jetpack/modules/after-the-deadline/atd-autoproofread.js
+++ b/plugins/jetpack/modules/after-the-deadline/atd-autoproofread.js
@@ -37,13 +37,13 @@ function AtD_submit_check_callback(count) {
} else {
var original_post_status = jQuery('#original_post_status').val()
- /* Okay, the user has tried to publish/update already but there are still errors. Ask them what to do */
+ /* Okay, the user has tried to publish/update already but there are still errors. Ask them what to do */
var message;
if ( original_post_status == 'publish' )
message = AtD.getLang('dialog_confirm_post_publish', 'The proofreader has suggestions for this post. Are you sure you want to publish it?\n\nPress OK to publish your post, or Cancel to view the suggestions and edit your post.');
else
message = AtD.getLang('dialog_confirm_post_update', 'The proofreader has suggestions for this post. Are you sure you want to update it?\n\nPress OK to update your post, or Cancel to view the suggestions and edit your post.');
-
+
if ( confirm( message ) ) {
AtD_update_post();
} else {
@@ -66,7 +66,7 @@ function AtD_kill_autoproofread() {
function AtD_update_post() {
if ( typeof(tinyMCE) == 'undefined' || !tinyMCE.activeEditor || tinyMCE.activeEditor.isHidden() )
- AtD_restore_if_proofreading();
+ AtD_restore_if_proofreading();
jQuery('#publish').unbind('click.AtD_submit_check').click();
}
diff --git a/plugins/jetpack/modules/after-the-deadline/atd-nonvis-editor-plugin.js b/plugins/jetpack/modules/after-the-deadline/atd-nonvis-editor-plugin.js
index 5d84497d..88f2d9c8 100644
--- a/plugins/jetpack/modules/after-the-deadline/atd-nonvis-editor-plugin.js
+++ b/plugins/jetpack/modules/after-the-deadline/atd-nonvis-editor-plugin.js
@@ -3,7 +3,7 @@ var AtD_qtbutton;
function AtD_restore_text_area()
{
/* clear the error HTML out of the preview div */
- AtD.remove('content');
+ AtD.remove('content');
/* swap the preview div for the textarea, notice how I have to restore the appropriate class/id/style attributes */
var content = jQuery('#content').html();
@@ -13,7 +13,7 @@ function AtD_restore_text_area()
jQuery('#content').replaceWith( AtD.content_canvas );
jQuery('#content').val( content.replace(/\&lt\;/g, '<').replace(/\&gt\;/g, '>').replace(/\&amp;/g, '&') );
- jQuery('#content').height(AtD.height);
+ jQuery('#content').height(AtD.height);
if ( AtD_qtbutton ) {
/* change the link text back to its original label */
@@ -42,7 +42,7 @@ if ( typeof(QTags) != 'undefined' && QTags.addButton ) {
}
function AtD_restore_if_proofreading() {
- if ( AtD_qtbutton && jQuery(AtD_qtbutton).val() == AtD.getLang('button_edit_text', 'edit text') )
+ if ( AtD_qtbutton && jQuery(AtD_qtbutton).val() == AtD.getLang('button_edit_text', 'edit text') )
AtD_restore_text_area();
}
@@ -84,8 +84,8 @@ function AtD_check(button) {
/* If the text of the link says edit comment, then restore the textarea so the user can edit the text */
- if ( jQuery(AtD_qtbutton).val() == AtD.getLang('button_edit_text', 'edit text') ) {
- AtD_restore_text_area();
+ if ( jQuery(AtD_qtbutton).val() == AtD.getLang('button_edit_text', 'edit text') ) {
+ AtD_restore_text_area();
} else {
/* initialize some of the stuff related to this plugin */
if ( !AtD.height ) {
@@ -124,7 +124,7 @@ function AtD_check(button) {
} else {
jQuery('#content').replaceWith('<div class="input" id="content">' + text + '</div>');
jQuery('#content').css( { 'overflow' : 'auto', 'background-color' : 'white', 'color' : 'black', 'white-space' : 'pre-wrap' } );
- jQuery('#content').height(AtD.height);
+ jQuery('#content').height(AtD.height);
}
/* kill autosave... :) */
@@ -144,16 +144,16 @@ function AtD_check(button) {
ready: function(errorCount) {
jQuery(AtD_qtbutton).attr('disabled', false);
- if ( typeof callback === 'function' )
+ if ( typeof callback === 'function' )
callback( errorCount );
},
error: function(reason) {
jQuery(AtD_qtbutton).attr('disabled', false);
- if ( typeof callback === 'function' )
+ if ( typeof callback === 'function' )
callback( -1 );
- else
+ else
alert( AtD.getLang('message_server_error', 'There was a problem communicating with the Proofreading service. Try again in one minute.') );
AtD_restore_if_proofreading();
@@ -164,7 +164,7 @@ function AtD_check(button) {
if ( text != null )
element.replaceWith( text );
- },
+ },
explain: function(url) {
var left = (screen.width / 2) - (480 / 2);
diff --git a/plugins/jetpack/modules/after-the-deadline/atd.core.js b/plugins/jetpack/modules/after-the-deadline/atd.core.js
index 0e3d1c4c..5d6efc91 100644
--- a/plugins/jetpack/modules/after-the-deadline/atd.core.js
+++ b/plugins/jetpack/modules/after-the-deadline/atd.core.js
@@ -74,18 +74,18 @@ AtDCore.prototype.showTypes = function(string) {
});
this.map(this.ignore_types, function(string) {
- if (types[string] != undefined)
+ if (types[string] != undefined)
ignore_types.push(string);
});
this.ignore_types = ignore_types;
};
-/*
+/*
* Error Parsing Code
*/
-AtDCore.prototype.makeError = function(error_s, tokens, type, seps, pre) {
+AtDCore.prototype.makeError = function(error_s, tokens, type, seps, pre) {
var struct = new Object();
struct.type = type;
struct.string = error_s;
@@ -110,20 +110,20 @@ AtDCore.prototype.makeError = function(error_s, tokens, type, seps, pre) {
};
AtDCore.prototype.addToErrorStructure = function(errors, list, type, seps) {
- var parent = this;
+ var parent = this;
this.map(list, function(error) {
var tokens = error["word"].split(/\s+/);
var pre = error["pre"];
var first = tokens[0];
- if (errors['__' + first] == undefined) {
+ if (errors['__' + first] == undefined) {
errors['__' + first] = new Object();
errors['__' + first].pretoks = {};
errors['__' + first].defaults = new Array();
}
- if (pre == "") {
+ if (pre == "") {
errors['__' + first].defaults.push(parent.makeError(error["word"], tokens, type, seps, pre));
} else {
if (errors['__' + first].pretoks['__' + pre] == undefined)
@@ -138,7 +138,7 @@ AtDCore.prototype.buildErrorStructure = function(spellingList, enrichmentList, g
var seps = this._getSeparators();
var errors = {};
- this.addToErrorStructure(errors, spellingList, "hiddenSpellError", seps);
+ this.addToErrorStructure(errors, spellingList, "hiddenSpellError", seps);
this.addToErrorStructure(errors, grammarList, "hiddenGrammarError", seps);
this.addToErrorStructure(errors, enrichmentList, "hiddenSuggestion", seps);
return errors;
@@ -153,7 +153,7 @@ AtDCore.prototype._getSeparators = function() {
re += '\\' + str.charAt(i);
return "(?:(?:[\xa0" + re + "])|(?:\\-\\-))+";
-};
+};
AtDCore.prototype.processXML = function(responseXML) {
@@ -183,8 +183,8 @@ AtDCore.prototype.processXML = function(responseXML) {
var errorContext;
- if (errors[i].getElementsByTagName('precontext').item(0).firstChild != null)
- errorContext = errors[i].getElementsByTagName('precontext').item(0).firstChild.data;
+ if (errors[i].getElementsByTagName('precontext').item(0).firstChild != null)
+ errorContext = errors[i].getElementsByTagName('precontext').item(0).firstChild.data;
else
errorContext = "";
@@ -236,11 +236,11 @@ AtDCore.prototype.processXML = function(responseXML) {
if (errorDescription == "Repeated Word")
suggestion["description"] = this.getLang('menu_title_repeated_word', 'Repeated Word');
-
+
if (errorDescription == "Did you mean...")
suggestion["description"] = this.getLang('menu_title_confused_word', 'Did you mean...');
} // end if ignore[errorString] == undefined
- } // end if
+ } // end if
} // end for loop
var errorStruct;
@@ -265,10 +265,10 @@ AtDCore.prototype.findSuggestion = function(element) {
var errorDescription = undefined;
var len = this.suggestions.length;
-
+
for (var i = 0; i < len; i++) {
var key = this.suggestions[i]["string"];
-
+
if ((context == "" || context == this.suggestions[i]["context"]) && this.suggestions[i]["matcher"].test(text)) {
errorDescription = this.suggestions[i];
break;
@@ -299,7 +299,7 @@ TokenIterator.prototype.next = function() {
if (current[0] == "'")
current = current.substring(1, current.length);
- if (current[current.length - 1] == "'")
+ if (current[current.length - 1] == "'")
current = current.substring(0, current.length - 1);
}
@@ -311,7 +311,7 @@ TokenIterator.prototype.hasNext = function() {
};
TokenIterator.prototype.hasNextN = function(n) {
- return (this.index + n) < this.tokens.length;
+ return (this.index + n) < this.tokens.length;
};
TokenIterator.prototype.skip = function(m, n) {
@@ -334,10 +334,10 @@ TokenIterator.prototype.peek = function(n) {
return peepers;
};
-/*
+/*
* code to manage highlighting of errors
*/
-AtDCore.prototype.markMyWords = function(container_nodes, errors) {
+AtDCore.prototype.markMyWords = function(container_nodes, errors) {
var seps = new RegExp(this._getSeparators());
var nl = new Array();
var ecount = 0; /* track number of highlighted errors */
@@ -345,16 +345,16 @@ AtDCore.prototype.markMyWords = function(container_nodes, errors) {
/* Collect all text nodes */
/* Our goal--ignore nodes that are already wrapped */
-
+
this._walk(container_nodes, function(n) {
if (n.nodeType == 3 && !parent.isMarkedNode(n))
nl.push(n);
});
-
- /* walk through the relevant nodes */
-
+
+ /* walk through the relevant nodes */
+
var iterator;
-
+
this.map(nl, function(n) {
var v;
@@ -431,7 +431,7 @@ AtDCore.prototype.markMyWords = function(container_nodes, errors) {
return parent.create('<span class="mceItemHidden">&nbsp;</span>' + node.nodeValue.substr(1, node.nodeValue.length - 1).replace(regexp, result), false);
else
return parent.create(node.nodeValue.replace(regexp, result), false);
- }
+ }
else {
var contents = parent.contents(node);
@@ -462,8 +462,8 @@ AtDCore.prototype.markMyWords = function(container_nodes, errors) {
parent.replaceWith(n, newNode);
}
- }
- });
+ }
+ });
return ecount;
};
@@ -474,9 +474,9 @@ AtDCore.prototype._walk = function(elements, f) {
f.call(f, elements[i]);
this._walk(this.contents(elements[i]), f);
}
-};
+};
-AtDCore.prototype.removeWords = function(node, w) {
+AtDCore.prototype.removeWords = function(node, w) {
var count = 0;
var parent = this;
@@ -518,7 +518,7 @@ AtDCore.prototype.applySuggestion = function(element, suggestion) {
}
};
-/*
+/*
* Check for an error
*/
AtDCore.prototype.hasErrorMessage = function(xmlr) {
diff --git a/plugins/jetpack/modules/after-the-deadline/atd.css b/plugins/jetpack/modules/after-the-deadline/atd.css
index 5014feac..2f59bd21 100644
--- a/plugins/jetpack/modules/after-the-deadline/atd.css
+++ b/plugins/jetpack/modules/after-the-deadline/atd.css
@@ -25,7 +25,7 @@
* Project : http://jquery-spellchecker.googlecode.com
*/
-#suggestmenu
+#suggestmenu
{
min-width: 122px;
background: #ebeaeb;
@@ -39,27 +39,27 @@
font-family: Tahoma, Verdana, Arial, Helvetica;
}
-#suggestmenu strong
+#suggestmenu strong
{
background: #cccccc;
font-weight: bold;
- padding:3px 6px 3px 6px;
- display:block;
+ padding:3px 6px 3px 6px;
+ display:block;
border:1px solid #dddddd;
- border-bottom: 1px solid #aaaaaa;
+ border-bottom: 1px solid #aaaaaa;
color: black;
}
-#suggestmenu em
+#suggestmenu em
{
- text-align:center;
- padding:3px 6px 3px 6px;
- display:block;
+ text-align:center;
+ padding:3px 6px 3px 6px;
+ display:block;
border-top:1px solid #ccc;
border-left:1px solid #ccc;
}
-#suggestmenu a, #suggestmenu a:visited
+#suggestmenu a, #suggestmenu a:visited
{
background: #ebeaeb;
border-left:1px solid #dddddd;
@@ -72,34 +72,34 @@
outline:none
}
-#suggestmenu a.first, #suggestmenu a.first:visited
+#suggestmenu a.first, #suggestmenu a.first:visited
{
border-top:1px solid #dddddd;
}
-.spell_sep_bottom
+.spell_sep_bottom
{
border-bottom: 1px solid #dddddd;
}
-.spell_sep_top
+.spell_sep_top
{
border-top: 1px solid #aaaaaa;
}
-#suggestmenu a:hover
+#suggestmenu a:hover
{
color:#000;
background: #f5f5f5;
}
-#suggestmenu .foot
+#suggestmenu .foot
{
border-top:1px solid #aaaaaa;
background:#fff
}
-#suggestmenu .foot a, #suggestmenu .foot a:visited
+#suggestmenu .foot a, #suggestmenu .foot a:visited
{
outline:none
}
diff --git a/plugins/jetpack/modules/after-the-deadline/config-options.php b/plugins/jetpack/modules/after-the-deadline/config-options.php
index 097b062d..db4a49c7 100644
--- a/plugins/jetpack/modules/after-the-deadline/config-options.php
+++ b/plugins/jetpack/modules/after-the-deadline/config-options.php
@@ -49,8 +49,8 @@ function AtD_display_options_form() {
<td>
<p><?php _e( 'Automatically proofread content when:', 'jetpack' ); ?>
- <p><?php
- AtD_print_option( 'onpublish', __('a post or page is first published', 'jetpack'), $options_check_when );
+ <p><?php
+ AtD_print_option( 'onpublish', __('a post or page is first published', 'jetpack'), $options_check_when );
echo '<br />';
AtD_print_option( 'onupdate', __('a post or page is updated', 'jetpack'), $options_check_when );
?></p>
@@ -59,12 +59,12 @@ function AtD_display_options_form() {
<p><?php _e('Enable proofreading for the following grammar and style rules when writing posts and pages:', 'jetpack'); ?></p>
- <p><?php
+ <p><?php
AtD_print_option( 'Bias Language', __('Bias Language', 'jetpack'), $options_show_types );
echo '<br />';
AtD_print_option( 'Cliches', __('Clich&eacute;s', 'jetpack'), $options_show_types );
echo '<br />';
- AtD_print_option( 'Complex Expression', __('Complex Phrases', 'jetpack'), $options_show_types );
+ AtD_print_option( 'Complex Expression', __('Complex Phrases', 'jetpack'), $options_show_types );
echo '<br />';
AtD_print_option( 'Diacritical Marks', __('Diacritical Marks', 'jetpack'), $options_show_types );
echo '<br />';
@@ -72,15 +72,15 @@ function AtD_display_options_form() {
echo '<br />';
AtD_print_option( 'Hidden Verbs', __('Hidden Verbs', 'jetpack'), $options_show_types );
echo '<br />';
- AtD_print_option( 'Jargon Language', __('Jargon', 'jetpack'), $options_show_types );
+ AtD_print_option( 'Jargon Language', __('Jargon', 'jetpack'), $options_show_types );
echo '<br />';
- AtD_print_option( 'Passive voice', __('Passive Voice', 'jetpack'), $options_show_types );
+ AtD_print_option( 'Passive voice', __('Passive Voice', 'jetpack'), $options_show_types );
echo '<br />';
- AtD_print_option( 'Phrases to Avoid', __('Phrases to Avoid', 'jetpack'), $options_show_types );
+ AtD_print_option( 'Phrases to Avoid', __('Phrases to Avoid', 'jetpack'), $options_show_types );
echo '<br />';
- AtD_print_option( 'Redundant Expression', __('Redundant Phrases', 'jetpack'), $options_show_types );
+ AtD_print_option( 'Redundant Expression', __('Redundant Phrases', 'jetpack'), $options_show_types );
?></p>
- <p><?php printf( __( '<a href="%s">Learn more</a> about these options.', 'jetpack' ), 'http://support.wordpress.com/proofreading/' );
+ <p><?php printf( __( '<a href="%s">Learn more</a> about these options.', 'jetpack' ), 'http://support.wordpress.com/proofreading/' );
?></p>
<p style="font-weight: bold"><?php _e( 'Language', 'jetpack' ); ?></font>
@@ -103,14 +103,14 @@ function AtD_display_options_form() {
*/
function AtD_get_options( $user_id, $name ) {
$options_raw = AtD_get_setting( $user_id, $name, 'single' );
-
+
$options = array();
$options['name'] = $name;
if ( $options_raw )
- foreach ( explode( ',', $options_raw ) as $option )
+ foreach ( explode( ',', $options_raw ) as $option )
$options[ $option ] = 1;
-
+
return $options;
}
@@ -125,6 +125,6 @@ function AtD_update_options( $user_id, $name ) {
} else {
AtD_update_setting( $user_id, AtD_sanitize( $name ), '');
}
-
+
return;
}
diff --git a/plugins/jetpack/modules/after-the-deadline/config-unignore.php b/plugins/jetpack/modules/after-the-deadline/config-unignore.php
index 9d49fa20..84b18ff6 100644
--- a/plugins/jetpack/modules/after-the-deadline/config-unignore.php
+++ b/plugins/jetpack/modules/after-the-deadline/config-unignore.php
@@ -1,5 +1,5 @@
<?php
-/*
+/*
* Called by the TinyMCE plugin when Ignore Always is clicked (setup as an action through admin-ajax.php)
*/
function AtD_ignore_call() {
@@ -24,7 +24,7 @@ function AtD_ignore_call() {
die();
}
-/*
+/*
* Called when a POST occurs, used to save AtD ignored phrases
*/
function AtD_process_unignore_update() {
@@ -100,10 +100,10 @@ function atd_ignore () {
/* update the UI */
atd_show_phrases( ignored );
- jQuery( '#AtD_add_ignore' ).val('');
+ jQuery( '#AtD_add_ignore' ).val('');
/* show that nifteroo messaroo to the useroo */
- jQuery( '#AtD_message' ).show();
+ jQuery( '#AtD_message' ).show();
}
function atd_ignore_init() {
@@ -124,7 +124,7 @@ else
<input type="hidden" name="AtD_ignored_phrases" id="AtD_ignored_phrases" value="<?php echo esc_attr( $ignores ); ?>">
<p style="font-weight: bold"><?php _e( 'Ignored Phrases', 'jetpack' ); ?></font>
-
+
<p><?php _e( 'Identify words and phrases to ignore while proofreading your posts and pages:', 'jetpack' ); ?></p>
<p><input type="text" id="AtD_add_ignore" name="AtD_add_ignore"> <input type="button" value="<?php _e( 'Add', 'jetpack' ); ?>" onclick="javascript:atd_ignore()"></p>
diff --git a/plugins/jetpack/modules/after-the-deadline/install_atd_l10n.js b/plugins/jetpack/modules/after-the-deadline/install_atd_l10n.js
index 7d18bb9a..3215de66 100644
--- a/plugins/jetpack/modules/after-the-deadline/install_atd_l10n.js
+++ b/plugins/jetpack/modules/after-the-deadline/install_atd_l10n.js
@@ -2,7 +2,7 @@
function atd_sprintf(format, values) {
var result = format;
for (var x = 0; x < values.length; x++)
- result = result.replace(new RegExp('%' + (x + 1) + '\\$', 'g'), values[x]);
+ result = result.replace(new RegExp('%' + (x + 1) + '\\$', 'g'), values[x]);
return result;
}
@@ -15,7 +15,7 @@ function install_atd_l10n() {
/* set the AtD l10n instance */
AtD.addI18n(AtD_l10n_r0ar);
}
-
+
/* document.ready() does not execute in IE6 unless it's at the bottom of the page. oi! */
if (navigator.appName == 'Microsoft Internet Explorer')
setTimeout( install_atd_l10n, 2500 );
diff --git a/plugins/jetpack/modules/after-the-deadline/jquery.atd.js b/plugins/jetpack/modules/after-the-deadline/jquery.atd.js
index e5201079..ee2ef6be 100644
--- a/plugins/jetpack/modules/after-the-deadline/jquery.atd.js
+++ b/plugins/jetpack/modules/after-the-deadline/jquery.atd.js
@@ -5,7 +5,7 @@
* Project : http://www.afterthedeadline.com/development.slp
* Contact : raffi@automattic.com
*
- * Derived from:
+ * Derived from:
*
* jquery.spellchecker.js - a simple jQuery Spell Checker
* Copyright (c) 2008 Richard Willis
@@ -14,7 +14,7 @@
* Contact : willis.rh@gmail.com
*/
-var AtD =
+var AtD =
{
rpc : '', /* see the proxy.php that came with the AtD/TinyMCE plugin */
rpc_css : 'http://www.polishmywriting.com/atd-jquery/server/proxycss.php?data=', /* you may use this, but be nice! */
@@ -46,8 +46,8 @@ AtD.showTypes = function(string) {
AtD.checkCrossAJAX = function(container_id, callback_f) {
/* checks if a global var for click stats exists and increments it if it does... */
- if (typeof AtD_proofread_click_count != "undefined")
- AtD_proofread_click_count++;
+ if (typeof AtD_proofread_click_count != "undefined")
+ AtD_proofread_click_count++;
AtD.callback_f = callback_f; /* remember the callback for later */
AtD.remove(container_id);
@@ -74,7 +74,7 @@ AtD.checkCrossAJAX = function(container_id, callback_f) {
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.loadXML(response);
- }
+ }
else {
xml = (new DOMParser()).parseFromString(response, 'text/xml');
}
@@ -85,7 +85,7 @@ AtD.checkCrossAJAX = function(container_id, callback_f) {
AtD.callback_f.error(AtD.core.getErrorMessage(xml));
return;
- }
+ }
/* highlight the errors */
@@ -107,12 +107,12 @@ AtD.checkCrossAJAX = function(container_id, callback_f) {
AtD.check = function(container_id, callback_f) {
/* checks if a global var for click stats exists and increments it if it does... */
if (typeof AtD_proofread_click_count != "undefined")
- AtD_proofread_click_count++;
+ AtD_proofread_click_count++;
AtD.callback_f = callback_f; /* remember the callback for later */
- AtD.remove(container_id);
-
+ AtD.remove(container_id);
+
var container = jQuery('#' + container_id);
var html = container.html();
@@ -124,14 +124,14 @@ AtD.check = function(container_id, callback_f) {
type : "POST",
url : AtD.rpc + '/checkDocument',
data : 'key=' + AtD.api_key + '&data=' + text,
- format : 'raw',
+ format : 'raw',
dataType : (jQuery.browser.msie) ? "text" : "xml",
error : function(XHR, status, error) {
if (AtD.callback_f != undefined && AtD.callback_f.error != undefined)
AtD.callback_f.error(status + ": " + error);
},
-
+
success : function(data) {
/* apparently IE likes to return XML as plain text-- work around from:
http://docs.jquery.com/Specifying_the_Data_Type_for_AJAX_Requests */
@@ -141,7 +141,7 @@ AtD.check = function(container_id, callback_f) {
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.loadXML(data);
- }
+ }
else {
xml = data;
}
@@ -169,7 +169,7 @@ AtD.check = function(container_id, callback_f) {
}
});
};
-
+
AtD.remove = function(container_id) {
AtD._removeWords(container_id, null);
};
@@ -182,7 +182,7 @@ AtD.clickListener = function(event) {
AtD.processXML = function(container_id, responseXML) {
var results = AtD.core.processXML(responseXML);
-
+
if (results.count > 0)
results.count = AtD.core.markMyWords(jQuery('#' + container_id).contents(), results.errors);
@@ -214,7 +214,7 @@ AtD.editSelection = function() {
};
AtD.ignoreSuggestion = function() {
- AtD.core.removeParent(AtD.errorElement);
+ AtD.core.removeParent(AtD.errorElement);
AtD.counter --;
if (AtD.counter == 0 && AtD.callback_f != undefined && AtD.callback_f.success != undefined)
@@ -253,7 +253,7 @@ AtD.suggest = function(element) {
suggest.hide();
}
- /* find the correct suggestions object */
+ /* find the correct suggestions object */
errorDescription = AtD.core.findSuggestion(element);
@@ -297,7 +297,7 @@ AtD.suggest = function(element) {
suggest.append('<a href="javascript:AtD.ignoreAll(\'' + AtD.container + '\')">' + AtD.getLang('menu_option_ignore_always', 'Ignore always') + '</a>');
else
suggest.append('<a href="javascript:AtD.ignoreAll(\'' + AtD.container + '\')">' + AtD.getLang('menu_option_ignore_all', 'Ignore all') + '</a>');
-
+
suggest.append('<a href="javascript:AtD.editSelection(\'' + AtD.container + '\')" class="spell_sep_bottom spell_sep_top">' + AtD.getLang('menu_option_edit_selection', 'Edit Selection...') + '</a>');
}
else {
@@ -313,8 +313,8 @@ AtD.suggest = function(element) {
var width = jQuery(element).width();
/* a sanity check for Internet Explorer--my favorite browser in every possible way */
- if (width > 100)
- width = 50;
+ if (width > 100)
+ width = 50;
jQuery(suggest).css({ left: (pos.left + width) + 'px', top: pos.top + 'px' });
@@ -327,13 +327,13 @@ AtD.suggest = function(element) {
setTimeout(function() {
jQuery("body").bind("click", function() {
if (!AtD.suggestShow)
- jQuery('#suggestmenu').fadeOut(200);
+ jQuery('#suggestmenu').fadeOut(200);
});
}, 1);
setTimeout(function() {
AtD.suggestShow = false;
- }, 2);
+ }, 2);
};
AtD._removeWords = function(container_id, w) {
@@ -341,7 +341,7 @@ AtD._removeWords = function(container_id, w) {
};
/*
- * Set prototypes used by AtD Core UI
+ * Set prototypes used by AtD Core UI
*/
AtD.initCoreModule = function() {
var core = new AtDCore();
diff --git a/plugins/jetpack/modules/after-the-deadline/proxy.php b/plugins/jetpack/modules/after-the-deadline/proxy.php
index 04bbd285..3d5ef3b6 100644
--- a/plugins/jetpack/modules/after-the-deadline/proxy.php
+++ b/plugins/jetpack/modules/after-the-deadline/proxy.php
@@ -21,21 +21,21 @@ function AtD_http_post( $request, $host, $path, $port = 80 ) {
$AtD_url = "http://{$host}{$path}";
$response = wp_remote_post( $AtD_url, $http_args );
$code = (int) wp_remote_retrieve_response_code( $response );
-
+
if ( is_wp_error( $response ) ) {
do_action( 'atd_http_post_error', 'http-error' );
return array();
} elseif ( 200 != $code ) {
do_action( 'atd_http_post_error', $code );
}
-
+
return array(
- wp_remote_retrieve_headers( $response ),
+ wp_remote_retrieve_headers( $response ),
wp_remote_retrieve_body( $response ),
);
}
-/*
+/*
* This function is called as an action handler to admin-ajax.php
*/
function AtD_redirect_call() {
diff --git a/plugins/jetpack/modules/after-the-deadline/tinymce/editor_plugin.js b/plugins/jetpack/modules/after-the-deadline/tinymce/editor_plugin.js
index fc9f01fe..f9251cd9 100644
--- a/plugins/jetpack/modules/after-the-deadline/tinymce/editor_plugin.js
+++ b/plugins/jetpack/modules/after-the-deadline/tinymce/editor_plugin.js
@@ -1,5 +1,5 @@
/*
- * TinyMCE Writing Improvement Tool Plugin
+ * TinyMCE Writing Improvement Tool Plugin
* Author: Raphael Mudge (raffi@automattic.com)
*
* http://www.afterthedeadline.com
@@ -15,15 +15,15 @@
* Moxiecode Spell Checker plugin released under the LGPL with TinyMCE
*/
-(function()
+(function()
{
- var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM;
+ var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM;
- tinymce.create('tinymce.plugins.AfterTheDeadlinePlugin',
+ tinymce.create('tinymce.plugins.AfterTheDeadlinePlugin',
{
- getInfo : function()
+ getInfo : function()
{
- return
+ return
({
longname : 'After The Deadline',
author : 'Raphael Mudge',
@@ -40,12 +40,12 @@
core.map = each;
- core.getAttrib = function(node, key)
- {
- return editor.dom.getAttrib(node, key);
+ core.getAttrib = function(node, key)
+ {
+ return editor.dom.getAttrib(node, key);
};
- core.findSpans = function(parent)
+ core.findSpans = function(parent)
{
if (parent == undefined)
return editor.dom.select('span');
@@ -53,39 +53,39 @@
return editor.dom.select('span', parent);
};
- core.hasClass = function(node, className)
- {
- return editor.dom.hasClass(node, className);
+ core.hasClass = function(node, className)
+ {
+ return editor.dom.hasClass(node, className);
};
-
- core.contents = function(node)
- {
- return node.childNodes;
+
+ core.contents = function(node)
+ {
+ return node.childNodes;
};
- core.replaceWith = function(old_node, new_node)
- {
- return editor.dom.replace(new_node, old_node);
+ core.replaceWith = function(old_node, new_node)
+ {
+ return editor.dom.replace(new_node, old_node);
};
- core.create = function(node_html)
- {
+ core.create = function(node_html)
+ {
return editor.dom.create('span', { 'class': 'mceItemHidden' }, node_html);
};
- core.removeParent = function(node)
+ core.removeParent = function(node)
{
editor.dom.remove(node, 1);
return node;
};
- core.remove = function(node)
- {
- editor.dom.remove(node);
+ core.remove = function(node)
+ {
+ editor.dom.remove(node);
};
- core.getLang = function(key, defaultk)
- {
+ core.getLang = function(key, defaultk)
+ {
return editor.getLang("AtD." + key, defaultk);
};
@@ -93,9 +93,9 @@
core.showTypes(editor.getParam("atd_show_types", ""));
return core;
},
-
+
/* called when the plugin is initialized */
- init : function(ed, url)
+ init : function(ed, url)
{
if ( typeof(AtDCore) == 'undefined' )
return;
@@ -118,7 +118,7 @@
}
/* add a command to request a document check and process the results. */
- editor.addCommand('mceWritingImprovementTool', function(callback)
+ editor.addCommand('mceWritingImprovementTool', function(callback)
{
/* checks if a global var for click stats exists and increments it if it does... */
if (typeof AtD_proofread_click_count != "undefined")
@@ -162,7 +162,7 @@
if (results.count > 0)
{
ecount = plugin.markMyWords(results.errors);
- ed.suggestions = results.suggestions;
+ ed.suggestions = results.suggestions;
}
if (ecount == 0 && (!callback || callback == undefined))
@@ -171,9 +171,9 @@
callback(ecount);
});
});
-
+
/* load cascading style sheet for this plugin */
- editor.onInit.add(function()
+ editor.onInit.add(function()
{
/* loading the content.css file, why? I have no clue */
if (editor.settings.content_css !== false)
@@ -189,13 +189,13 @@
editor.onContextMenu.add(plugin._showMenu, plugin);
/* strip out the markup before the contents is serialized (and do it on a copy of the markup so we don't affect the user experience) */
- editor.onPreProcess.add(function(sender, object)
+ editor.onPreProcess.add(function(sender, object)
{
var dom = sender.dom;
- each(dom.select('span', object.node).reverse(), function(n)
+ each(dom.select('span', object.node).reverse(), function(n)
{
- if (n && (dom.hasClass(n, 'hiddenGrammarError') || dom.hasClass(n, 'hiddenSpellError') || dom.hasClass(n, 'hiddenSuggestion') || dom.hasClass(n, 'mceItemHidden') || (dom.getAttrib(n, 'class') == "" && dom.getAttrib(n, 'style') == "" && dom.getAttrib(n, 'id') == "" && !dom.hasClass(n, 'Apple-style-span') && dom.getAttrib(n, 'mce_name') == "")))
+ if (n && (dom.hasClass(n, 'hiddenGrammarError') || dom.hasClass(n, 'hiddenSpellError') || dom.hasClass(n, 'hiddenSuggestion') || dom.hasClass(n, 'mceItemHidden') || (dom.getAttrib(n, 'class') == "" && dom.getAttrib(n, 'style') == "" && dom.getAttrib(n, 'id') == "" && !dom.hasClass(n, 'Apple-style-span') && dom.getAttrib(n, 'mce_name') == "")))
{
dom.remove(n, 1);
}
@@ -203,7 +203,7 @@
});
/* cleanup the HTML before executing certain commands */
- editor.onBeforeExecCommand.add(function(editor, command)
+ editor.onBeforeExecCommand.add(function(editor, command)
{
if (command == 'mceCodeEditor')
{
@@ -214,15 +214,15 @@
plugin._done();
}
});
-
- ed.addButton('AtD', {
+
+ ed.addButton('AtD', {
title: ed.getLang('AtD.button_proofread_tooltip', 'Proofread Writing'),
- image: ed.getParam('atd_button_url', url + '/atdbuttontr.gif'),
+ image: ed.getParam('atd_button_url', url + '/atdbuttontr.gif'),
cmd: 'mceWritingImprovementTool'
});
},
- _removeWords : function(w)
+ _removeWords : function(w)
{
var ed = this.editor, dom = ed.dom, se = ed.selection, b = se.getBookmark();
@@ -247,17 +247,17 @@
return ecount;
},
- _showMenu : function(ed, e)
+ _showMenu : function(ed, e)
{
var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin());
var plugin = this;
- if (!m)
+ if (!m)
{
p1 = DOM.getPos(ed.getContentAreaContainer());
//p2 = DOM.getPos(ed.getContainer());
- m = ed.controlManager.createDropMenu('spellcheckermenu',
+ m = ed.controlManager.createDropMenu('spellcheckermenu',
{
offset_x : p1.x,
offset_y : p1.y,
@@ -292,8 +292,8 @@
(function(sugg)
{
m.add({
- title : sugg,
- onclick : function()
+ title : sugg,
+ onclick : function()
{
ed.core.applySuggestion(e.target, sugg);
t._checkDone();
@@ -304,14 +304,14 @@
m.addSeparator();
}
-
+
if (errorDescription != undefined && errorDescription["moreinfo"] != null)
{
(function(url)
{
m.add({
title : plugin.editor.getLang('AtD.menu_option_explain', 'Explain...'),
- onclick : function()
+ onclick : function()
{
ed.windowManager.open({
url : url,
@@ -328,7 +328,7 @@
m.add({
title : plugin.editor.getLang('AtD.menu_option_ignore_once', 'Ignore suggestion'),
- onclick : function()
+ onclick : function()
{
dom.remove(e.target, 1);
t._checkDone();
@@ -339,7 +339,7 @@
{
m.add({
title : plugin.editor.getLang('AtD.menu_option_ignore_always', 'Ignore always'),
- onclick : function()
+ onclick : function()
{
var url = t.editor.getParam('atd_ignore_rpc_url', '{backend}');
@@ -347,10 +347,10 @@
{
/* Default scheme is to save ignore preferences in a cookie */
- var ignore = tinymce.util.Cookie.getHash('atd_ignore');
+ var ignore = tinymce.util.Cookie.getHash('atd_ignore');
if (ignore == undefined) { ignore = {}; }
ignore[e.target.innerHTML] = 1;
-
+
tinymce.util.Cookie.setHash('atd_ignore', ignore, new Date( (new Date().getTime()) + 157680000000) );
}
else
@@ -370,7 +370,7 @@
},
error : function( type, req, o )
{
- alert( "Ignore preference save failed\n" + type + "\n" + req.status + "\nAt: " + o.url );
+ alert( "Ignore preference save failed\n" + type + "\n" + req.status + "\nAt: " + o.url );
}
});
@@ -387,7 +387,7 @@
{
m.add({
title : plugin.editor.getLang('menu_option_ignore_all', 'Ignore all'),
- onclick : function()
+ onclick : function()
{
t._removeWords(e.target.innerHTML);
t._checkDone();
@@ -401,7 +401,7 @@
m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y);
return tinymce.dom.Event.cancel(e);
- }
+ }
else
{
m.hideMenu();
@@ -409,11 +409,11 @@
},
/* loop through editor DOM, call _done if no mce tags exist. */
- _checkDone : function()
+ _checkDone : function()
{
var t = this, ed = t.editor, dom = ed.dom, o;
- each(dom.select('span'), function(n)
+ each(dom.select('span'), function(n)
{
if (n && dom.hasClass(n, 'mceItemHidden'))
{
@@ -429,7 +429,7 @@
},
/* remove all tags, hide the menu, and fire a dom change event */
- _done : function()
+ _done : function()
{
var plugin = this;
plugin._removeWords();
@@ -448,24 +448,24 @@
var url = this.editor.getParam("atd_rpc_url", "{backend}");
var plugin = this;
- if (url == '{backend}' || id == '12345678')
+ if (url == '{backend}' || id == '12345678')
{
this.editor.setProgressState(0);
alert('Please specify: atd_rpc_url and atd_rpc_id');
return;
}
-
+
tinymce.util.XHR.send({
url : url + "/" + file,
content_type : 'text/xml',
type : "POST",
- data : "data=" + encodeURI(data).replace(/&/g, '%26') + "&key=" + id,
+ data : "data=" + encodeURI(data).replace(/&/g, '%26') + "&key=" + id,
async : true,
success : success,
error : function( type, req, o )
{
plugin.editor.setProgressState(0);
- alert( type + "\n" + req.status + "\nAt: " + o.url );
+ alert( type + "\n" + req.status + "\nAt: " + o.url );
}
});
}
diff --git a/plugins/jetpack/modules/carousel.php b/plugins/jetpack/modules/carousel.php
index 2637f43d..e8db24b7 100644
--- a/plugins/jetpack/modules/carousel.php
+++ b/plugins/jetpack/modules/carousel.php
@@ -5,6 +5,7 @@
* Module Description: Transform your standard image galleries into an immersive full-screen experience.
* Sort Order: 4
* First Introduced: 1.5
+ * Requires Connection: No
*/
include dirname( __FILE__ ) . '/carousel/jetpack-carousel.php';
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.css b/plugins/jetpack/modules/carousel/jetpack-carousel.css
index 49bdad8e..05854495 100644
--- a/plugins/jetpack/modules/carousel/jetpack-carousel.css
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel.css
@@ -48,7 +48,7 @@ only screen and (min-device-pixel-ratio: 1.5) {
background: #68c9e8; /* Safari */
color: #fff;
}
-
+
.jp-carousel-info ::-moz-selection {
background: #68c9e8; /* Firefox */
color: #fff;
@@ -133,7 +133,7 @@ div.jp-carousel-buttons a {
padding: 5px 2px 5px 0;
text-decoration: none !important;
text-shadow: none !important;
- vertical-align: baseline !important;
+ vertical-align: middle;
-webkit-font-smoothing: subpixel-antialiased;
}
@@ -481,7 +481,7 @@ div#carousel-reblog-box {
display: none;
}
-.jp-carousel-photo-info h1:before,
+.jp-carousel-photo-info h1:before,
.jp-carousel-photo-info h1:after,
.jp-carousel-left-column-wrapper h1:before,
.jp-carousel-left-column-wrapper h1:after {
@@ -693,7 +693,7 @@ textarea#jp-carousel-comment-form-comment-field {
border-radius: 3px;
overflow: hidden;
-webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
+ -moz-box-sizing: border-box;
box-sizing: border-box;
}
@@ -791,7 +791,7 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
}
#jp-carousel-comment-post-results {
- display: none;
+ display: none;
overflow:auto;
width:100%;
}
@@ -1050,14 +1050,14 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
margin: 0 10px !important;
}
- .jp-carousel-next-button, .jp-carousel-previous-button {
- display: none !important;
+ .jp-carousel-next-button, .jp-carousel-previous-button {
+ display: none !important;
}
.jp-carousel-buttons {
display: none !important;
}
-
+
.jp-carousel-image-meta {
float: none !important;
width: 100% !important;
@@ -1065,31 +1065,31 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
-webkit-box-sizing:border-box;
box-sizing: border-box;
}
-
+
.jp-carousel-close-hint {
font-weight: 800 !important;
font-size: 26px !important;
position: fixed !important;
top: -10px;
}
-
+
.jp-carousel-slide img {
filter: alpha(opacity=100);
opacity: 1;
}
-
+
.jp-carousel-wrap {
- background-color: #000;
+ background-color: #000;
}
-
+
.jp-carousel-fadeaway {
display: none;
}
-
+
#jp-carousel-comment-form-container {
display: none !important;
}
-
+
.jp-carousel-titleanddesc {
padding-top: 0 !important;
border: none !important;
@@ -1097,8 +1097,8 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
.jp-carousel-titleanddesc-title {
font-size: 1em !important;
}
-
+
.jp-carousel-left-column-wrapper {
padding: 0;
- }
+ }
}
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.js b/plugins/jetpack/modules/carousel/jetpack-carousel.js
index 43f1d1f7..f101dbf5 100644
--- a/plugins/jetpack/modules/carousel/jetpack-carousel.js
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel.js
@@ -54,9 +54,69 @@ jQuery(document).ready(function($) {
}, 200);
};
- var prepareGallery = function(){
- if (!overlay) {
+ // For each image in the carousel, emit likes widget markup
+ var getCarouselLikeWidgets = function( dataCarouselExtra ) {
+
+ // Only do this if likes is enabled
+ if ( "undefined" === typeof jetpackLikesWidgetQueue )
+ return "";
+
+ var blogId = dataCarouselExtra.likes_blog_id;
+ var attachmentId = 0;
+ var protocol = 'http';
+ var originDomain = 'http://wordpress.com';
+
+ if ( dataCarouselExtra.permalink.length ) {
+ var parts = dataCarouselExtra.permalink.split( ':' );
+ var protocol = parts[0];
+ if ( ( protocol != 'http' ) && ( protocol != 'https' ) ) {
+ protocol = 'http';
+ }
+
+ parts = dataCarouselExtra.permalink.split( '/' );
+ if ( parts.length >= 2 ) {
+ originDomain = protocol + "://" + parts[2];
+ }
+ }
+
+ var likesWidgetContainer = $("<div class='likes-widget-container'></div>");
+
+ $( 'div.gallery, div.tiled-gallery' ).find( 'img' ).each( function() {
+
+ attachmentId = $( this ).attr( "data-attachment-id" );
+ var dataSource = protocol + "://widgets.wp.com/likes/#blog_id=" + blogId + "&amp;post_id=" + attachmentId + "&amp;slim=1&amp;origin=" + originDomain;
+
+ if ( 'en' !== jetpackCarouselStrings.lang ) {
+ dataSource += "&amp;lang=" + jetpackCarouselStrings.lang;
+ }
+
+ var likesWidgetWrapper = $( "<div></div>" );
+ likesWidgetWrapper.addClass( "jetpack-likes-widget-wrapper" )
+ .addClass( "jetpack-likes-widget-unloaded" )
+ .addClass( "slim-likes-widget" )
+ .attr( "id", "like-post-wrapper-" + blogId + "-" + attachmentId )
+ .attr( "data-src", dataSource )
+ .attr( "data-name", "like-post-frame-" + blogId + "-" + attachmentId )
+ .attr( "data-attachment-id", attachmentId )
+ .css( "display", "none" )
+ .css( "vertical-align", "middle" );
+
+ var likesWidget = $( "<iframe class='post-likes-widget jetpack-likes-widget jetpack-resizeable'></iframe>" );
+ likesWidget.attr( "name", "like-post-frame-" + blogId + "-" + attachmentId )
+ .attr( "src", dataSource );
+ likesWidget.css( "display", "inline-block" );
+ likesWidgetWrapper.append( likesWidget );
+
+ likesWidgetWrapper.append( "<div class='post-likes-widget-placeholder'></div>" );
+
+ likesWidgetContainer.append( likesWidgetWrapper );
+ });
+
+ return likesWidgetContainer.html();
+ };
+ var prepareGallery = function( dataCarouselExtra ){
+ if (!overlay) {
overlay = $('<div></div>')
.addClass('jp-carousel-overlay')
.css({
@@ -68,6 +128,9 @@ jQuery(document).ready(function($) {
});
buttons = '<a class="jp-carousel-commentlink" href="#">' + jetpackCarouselStrings.comment + '</a>';
+ if ( 1 == jetpackCarouselStrings.is_logged_in ) {
+ }
+ buttons += getCarouselLikeWidgets( dataCarouselExtra );
buttons = $('<div class="jp-carousel-buttons">' + buttons + '</div>');
caption = $('<h2></h2>');
@@ -81,6 +144,11 @@ jQuery(document).ready(function($) {
'width' : '250px'
});
+ imageMeta.append( buttons );
+ imageMeta.append( "<ul class='jp-carousel-image-exif' style='display:none;'></ul>" );
+ imageMeta.append( "<a class='jp-carousel-image-download' style='display:none;'></a>" );
+ imageMeta.append( "<div class='jp-carousel-image-map' style='display:none;'></div>" );
+
titleAndDescription = $('<div></div>')
.addClass('jp-carousel-titleanddesc')
.css({
@@ -99,15 +167,20 @@ jQuery(document).ready(function($) {
commentFormMarkup += '<iframe src="'+iframeSrc+'" width="100%" height="'+iframeHeight+'" style="width:100%;height:'+iframeHeight+'px;" allowtransparency="true" frameBorder="0" scrolling="no" name="jp-carousel-comment-iframe" id="jp-carousel-comment-iframe"></iframe>';
} else if ( jetpackCarouselStrings.local_comments_commenting_as && jetpackCarouselStrings.local_comments_commenting_as.length ) {
// Jetpack comments not enabled, fallback to local comments
- commentFormMarkup += '<form id="jp-carousel-comment-form">';
- commentFormMarkup += '<textarea name="comment" class="jp-carousel-comment-form-field jp-carousel-comment-form-textarea" id="jp-carousel-comment-form-comment-field" placeholder="Write a comment&hellip;"></textarea>';
- commentFormMarkup += '<div id="jp-carousel-comment-form-submit-and-info-wrapper">';
- commentFormMarkup += '<div id="jp-carousel-comment-form-commenting-as">' + jetpackCarouselStrings.local_comments_commenting_as + '</div>';
- commentFormMarkup += '<input type="submit" name="submit" class="jp-carousel-comment-form-button" id="jp-carousel-comment-form-button-submit" value="'+jetpackCarouselStrings.post_comment+'" />';
- commentFormMarkup += '<span id="jp-carousel-comment-form-spinner">&nbsp;</span>';
- commentFormMarkup += '<div id="jp-carousel-comment-post-results"></div>';
- commentFormMarkup += '</div>';
- commentFormMarkup += '</form>';
+
+ if ( 1 != jetpackCarouselStrings.is_logged_in && 1 == jetpackCarouselStrings.comment_registration ) {
+ commentFormMarkup += '<div id="jp-carousel-comment-form-commenting-as">' + jetpackCarouselStrings.local_comments_commenting_as + '</div>';
+ } else {
+ commentFormMarkup += '<form id="jp-carousel-comment-form">';
+ commentFormMarkup += '<textarea name="comment" class="jp-carousel-comment-form-field jp-carousel-comment-form-textarea" id="jp-carousel-comment-form-comment-field" placeholder="Write a comment&hellip;"></textarea>';
+ commentFormMarkup += '<div id="jp-carousel-comment-form-submit-and-info-wrapper">';
+ commentFormMarkup += '<div id="jp-carousel-comment-form-commenting-as">' + jetpackCarouselStrings.local_comments_commenting_as + '</div>';
+ commentFormMarkup += '<input type="submit" name="submit" class="jp-carousel-comment-form-button" id="jp-carousel-comment-form-button-submit" value="'+jetpackCarouselStrings.post_comment+'" />';
+ commentFormMarkup += '<span id="jp-carousel-comment-form-spinner">&nbsp;</span>';
+ commentFormMarkup += '<div id="jp-carousel-comment-post-results"></div>';
+ commentFormMarkup += '</div>';
+ commentFormMarkup += '</form>';
+ }
}
commentFormMarkup += '</div>';
@@ -134,10 +207,6 @@ jQuery(document).ready(function($) {
});
leftWidth = ( $(window).width() - ( screenPadding * 2 ) ) - (imageMeta.width() + 40);
- if ( $.browser.mozilla )
- leftWidth -= 55;
- else if ( $.browser.msie )
- leftWidth -= 20;
leftWidth += 'px';
if (isMobile)
@@ -259,6 +328,10 @@ jQuery(document).ready(function($) {
container.animate({scrollTop: parseInt(info.position()['top'], 10)}, 'fast');
$('#jp-carousel-comment-form-submit-and-info-wrapper').slideDown('fast');
$('#jp-carousel-comment-form-comment-field').focus();
+ } else if ( target.hasClass('jp-carousel-comment-login') ) {
+ var url = jetpackCarouselStrings.login_url + '%23jp-carousel-' + attachment_id;
+
+ document.location.href = url;
} else if ( target.parents('#jp-carousel-comment-form-container').length ) {
var textarea = $('#jp-carousel-comment-form-comment-field')
.blur(function(){
@@ -320,12 +393,14 @@ jQuery(document).ready(function($) {
ajaxData['author'] = authorField.val();
ajaxData['url'] = urlField.val();
- if ( ! ajaxData['email'].length || ! ajaxData['email'].match('@') ) {
- gallery.jp_carousel('postCommentError', {'field': 'jp-carousel-comment-form-email-field', 'error': jetpackCarouselStrings.no_comment_email});
- return;
- } else if ( ! ajaxData['author'].length ) {
- gallery.jp_carousel('postCommentError', {'field': 'jp-carousel-comment-form-author-field', 'error': jetpackCarouselStrings.no_comment_author});
- return;
+ if ( 1 == jetpackCarouselStrings.require_name_email ) {
+ if ( ! ajaxData['email'].length || ! ajaxData['email'].match('@') ) {
+ gallery.jp_carousel('postCommentError', {'field': 'jp-carousel-comment-form-email-field', 'error': jetpackCarouselStrings.no_comment_email});
+ return;
+ } else if ( ! ajaxData['author'].length ) {
+ gallery.jp_carousel('postCommentError', {'field': 'jp-carousel-comment-form-author-field', 'error': jetpackCarouselStrings.no_comment_author});
+ return;
+ }
}
}
@@ -369,8 +444,14 @@ jQuery(document).ready(function($) {
$(window).unbind('keydown', keyListener);
$(window).unbind('resize', resizeListener);
- document.location.hash = '';
$(window).scrollTop(scroll);
+ })
+ .bind('jp_carousel.afterClose', function(){
+ if ( history.pushState ) {
+ history.pushState("", document.title, window.location.pathname + window.location.search);
+ } else {
+ document.location.hash = '';
+ }
gallery.opened = false;
});
@@ -382,6 +463,10 @@ jQuery(document).ready(function($) {
preventDefaultEvents: true
});
+ $( '.jetpack-likes-widget-unloaded' ).each( function() {
+ jetpackLikesWidgetQueue.push( this.id );
+ });
+
nextButton.add(previousButton).click(function(e){
e.preventDefault();
e.stopPropagation();
@@ -397,8 +482,9 @@ jQuery(document).ready(function($) {
var methods = {
testForData: function(gallery) {
gallery = $( gallery ); // make sure we have it as a jQuery object.
- if ( ! gallery.length || undefined == gallery.data( 'carousel-extra' ) )
+ if ( ! gallery.length || undefined == gallery.data( 'carousel-extra' ) ) {
return false;
+ }
return true;
},
@@ -418,8 +504,8 @@ jQuery(document).ready(function($) {
if ( !data )
return; // don't run if the default gallery functions weren't used
- prepareGallery();
-
+ prepareGallery( data );
+
if ( gallery.jp_carousel( 'testIfOpened' ) )
return; // don't open if already opened
@@ -429,8 +515,13 @@ jQuery(document).ready(function($) {
$('body').css('overflow', 'hidden');
// prevent html from overflowing on some of the new themes.
originalHOverflow = $('html').css('overflow');
- $('html').css('overflow', 'hidden');
-
+ $('html').css('overflow', 'hidden');
+
+ // Re-apply inline-block style here and give an initial value for the width
+ // This value will get replaced with a more appropriate value once the slide is loaded
+ // This avoids the likes widget appearing initially full width below the comment button and then shuffling up
+ jQuery( '.slim-likes-widget' ).find( 'iframe' ).css( 'display', 'inline-block' ).css( 'width', '60px' );
+
container.data('carousel-extra', data);
return this.each(function() {
@@ -510,6 +601,10 @@ jQuery(document).ready(function($) {
},
resetButtons : function(current) {
+ if ( current.data('liked') )
+ $('.jp-carousel-buttons a.jp-carousel-like').addClass('liked').text(jetpackCarouselStrings.unlike);
+ else
+ $('.jp-carousel-buttons a.jp-carousel-like').removeClass('liked').text(jetpackCarouselStrings.like);
},
loopSlides : function(reverse){
@@ -604,14 +699,13 @@ jQuery(document).ready(function($) {
gallery.jp_carousel('resetButtons', current);
container.trigger('jp_carousel.selectSlide', [current]);
- $( 'div.jp-carousel-image-meta', 'div.jp-carousel-wrap' ).html('');
-
- gallery.jp_carousel('getTitleDesc', { title: current.data('title'), desc: current.data('desc') } );
- gallery.jp_carousel('getMeta', current.data('image-meta'));
- gallery.jp_carousel('getFullSizeLink', current);
- gallery.jp_carousel('getMap', current.data('image-meta'));
- gallery.jp_carousel('testCommentsOpened', current.data('comments-opened'));
- gallery.jp_carousel('getComments', {'attachment_id': current.data('attachment-id'), 'offset': 0, 'clear': true});
+ gallery.jp_carousel( 'getTitleDesc', { title: current.data( 'title' ), desc: current.data( 'desc' ) } );
+ gallery.jp_carousel( 'updateLikesWidgetVisibility', current.data( 'attachment-id' ) )
+ gallery.jp_carousel( 'updateExif', current.data( 'image-meta' ) );
+ gallery.jp_carousel( 'updateFullSizeLink', current );
+ gallery.jp_carousel( 'updateMap', current.data( 'image-meta' ) );
+ gallery.jp_carousel( 'testCommentsOpened', current.data( 'comments-opened' ) );
+ gallery.jp_carousel( 'getComments', { 'attachment_id': current.data( 'attachment-id' ), 'offset': 0, 'clear': true } );
$('#jp-carousel-comment-post-results').slideUp();
@@ -832,11 +926,11 @@ jQuery(document).ready(function($) {
if ( 'undefined' == typeof args.medium_file || 'undefined' == typeof args.large_file )
return args.orig_file;
- var medium_size = args.medium_file.replace(/^https?:\/\/.+-([\d]+x[\d]+)\..+$/, '$1'),
+ var medium_size = args.medium_file.replace(/-([\d]+x[\d]+)\..+$/, '$1'),
medium_size_parts = (medium_size != args.medium_file) ? medium_size.split('x') : [args.orig_width, 0],
medium_width = parseInt( medium_size_parts[0], 10 ),
medium_height = parseInt( medium_size_parts[1], 10 ),
- large_size = args.large_file.replace(/^https?:\/\/.+-([\d]+x[\d]+)\..+$/, '$1'),
+ large_size = args.large_file.replace(/-([\d]+x[\d]+)\..+$/, '$1'),
large_size_parts = (large_size != args.large_file) ? large_size.split('x') : [args.orig_width, 0],
large_width = parseInt( large_size_parts[0], 10 ),
large_height = parseInt( large_size_parts[1], 10 );
@@ -955,11 +1049,25 @@ jQuery(document).ready(function($) {
$( 'div#jp-carousel-comments-loading' ).css('margin-top', '20px');
},
- getMeta: function( meta ) {
+ updateLikesWidgetVisibility: function( attachmentId ) {
+ // Hide all likes widgets except for the one for the attachmentId passed in
+
+ $( '.jp-carousel-buttons' ).find( '.jetpack-likes-widget-wrapper' ).each( function() {
+ var widgetWrapper = $( this );
+ if ( widgetWrapper.attr('data-attachment-id') == attachmentId ) {
+ widgetWrapper.css( 'display', 'inline-block' );
+ } else {
+ widgetWrapper.css( 'display', 'none' );
+ }
+ });
+ },
+
+ // updateExif updates the contents of the exif UL (.jp-carousel-image-exif)
+ updateExif: function( meta ) {
if ( !meta || 1 != jetpackCarouselStrings.display_exif )
return false;
- var $ul = $( '<ul></ul>' );
+ var $ul = $( "<ul class='jp-carousel-image-exif'></ul>" );
$.each( meta, function( key, val ) {
if ( 0 === parseFloat(val) || !val.length || -1 === $.inArray( key, [ 'camera', 'aperture', 'shutter_speed', 'focal_length' ] ) )
return;
@@ -982,14 +1090,12 @@ jQuery(document).ready(function($) {
$ul.append( '<li><h5>' + jetpackCarouselStrings[key] + '</h5>' + val + '</li>' );
});
- $( 'div.jp-carousel-image-meta', 'div.jp-carousel-wrap' )
- .append( $( buttons ) );
-
- $( 'div.jp-carousel-image-meta', 'div.jp-carousel-wrap' )
- .append( $ul );
+ // Update (replace) the content of the ul
+ $( 'div.jp-carousel-image-meta ul.jp-carousel-image-exif' ).replaceWith( $ul );
},
- getFullSizeLink: function(current) {
+ // updateFullSizeLink updates the contents of the jp-carousel-image-download link
+ updateFullSizeLink: function(current) {
if(!current || !current.data)
return false;
var original = current.data('orig-file').replace(/\?.+$/, ''),
@@ -999,11 +1105,11 @@ jQuery(document).ready(function($) {
.attr( 'href', original )
.attr( 'target', '_blank' );
- $( 'div.jp-carousel-image-meta', 'div.jp-carousel-wrap' )
- .append( permalink );
+ // Update (replace) the content of the anchor
+ $( 'div.jp-carousel-image-meta a.jp-carousel-image-download' ).replaceWith( permalink );
},
- getMap: function( meta ) {
+ updateMap: function( meta ) {
if ( !meta.latitude || !meta.longitude || 1 != jetpackCarouselStrings.display_geo )
return;
@@ -1186,11 +1292,18 @@ jQuery(document).ready(function($) {
// Set an interval on page load to load the carousel if hash exists and not already opened.
// Makes carousel work on page load and when back button leads to same URL with carousel hash (ie: no actual document.ready trigger)
$(document).ready(function(){
+ last_known_location_hash = '';
+
var jp_carousel_open_interval = window.setInterval(function(){
// We should have a URL hash by now.
if ( ! document.location.hash || ! document.location.hash.match(/jp-carousel-(\d+)/) )
return;
+ if ( document.location.hash == last_known_location_hash )
+ return;
+
+ last_known_location_hash = document.location.hash;
+
var gallery = $('div.gallery, div.tiled-gallery'), index = -1, n = document.location.hash.match(/jp-carousel-(\d+)/);
if ( ! $(this).jp_carousel( 'testForData', gallery ) )
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.php b/plugins/jetpack/modules/carousel/jetpack-carousel.php
index 314dd7b2..787f177a 100644
--- a/plugins/jetpack/modules/carousel/jetpack-carousel.php
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel.php
@@ -92,9 +92,12 @@ class Jetpack_Carousel {
// Also: not hardcoding path since there is no guarantee site is running on site root in self-hosted context.
$is_logged_in = is_user_logged_in();
$current_user = wp_get_current_user();
+ $comment_registration = intval( get_option( 'comment_registration' ) );
+ $require_name_email = intval( get_option( 'require_name_email' ) );
$localize_strings = array(
'widths' => $this->prebuilt_widths,
'is_logged_in' => $is_logged_in,
+ 'lang' => strtolower( substr( get_locale(), 0, 2 ) ),
'ajaxurl' => admin_url( 'admin-ajax.php', is_ssl() ? 'https' : 'http' ),
'nonce' => wp_create_nonce( 'carousel_nonce' ),
'display_exif' => $this->test_1or0_option( get_option( 'carousel_display_exif' ), true ),
@@ -114,6 +117,9 @@ class Jetpack_Carousel {
'aperture' => __( 'Aperture', 'jetpack' ),
'shutter_speed' => __( 'Shutter Speed', 'jetpack' ),
'focal_length' => __( 'Focal Length', 'jetpack' ),
+ 'comment_registration' => $comment_registration,
+ 'require_name_email' => $require_name_email,
+ 'login_url' => wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ),
);
if ( ! isset( $localize_strings['jetpack_comments_iframe_src'] ) || empty( $localize_strings['jetpack_comments_iframe_src'] ) ) {
@@ -122,13 +128,18 @@ class Jetpack_Carousel {
if ( $is_logged_in ) {
$localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . sprintf( __( 'Commenting as %s', 'jetpack' ), $current_user->data->display_name ) . '</p>';
} else {
- $localize_strings['local_comments_commenting_as'] = ''
- . '<fieldset><label for="email">' . __( 'Email (Required)', 'jetpack' ) . '</label> '
- . '<input type="text" name="email" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-email-field" /></fieldset>'
- . '<fieldset><label for="author">' . __( 'Name (Required)', 'jetpack' ) . '</label> '
- . '<input type="text" name="author" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-author-field" /></fieldset>'
- . '<fieldset><label for="url">' . __( 'Website', 'jetpack' ) . '</label> '
- . '<input type="text" name="url" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-url-field" /></fieldset>';
+ if ( $comment_registration ) {
+ $localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . __( 'You must be <a href="#" class="jp-carousel-comment-login">logged in</a> to post a comment.', 'jetpack' ) . '</p>';
+ } else {
+ $required = ( $require_name_email ) ? __( '%s (Required)', 'jetpack' ) : '%s';
+ $localize_strings['local_comments_commenting_as'] = ''
+ . '<fieldset><label for="email">' . sprintf( $required, __( 'Email', 'jetpack' ) ) . '</label> '
+ . '<input type="text" name="email" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-email-field" /></fieldset>'
+ . '<fieldset><label for="author">' . sprintf( $required, __( 'Name', 'jetpack' ) ) . '</label> '
+ . '<input type="text" name="author" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-author-field" /></fieldset>'
+ . '<fieldset><label for="url">' . __( 'Website', 'jetpack' ) . '</label> '
+ . '<input type="text" name="url" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-url-field" /></fieldset>';
+ }
}
}
@@ -225,7 +236,21 @@ class Jetpack_Carousel {
if ( isset( $post ) ) {
$blog_id = (int) get_current_blog_id();
- $extra_data = array( 'data-carousel-extra' => array( 'blog_id' => $blog_id, 'permalink' => get_permalink( $post->ID ) ) );
+
+ if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
+ $likes_blog_id = $blog_id;
+ } else {
+ $jetpack = Jetpack::init();
+ $likes_blog_id = $jetpack->get_option( 'id' );
+ }
+
+ $extra_data = array(
+ 'data-carousel-extra' => array(
+ 'blog_id' => $blog_id,
+ 'permalink' => get_permalink( $post->ID ),
+ 'likes_blog_id' => $likes_blog_id
+ )
+ );
$extra_data = apply_filters( 'jp_carousel_add_data_to_container', $extra_data );
foreach ( (array) $extra_data as $data_key => $data_values ) {
@@ -265,11 +290,10 @@ class Jetpack_Carousel {
// Can't just send the results, they contain the commenter's email address.
foreach ( $comments as $comment ) {
- $author_markup = '<a href="' . esc_url( $comment->comment_author_url ) . '">' . esc_html( $comment->comment_author ) . '</a>';
$out[] = array(
'id' => $comment->comment_ID,
'parent_id' => $comment->comment_parent,
- 'author_markup' => $author_markup,
+ 'author_markup' => get_comment_author_link( $comment->comment_ID ),
'gravatar_markup' => get_avatar( $comment->comment_author_email, 64 ),
'date_gmt' => $comment->comment_date_gmt,
'content' => wpautop($comment->comment_content),
@@ -326,23 +350,26 @@ class Jetpack_Carousel {
$email = $_POST['email'];
$url = $_POST['url'];
- if ( empty( $display_name ) )
- die( json_encode( array( 'error' => __( 'Please provide your name.', 'jetpack' ) ) ) );
+ if ( get_option( 'require_name_email' ) ) {
+ if ( empty( $display_name ) )
+ die( json_encode( array( 'error' => __( 'Please provide your name.', 'jetpack' ) ) ) );
- if ( empty( $email ) )
- die( json_encode( array( 'error' => __( 'Please provide an email address.', 'jetpack' ) ) ) );
+ if ( empty( $email ) )
+ die( json_encode( array( 'error' => __( 'Please provide an email address.', 'jetpack' ) ) ) );
- if ( ! is_email( $email ) )
- die( json_encode( array( 'error' => __( 'Please provide a valid email address.', 'jetpack' ) ) ) );
+ if ( ! is_email( $email ) )
+ die( json_encode( array( 'error' => __( 'Please provide a valid email address.', 'jetpack' ) ) ) );
+ }
}
$comment_data = array(
- 'comment_content' => $comment,
- 'comment_post_ID' => $_post_id,
- 'comment_author' => $display_name,
+ 'comment_content' => $comment,
+ 'comment_post_ID' => $_post_id,
+ 'comment_author' => $display_name,
'comment_author_email' => $email,
- 'comment_author_url' => $url,
- 'comment_approved' => 0,
+ 'comment_author_url' => $url,
+ 'comment_approved' => 0,
+ 'comment_type' => '',
);
if ( ! empty( $user_id ) )
diff --git a/plugins/jetpack/modules/carousel/rtl/jetpack-carousel-rtl.css b/plugins/jetpack/modules/carousel/rtl/jetpack-carousel-rtl.css
index 0d010eb5..c34fcfba 100644
--- a/plugins/jetpack/modules/carousel/rtl/jetpack-carousel-rtl.css
+++ b/plugins/jetpack/modules/carousel/rtl/jetpack-carousel-rtl.css
@@ -1,4 +1,4 @@
-/* This file was automatically generated on Jan 29 2013 22:51:19 */
+/* This file was automatically generated on Apr 17 2013 14:28:54 */
* {
line-height:inherit; /* prevent declarations of line-height in the universal selector */
@@ -50,7 +50,7 @@ only screen and (min-device-pixel-ratio: 1.5) {
background: #68c9e8; /* Safari */
color: #fff;
}
-
+
.jp-carousel-info ::-moz-selection {
background: #68c9e8; /* Firefox */
color: #fff;
@@ -135,7 +135,7 @@ div.jp-carousel-buttons a {
padding: 5px 0 5px 2px;
text-decoration: none !important;
text-shadow: none !important;
- vertical-align: baseline !important;
+ vertical-align: middle;
-webkit-font-smoothing: subpixel-antialiased;
}
@@ -483,7 +483,7 @@ div#carousel-reblog-box {
display: none;
}
-.jp-carousel-photo-info h1:before,
+.jp-carousel-photo-info h1:before,
.jp-carousel-photo-info h1:after,
.jp-carousel-left-column-wrapper h1:before,
.jp-carousel-left-column-wrapper h1:after {
@@ -695,7 +695,7 @@ textarea#jp-carousel-comment-form-comment-field {
border-radius: 3px;
overflow: hidden;
-webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
+ -moz-box-sizing: border-box;
box-sizing: border-box;
}
@@ -793,7 +793,7 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
}
#jp-carousel-comment-post-results {
- display: none;
+ display: none;
overflow:auto;
width:100%;
}
@@ -1052,14 +1052,14 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
margin: 0 10px !important;
}
- .jp-carousel-next-button, .jp-carousel-previous-button {
- display: none !important;
+ .jp-carousel-next-button, .jp-carousel-previous-button {
+ display: none !important;
}
.jp-carousel-buttons {
display: none !important;
}
-
+
.jp-carousel-image-meta {
float: none !important;
width: 100% !important;
@@ -1067,31 +1067,31 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
-webkit-box-sizing:border-box;
box-sizing: border-box;
}
-
+
.jp-carousel-close-hint {
font-weight: 800 !important;
font-size: 26px !important;
position: fixed !important;
top: -10px;
}
-
+
.jp-carousel-slide img {
filter: alpha(opacity=100);
opacity: 1;
}
-
+
.jp-carousel-wrap {
- background-color: #000;
+ background-color: #000;
}
-
+
.jp-carousel-fadeaway {
display: none;
}
-
+
#jp-carousel-comment-form-container {
display: none !important;
}
-
+
.jp-carousel-titleanddesc {
padding-top: 0 !important;
border: none !important;
@@ -1099,8 +1099,8 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
.jp-carousel-titleanddesc-title {
font-size: 1em !important;
}
-
+
.jp-carousel-left-column-wrapper {
padding: 0;
- }
+ }
}
diff --git a/plugins/jetpack/modules/comments.php b/plugins/jetpack/modules/comments.php
index d5d4da4d..26bc504f 100644
--- a/plugins/jetpack/modules/comments.php
+++ b/plugins/jetpack/modules/comments.php
@@ -5,6 +5,7 @@
* Module Description: A new comment system that has integrated social media login options.
* First Introduced: 1.4
* Sort Order: 2
+ * Requires Connection: Yes
*/
require dirname( __FILE__ ) . '/comments/comments.php';
diff --git a/plugins/jetpack/modules/comments/admin.php b/plugins/jetpack/modules/comments/admin.php
index 342b7f64..946f4733 100644
--- a/plugins/jetpack/modules/comments/admin.php
+++ b/plugins/jetpack/modules/comments/admin.php
@@ -30,7 +30,7 @@ class Jetpack_Comments_Settings {
return $instance;
}
-
+
public function __construct( Highlander_Comments_Base $jetpack_comments ) {
$this->jetpack_comments = $jetpack_comments;
diff --git a/plugins/jetpack/modules/comments/base.php b/plugins/jetpack/modules/comments/base.php
index f1b5440e..858b6e3e 100644
--- a/plugins/jetpack/modules/comments/base.php
+++ b/plugins/jetpack/modules/comments/base.php
@@ -102,22 +102,22 @@ class Highlander_Comments_Base {
*/
function comments_array( $comments ) {
global $wpdb, $post;
-
+
$commenter = $this->get_current_commenter();
if ( !$commenter['user_id'] )
return $comments;
-
+
if ( !$commenter['comment_author'] )
return $comments;
-
+
$in_moderation_comments = $wpdb->get_results( $wpdb->prepare(
"SELECT * FROM `$wpdb->comments` WHERE `comment_post_ID` = %d AND `user_id` = 0 AND `comment_author` = %s AND `comment_author_email` = %s AND `comment_approved` = '0' ORDER BY `comment_date_gmt` /* Highlander_Comments_Base::comments_array() */",
$post->ID,
wp_specialchars_decode( $commenter['comment_author'], ENT_QUOTES ),
$commenter['comment_author_email']
) );
-
+
if ( !$in_moderation_comments )
return $comments;
@@ -180,7 +180,7 @@ class Highlander_Comments_Base {
/**
* Allows a logged out user to leave a comment as a facebook or twitter credentialed user.
* Overrides WordPress' core comment_registration option to treat these commenters as "registered" (verified) users.
- *
+ *
* @since JetpackComments (1.4)
* @return If no
*/
@@ -256,12 +256,12 @@ class Highlander_Comments_Base {
if ( empty( $comment ) || is_wp_error( $comment ) ) {
return;
}
-
+
$id_source = $this->is_highlander_comment_post();
if ( empty( $id_source ) ) {
return;
}
-
+
// Set comment author cookies
if ( ( 'wordpress' != $id_source ) && is_user_logged_in() ) {
$comment_cookie_lifetime = apply_filters( 'comment_cookie_lifetime', 30000000 );
diff --git a/plugins/jetpack/modules/comments/comments.php b/plugins/jetpack/modules/comments/comments.php
index 8dae39b7..fa156bb6 100644
--- a/plugins/jetpack/modules/comments/comments.php
+++ b/plugins/jetpack/modules/comments/comments.php
@@ -141,19 +141,19 @@ class Jetpack_Comments extends Highlander_Comments_Base {
// it's not a comment - bail
return $avatar;
}
-
+
if ( false === strpos( $comment->comment_author_url, '/www.facebook.com/' ) && false === strpos( $comment->comment_author_url, '/twitter.com/' ) ) {
// It's neither FB nor Twitter - bail
return $avatar;
}
-
+
// It's a FB or Twitter avatar
$foreign_avatar = get_comment_meta( $comment->comment_ID, 'hc_avatar', true );
if ( empty( $foreign_avatar ) ) {
// Can't find the avatar details - bail
return $avatar;
}
-
+
// Return the FB or Twitter avatar
return preg_replace( '#src=([\'"])[^\'"]+\\1#', 'src=\\1' . esc_url( $this->photon_avatar( $foreign_avatar, $size ) ) . '\\1', $avatar );
}
@@ -184,14 +184,14 @@ class Jetpack_Comments extends Highlander_Comments_Base {
// If users are required to be logged in, and they're not, then we don't need to do anything else
if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) {
- echo '<p id="must-log-in-to-comment">' . sprintf( apply_filters( 'jetpack_must_log_in_to_comment', __( 'You must <a href="%s">log in</a> to post a comment.', 'jetpack' ) ), wp_login_url( get_permalink() . '#respond' ) ) . '</p>';
+ echo '<p class="must-log-in">' . sprintf( apply_filters( 'jetpack_must_log_in_to_comment', __( 'You must <a href="%s">log in</a> to post a comment.', 'jetpack' ) ), wp_login_url( get_permalink() . '#respond' ) ) . '</p>';
return;
}
if ( in_array( 'subscriptions', Jetpack::get_active_modules() ) ) {
$stb_enabled = get_option( 'stb_enabled', 1 );
$stb_enabled = empty( $stb_enabled ) ? 0 : 1;
-
+
$stc_enabled = get_option( 'stc_enabled', 1 );
$stc_enabled = empty( $stc_enabled ) ? 0 : 1;
} else {
@@ -209,6 +209,7 @@ class Jetpack_Comments extends Highlander_Comments_Base {
'show_avatars' => ( get_option( 'show_avatars' ) ? '1' : '0' ),
'avatar_default' => get_option( 'avatar_default' ),
'greeting' => get_option( 'highlander_comment_form_prompt', __( 'Leave a Reply', 'jetpack' ) ),
+ 'greeting_reply' => apply_filters( 'jetpack_comment_form_prompt_reply', __( 'Leave a Reply to %s' , 'jetpack' ) ),
'color_scheme' => get_option( 'jetpack_comment_form_color_scheme', $this->default_color_scheme ),
'lang' => get_bloginfo( 'language' ),
'jetpack_version' => JETPACK__VERSION,
@@ -246,9 +247,11 @@ class Jetpack_Comments extends Highlander_Comments_Base {
// The actual iframe (loads comment form from Jetpack server)
?>
- <div id="respond">
- <div id="cancel-comment-reply-link" style="display:none; float:right;"><a href="#"><?php echo esc_html( __( 'Cancel Reply', 'jetpack' ) ); ?></a></div>
- <iframe src="<?php echo esc_url( $url ); ?>" allowtransparency="<?php echo $transparent; ?>" style="width:100%; height: <?php echo $height; ?>px;border:0px;" frameBorder="0" scrolling="no" name="jetpack_remote_comment" id="jetpack_remote_comment"></iframe>
+ <div id="respond" class="comment-respond">
+ <h3 id="reply-title" class="comment-reply-title"><?php comment_form_title( esc_html( $params['greeting'] ), esc_html( $params['greeting_reply'] ) ); ?> <small><?php cancel_comment_reply_link( esc_html__( 'Cancel reply' , 'jetpack') ); ?></small></h3>
+ <div id="commentform" class="comment-form">
+ <iframe src="<?php echo esc_url( $url ); ?>" allowtransparency="<?php echo $transparent; ?>" style="width:100%; height: <?php echo $height; ?>px;border:0px;" frameBorder="0" scrolling="no" name="jetpack_remote_comment" id="jetpack_remote_comment"></iframe>
+ </div>
</div>
<?php // Below is required for comment reply JS to work ?>
diff --git a/plugins/jetpack/modules/contact-form.php b/plugins/jetpack/modules/contact-form.php
index d53fc4c9..21f409ff 100644
--- a/plugins/jetpack/modules/contact-form.php
+++ b/plugins/jetpack/modules/contact-form.php
@@ -1,9 +1,10 @@
<?php
/**
* Module Name: Contact Form
- * Module Description: Easily insert a contact form any where on your site.
+ * Module Description: Easily insert a contact form anywhere on your site.
* Sort Order: 9
* First Introduced: 1.3
+ * Requires Connection: No
*/
include dirname( __FILE__ ) . '/contact-form/grunion-contact-form.php';
diff --git a/plugins/jetpack/modules/contact-form/admin.php b/plugins/jetpack/modules/contact-form/admin.php
index d3efefa0..5a6af06b 100644
--- a/plugins/jetpack/modules/contact-form/admin.php
+++ b/plugins/jetpack/modules/contact-form/admin.php
@@ -1,21 +1,10 @@
<?php
-function menu_alter() {
- echo '
- <style>
- #menu-posts-feedback .wp-menu-image img { display: none; }
- #adminmenu .menu-icon-feedback:hover div.wp-menu-image, #adminmenu .menu-icon-feedback.wp-has-current-submenu div.wp-menu-image, #adminmenu .menu-icon-feedback.current div.wp-menu-image { background: url("' .GRUNION_PLUGIN_URL . 'images/grunion-menu-hover.png") no-repeat 7px 7px !important; }
- #adminmenu .menu-icon-feedback div.wp-menu-image, #adminmenu .menu-icon-feedback div.wp-menu-image, #adminmenu .menu-icon-feedback div.wp-menu-image { background: url("' . GRUNION_PLUGIN_URL . 'images/grunion-menu.png") no-repeat 7px 7px !important; }
- .grunion-menu-button { background: url("' . GRUNION_PLUGIN_URL . 'images/grunion-form.png") no-repeat; width: 13px; height: 13px; display: inline-block; vertical-align: middle; ) }
- @media only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
- #adminmenu .menu-icon-feedback:hover div.wp-menu-image, #adminmenu .menu-icon-feedback.wp-has-current-submenu div.wp-menu-image, #adminmenu .menu-icon-feedback.current div.wp-menu-image { background: url("' .GRUNION_PLUGIN_URL . 'images/grunion-menu-hover-2x.png") no-repeat 7px 7px !important; background-size: 15px 16px !important; }
- #adminmenu .menu-icon-feedback div.wp-menu-image, #adminmenu .menu-icon-feedback div.wp-menu-image, #adminmenu .menu-icon-feedback div.wp-menu-image { background: url("' . GRUNION_PLUGIN_URL . 'images/grunion-menu-2x.png") no-repeat 7px 7px !important; background-size: 15px 16px !important; }
- .grunion-menu-button { background-image: url("' . GRUNION_PLUGIN_URL . 'images/grunion-form-2x.png"); background-size: 13px 12px !important; vertical-align: bottom; }
- }
- </style>';
+function grunion_menu_alter() {
+ wp_enqueue_style( 'grunion-menu-alter', plugins_url( 'css/menu-alter.css', __FILE__ ) );
}
-add_action('admin_head', 'menu_alter');
+add_action( 'admin_enqueue_scripts', 'grunion_menu_alter' );
/**
* Add a contact form button to the post composition screen
@@ -27,8 +16,13 @@ function grunion_media_button( ) {
$title = esc_attr( __( 'Add a custom form', 'jetpack' ) );
$plugin_url = esc_url( GRUNION_PLUGIN_URL );
$site_url = esc_url( admin_url( "/admin-ajax.php?post_id={$iframe_post_id}&action=grunion_form_builder&TB_iframe=true&width=768" ) );
+ ?>
+
+ <a id="insert-jetpack-contact-form" class="button thickbox" title="<?php esc_html_e( 'Add Contact Form', 'jetpack' ); ?>" data-editor="content" href="<?php echo $site_url ?>&id=add_form">
+ <span class="jetpack-contact-form-icon"></span> <?php esc_html_e( 'Add Contact Form', 'jetpack' ); ?>
+ </a>
- echo '<a href="' . $site_url . '&id=add_form" class="thickbox" title="' . $title . '"><div class="grunion-menu-button" alt="' . $title . '"></div></a>';
+ <?php
}
add_action( 'wp_ajax_grunion_form_builder', 'display_form_view' );
@@ -42,14 +36,14 @@ function display_form_view() {
add_action( 'admin_print_styles', 'grunion_admin_css' );
function grunion_admin_css() {
global $current_screen;
- if ( 'edit-feedback' != $current_screen->id )
+ if ( ! in_array( $current_screen->id, array( 'edit-feedback', 'jetpack_page_omnisearch', 'dashboard_page_omnisearch' ) ) )
return;
wp_enqueue_script( 'wp-lists' );
?>
<style type='text/css'>
-.add-new-h2, .view-switch, body.no-js .tablenav select[name^=action], body.no-js #doaction, body.no-js #doaction2 {
+.add-new-h2, .view-switch, body.no-js .tablenav select[name^=action], body.no-js #doaction, body.no-js #doaction2 {
display: none
}
@@ -191,7 +185,7 @@ function grunion_admin_view_tabs( $views ) {
preg_match( '|post_type=feedback\'( class="current")?\>(.*)\<span class=|', $views['all'], $match );
if ( !empty( $match[2] ) )
$views['all'] = str_replace( $match[2], 'Messages ', $views['all'] );
-
+
return $views;
}
@@ -336,7 +330,7 @@ jQuery(document).ready( function($) {
function( r ) {
$('#post-<?php echo $post_id; ?>')
.css( {backgroundColor:'#FF7979'} )
- .fadeOut(350, function() {
+ .fadeOut(350, function() {
$(this).remove();
$('.subsubsub').html(r);
});
@@ -394,7 +388,7 @@ jQuery(document).ready( function($) {
function( r ) {
$('#post-<?php echo $post_id; ?>')
.css( {backgroundColor:'#59C859'} )
- .fadeOut(350, function() {
+ .fadeOut(350, function() {
$(this).remove();
$('.subsubsub').html(r);
});
@@ -473,7 +467,7 @@ function grunion_ajax_shortcode() {
// and constructs a json object representing its contents and attributes
function grunion_ajax_shortcode_to_json() {
global $post, $grunion_form;
-
+
check_ajax_referer( 'grunion_shortcode_to_json' );
if ( !isset( $_POST['content'] ) || !is_numeric( $_POST['post_id'] ) ) {
@@ -583,7 +577,7 @@ function grunion_ajax_spam() {
$sql = "
SELECT post_status,
COUNT( * ) AS post_count
- FROM `{$wpdb->posts}`
+ FROM `{$wpdb->posts}`
WHERE post_type = 'feedback'
GROUP BY post_status
";
@@ -631,3 +625,12 @@ function grunion_ajax_spam() {
echo $status_html;
exit;
}
+
+add_action( 'omnisearch_add_providers', 'grunion_omnisearch_add_providers' );
+function grunion_omnisearch_add_providers() {
+ // Feedback uses capability_type 'page'
+ if ( current_user_can( 'edit_pages' ) ) {
+ require_once( GRUNION_PLUGIN_DIR . '/grunion-omnisearch.php' );
+ new Jetpack_Omnisearch_Grunion;
+ }
+}
diff --git a/plugins/jetpack/modules/contact-form/css/grunion.css b/plugins/jetpack/modules/contact-form/css/grunion.css
index 00035180..d47948b4 100644
--- a/plugins/jetpack/modules/contact-form/css/grunion.css
+++ b/plugins/jetpack/modules/contact-form/css/grunion.css
@@ -1,5 +1,5 @@
.contact-form .clear-form { clear: both; }
-.contact-form input[type='text'], .contact-form input[type='email'] { width: 300px; margin-bottom: 13px; }
+.contact-form input[type='text'], .contact-form input[type='email'] { width: 300px; max-width: 98%; margin-bottom: 13px; }
.contact-form select { margin-bottom: 13px; }
.contact-form textarea { height: 200px; width: 80%; float: none; margin-bottom: 13px; }
.contact-form input[type='radio'], .contact-form input[type='checkbox'] { float: none; margin-bottom: 13px; }
@@ -7,4 +7,4 @@
.contact-form label.checkbox, .contact-form label.radio { margin-bottom: 3px; float: none; font-weight: bold; display: inline-block; }
.contact-form label span { color: #AAA; margin-left: 4px; font-weight: normal; }
.form-errors .form-error-message { color: red; }
-.textwidget input[type='text'], .textwidget input[type='email'], .textwidget textarea { width: 250px; }
+.textwidget input[type='text'], .textwidget input[type='email'], .textwidget textarea { width: 250px; max-width: 98%; }
diff --git a/plugins/jetpack/modules/contact-form/grunion-contact-form.php b/plugins/jetpack/modules/contact-form/grunion-contact-form.php
index 5600febb..76e43be2 100644
--- a/plugins/jetpack/modules/contact-form/grunion-contact-form.php
+++ b/plugins/jetpack/modules/contact-form/grunion-contact-form.php
@@ -67,10 +67,20 @@ class Grunion_Contact_Form_Plugin {
add_action( 'loop_start', array( 'Grunion_Contact_Form', '_style_on' ) );
+ add_action( 'wp_ajax_grunion-contact-form', array( $this, 'ajax_request' ) );
+ add_action( 'wp_ajax_nopriv_grunion-contact-form', array( $this, 'ajax_request' ) );
+
+ // Export to CSV feature
+ if ( is_admin() ) {
+ add_action( 'admin_init', array( $this, 'download_feedback_as_csv' ) );
+ add_action( 'load-edit.php', array( $this, 'export_form' ) );
+ add_action( 'admin_footer', array( $this, 'move_export_form_to_bottom' ) );
+ }
+
// custom post type we'll use to keep copies of the feedback items
register_post_type( 'feedback', array(
'labels' => array(
- 'name' => __( 'Feedbacks', 'jetpack' ),
+ 'name' => __( 'Feedback', 'jetpack' ),
'singular_name' => __( 'Feedback', 'jetpack' ),
'search_items' => __( 'Search Feedback', 'jetpack' ),
'not_found' => __( 'No feedback found', 'jetpack' ),
@@ -98,7 +108,7 @@ class Grunion_Contact_Form_Plugin {
// POST handler
if (
- 'POST' == strtoupper( $_SERVER['REQUEST_METHOD'] )
+ isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' == strtoupper( $_SERVER['REQUEST_METHOD'] )
&&
isset( $_POST['action'] ) && 'grunion-contact-form' == $_POST['action']
&&
@@ -136,9 +146,10 @@ class Grunion_Contact_Form_Plugin {
// It's a form embedded in a text widget
$this->current_widget_id = substr( $id, 7 ); // remove "widget-"
-
+ $widget_type = implode( '-', array_slice( explode( '-', $this->current_widget_id ), 0, -1 ) ); // Remove trailing -#
+
// Is the widget active?
- $sidebar = is_active_widget( false, $this->current_widget_id, 'text' );
+ $sidebar = is_active_widget( false, $this->current_widget_id, $widget_type );
// This is lame - no core API for getting a widget by ID
$widget = isset( $GLOBALS['wp_registered_widgets'][$this->current_widget_id] ) ? $GLOBALS['wp_registered_widgets'][$this->current_widget_id] : false;
@@ -161,12 +172,34 @@ class Grunion_Contact_Form_Plugin {
$form = Grunion_Contact_Form::$last;
- if ( !$form || ( is_wp_error( $form->errors ) && $form->errors->get_error_codes() ) ) {
- return;
- }
+ if ( ! $form )
+ return false;
+
+ if ( is_wp_error( $form->errors ) && $form->errors->get_error_codes() )
+ return $form->errors;
// Process the form
- $form->process_submission();
+ return $form->process_submission();
+ }
+
+ function ajax_request() {
+ $submission_result = self::process_form_submission();
+
+ if ( ! $submission_result ) {
+ header( "HTTP/1.1 500 Server Error", 500, true );
+ echo '<div class="form-error"><ul class="form-errors"><li class="form-error-message">';
+ esc_html_e( 'An error occurred. Please try again later.', 'jetpack' );
+ echo '</li></ul></div>';
+ } elseif ( is_wp_error( $submission_result ) ) {
+ header( "HTTP/1.1 400 Bad Request", 403, true );
+ echo '<div class="form-error"><ul class="form-errors"><li class="form-error-message">';
+ echo esc_html( $submission_result->get_error_message() );
+ echo '</li></ul></div>';
+ } else {
+ echo '<h3>' . esc_html__( 'Message Sent', 'jetpack' ) . '</h3>' . $submission_result;
+ }
+
+ die;
}
/**
@@ -263,7 +296,7 @@ class Grunion_Contact_Form_Plugin {
foreach ( $_SERVER as $k => $value )
if ( !in_array( $k, $ignore ) && is_string( $value ) )
$form["$k"] = $value;
-
+
return $form;
}
@@ -277,7 +310,7 @@ class Grunion_Contact_Form_Plugin {
*/
function is_spam_akismet( $form ) {
global $akismet_api_host, $akismet_api_port;
-
+
if ( !function_exists( 'akismet_http_post' ) )
return false;
@@ -307,6 +340,194 @@ class Grunion_Contact_Form_Plugin {
$response = akismet_http_post( $query_string, $akismet_api_host, "/1.1/submit-{$as}", $akismet_api_port );
return trim( $response[1] );
}
+
+ /**
+ * There aren't any usable actions in core to output the "export feedback" form in the correct place,
+ * so this inline JS moves it from the top of the page to the bottom.
+ */
+ function move_export_form_to_bottom() {
+ if ( get_current_screen()->id != 'edit-feedback' )
+ return;
+
+ // if there aren't any feedbacks, bail out
+ if ( ! (int) wp_count_posts( 'feedback' )->publish )
+ return;
+
+ echo "
+ <script type='text/javascript'>
+ var menu = document.getElementById( 'feedback-export' ),
+ wrapper = document.getElementsByClassName( 'wrap' )[0];
+ wrapper.appendChild(menu);
+ menu.style.display = 'block';
+ </script>
+ ";
+ }
+
+ /**
+ * Prints the menu
+ */
+ function export_form() {
+ if ( get_current_screen()->id != 'edit-feedback' )
+ return;
+
+ // if there aren't any feedbacks, bail out
+ if ( ! (int) wp_count_posts( 'feedback' )->publish )
+ return;
+ ?>
+
+ <div id="feedback-export" style="display:none">
+ <h2><?php _e( 'Export feedback as CSV', 'jetpack' ) ?></h2>
+ <div class="clear"></div>
+ <form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="post" class="form">
+ <?php wp_nonce_field( 'feedback_export','feedback_export_nonce' ); ?>
+
+ <input name="action" value="feedback_export" type="hidden">
+ <label for="post"><? _e( 'Select feedback to download', 'jetpack' ) ?></label>
+ <select name="post">
+ <option value="all"><?php esc_html_e( 'All posts', 'jetpack' ) ?></option>
+ <?php echo $this->get_feedbacks_as_options() ?>
+ </select>
+
+ <br><br>
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_html_e( 'Download', 'jetpack' ); ?>">
+ </form>
+ </div>
+
+ <?php
+ }
+
+ /**
+ * download as a csv a contact form or all of them in a csv file
+ */
+ function download_feedback_as_csv() {
+ if ( empty( $_POST['feedback_export_nonce'] ) )
+ return;
+
+ check_admin_referer( 'feedback_export', 'feedback_export_nonce' );
+
+ $args = array(
+ 'posts_per_page' => -1,
+ 'post_type' => 'feedback',
+ 'post_status' => 'publish',
+ 'meta_key' => '_feedback_subject',
+ 'orderby' => 'meta_value',
+ 'fields' => 'ids',
+ 'suppress_filters' => false,
+ );
+
+ $filename = date( "Y-m-d" ) . '-feedback-export.csv';
+
+ // Check if we want to download all the feedbacks or just a certain contact form
+ if ( ! empty( $_POST['post'] ) && $_POST['post'] !== 'all' ) {
+ $args['post_parent'] = (int) $_POST['post'];
+ $filename = date( "Y-m-d" ) . '-' . str_replace( '&nbsp;', '-', get_the_title( (int) $_POST['post'] ) ) . '.csv';
+ }
+
+ $feedbacks = get_posts( $args );
+ $filename = sanitize_file_name( $filename );
+ $fields = $this->get_field_names( $feedbacks );
+ array_unshift( $fields, __( 'Contact Form', 'jetpack' ) );
+
+ if ( empty( $feedbacks ) )
+ return;
+
+ // Forces the download of the CSV instead of echoing
+ header( 'Content-Disposition: attachment; filename=' . $filename );
+ header( 'Pragma: no-cache' );
+ header( 'Expires: 0' );
+ header( 'Content-Type: text/csv; charset=utf-8' );
+
+ $output = fopen( 'php://output', 'w' );
+
+ // Prints the header
+ fputcsv( $output, $fields );
+
+ // Create the csv string from the array of post ids
+ foreach ( $feedbacks as $feedback ) {
+ fputcsv( $output, self::make_csv_row_from_feedback( $feedback, $fields ) );
+ }
+
+ fclose( $output );
+ }
+
+ /**
+ * Returns a string of HTML <option> items from an array of posts
+ *
+ * @return string a string of HTML <option> items
+ */
+ protected function get_feedbacks_as_options() {
+ $options = '';
+
+ // Get the feedbacks' parents' post IDs
+ $feedbacks = get_posts( array(
+ 'fields' => 'id=>parent',
+ 'posts_per_page' => -1,
+ 'post_type' => 'feedback',
+ 'post_status' => 'publish',
+ 'suppress_filters' => false,
+ ) );
+ $parents = array_unique( array_values( $feedbacks ) );
+
+ $posts = get_posts( array(
+ 'orderby' => 'ID',
+ 'posts_per_page' => -1,
+ 'post_type' => 'any',
+ 'post__in' => array_values( $parents ),
+ 'suppress_filters' => false,
+ ) );
+
+ // creates the string of <option> elements
+ foreach ( $posts as $post ) {
+ $options .= sprintf( '<option value="%s">%s</option>', esc_attr( $post->ID ), esc_html( $post->post_title ) );
+ }
+
+ return $options;
+ }
+
+ /**
+ * Get the names of all the form's fields
+ *
+ * @param array|int $posts the post we want the fields of
+ * @return array the array of fields
+ */
+ protected function get_field_names( $posts ) {
+ $posts = (array) $posts;
+ $all_fields = array();
+
+ foreach ( $posts as $post ){
+ $extra_fields = array_keys( get_post_meta( $post, '_feedback_all_fields', true ) );
+ $all_fields = array_merge( $all_fields, $extra_fields );
+ }
+
+ $all_fields = array_unique( $all_fields );
+ return $all_fields;
+ }
+
+ /**
+ * Creates a valid csv row from a post id
+ *
+ * @param int $post_id The id of the post
+ * @param array $fields An array containing the names of all the fields of the csv
+ * @return String The csv row
+ */
+ protected static function make_csv_row_from_feedback( $post_id, $fields ) {
+ $all_fields = get_post_meta( $post_id, '_feedback_all_fields', true );
+
+ // The first element in all of the exports will be the subject
+ $row_items[] = get_post_meta( $post_id, '_feedback_subject', true );
+
+ // Loop the fields array in order to fill the $row_items array correctly
+ foreach ( $fields as $field ) {
+ if ( $field === __( 'Contact Form', 'jetpack' ) ) // the first field will ever be the contact form, so we can continue
+ continue;
+ elseif ( array_key_exists( $field, $all_fields ) )
+ $row_items[] = $all_fields[$field];
+ else
+ $row_items[] = '';
+ }
+
+ return $row_items;
+ }
}
/**
@@ -520,11 +741,12 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
}
$this->defaults = array(
- 'to' => $default_to,
- 'subject' => $default_subject,
- 'show_subject' => 'no', // only used in back-compat mode
- 'widget' => 0, // Not exposed to the user. Works with Grunion_Contact_Form_Plugin::widget_atts()
- 'id' => null, // Not exposed to the user. Set above.
+ 'to' => $default_to,
+ 'subject' => $default_subject,
+ 'show_subject' => 'no', // only used in back-compat mode
+ 'widget' => 0, // Not exposed to the user. Works with Grunion_Contact_Form_Plugin::widget_atts()
+ 'id' => null, // Not exposed to the user. Set above.
+ 'submit_button_text' => __( 'Submit &#187;', 'jetpack' ),
);
$attributes = shortcode_atts( $this->defaults, $attributes );
@@ -622,7 +844,7 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
$r = '';
$r .= "<div id='contact-form-$id'>\n";
-
+
if ( is_wp_error( $form->errors ) && $form->errors->get_error_codes() ) {
// There are errors. Display them
$r .= "<div class='form-error'>\n<h3>" . __( 'Error!', 'jetpack' ) . "</h3>\n<ul class='form-errors'>\n";
@@ -645,62 +867,7 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
// Don't show the feedback details unless the nonce matches
if ( $feedback_id && wp_verify_nonce( stripslashes( $_GET['_wpnonce'] ), "contact-form-sent-{$feedback_id}" ) ) {
- $feedback = get_post( $feedback_id );
-
- $field_ids = $form->get_field_ids();
-
- // Maps field_ids to post_meta keys
- $field_value_map = array(
- 'name' => 'author',
- 'email' => 'author_email',
- 'url' => 'author_url',
- 'subject' => 'subject',
- 'textarea' => false, // not a post_meta key. This is stored in post_content
- );
-
- $contact_form_message = "<blockquote>\n";
-
- // "Standard" field whitelist
- foreach ( $field_value_map as $type => $meta_key ) {
- if ( isset( $field_ids[$type] ) ) {
- $field = $form->fields[$field_ids[$type]];
-
- if ( $meta_key ) {
- $value = get_post_meta( $feedback_id, "_feedback_{$meta_key}", true );
- } else {
- // The feedback content is stored as the first "half" of post_content
- $value = $feedback->post_content;
- list( $value ) = explode( '<!--more-->', $value );
- $value = trim( $value );
- }
-
- $contact_form_message .= sprintf(
- _x( '%1$s: %2$s', '%1$s = form field label, %2$s = form field value', 'jetpack' ),
- wp_kses( $field->get_attribute( 'label' ), array() ),
- wp_kses( $value, array() )
- ) . '<br />';
- }
- }
-
- // "Non-standard" fields
- if ( $field_ids['extra'] ) {
- // array indexed by field label (not field id)
- $extra_fields = get_post_meta( $feedback_id, '_feedback_extra_fields', true );
-
- foreach ( $field_ids['extra'] as $field_id ) {
- $field = $form->fields[$field_id];
- $label = $field->get_attribute( 'label' );
- $contact_form_message .= sprintf(
- _x( '%1$s: %2$s', '%1$s = form field label, %2$s = form field value', 'jetpack' ),
- wp_kses( $label, array() ),
- wp_kses( $extra_fields[$label], array() )
- ) . '<br />';
- }
- }
-
- $contact_form_message .= "</blockquote><br /><br />";
-
- $r_success_message .= wp_kses( $contact_form_message, array( 'br' => array(), 'blockquote' => array() ) );
+ $r_success_message .= self::success_message( $feedback_id, $form );
}
$r .= apply_filters( 'grunion_contact_form_success_message', $r_success_message );
@@ -721,7 +888,7 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
$r .= "<form action='" . esc_url( $url ) . "' method='post' class='contact-form commentsblock'>\n";
$r .= $form->body;
$r .= "\t<p class='contact-submit'>\n";
- $r .= "\t\t<input type='submit' value='" . esc_attr__( 'Submit &#187;', 'jetpack' ) . "' class='pushbutton-wide'/>\n";
+ $r .= "\t\t<input type='submit' value='" . esc_attr( $form->get_attribute( 'submit_button_text' ) ) . "' class='pushbutton-wide'/>\n";
$r .= "\t\t" . wp_nonce_field( 'contact-form_' . $id, '_wpnonce', true, false ) . "\n"; // nonce and referer
$r .= "\t\t<input type='hidden' name='contact-form-id' value='$id' />\n";
$r .= "\t\t<input type='hidden' name='action' value='grunion-contact-form' />\n";
@@ -734,6 +901,69 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
return $r;
}
+ static function success_message( $feedback_id, $form ) {
+ $r_success_message = '';
+
+ $feedback = get_post( $feedback_id );
+
+ $field_ids = $form->get_field_ids();
+
+ // Maps field_ids to post_meta keys
+ $field_value_map = array(
+ 'name' => 'author',
+ 'email' => 'author_email',
+ 'url' => 'author_url',
+ 'subject' => 'subject',
+ 'textarea' => false, // not a post_meta key. This is stored in post_content
+ );
+
+ $contact_form_message = "<blockquote>\n";
+
+ // "Standard" field whitelist
+ foreach ( $field_value_map as $type => $meta_key ) {
+ if ( isset( $field_ids[$type] ) ) {
+ $field = $form->fields[$field_ids[$type]];
+
+ if ( $meta_key ) {
+ $value = get_post_meta( $feedback_id, "_feedback_{$meta_key}", true );
+ } else {
+ // The feedback content is stored as the first "half" of post_content
+ $value = $feedback->post_content;
+ list( $value ) = explode( '<!--more-->', $value );
+ $value = trim( $value );
+ }
+
+ $contact_form_message .= sprintf(
+ _x( '%1$s: %2$s', '%1$s = form field label, %2$s = form field value', 'jetpack' ),
+ wp_kses( $field->get_attribute( 'label' ), array() ),
+ wp_kses( $value, array() )
+ ) . '<br />';
+ }
+ }
+
+ // "Non-standard" fields
+ if ( $field_ids['extra'] ) {
+ // array indexed by field label (not field id)
+ $extra_fields = get_post_meta( $feedback_id, '_feedback_extra_fields', true );
+
+ foreach ( $field_ids['extra'] as $field_id ) {
+ $field = $form->fields[$field_id];
+ $label = $field->get_attribute( 'label' );
+ $contact_form_message .= sprintf(
+ _x( '%1$s: %2$s', '%1$s = form field label, %2$s = form field value', 'jetpack' ),
+ wp_kses( $label, array() ),
+ wp_kses( $extra_fields[$label], array() )
+ ) . '<br />';
+ }
+ }
+
+ $contact_form_message .= "</blockquote><br /><br />";
+
+ $r_success_message .= wp_kses( $contact_form_message, array( 'br' => array(), 'blockquote' => array() ) );
+
+ return $r_success_message;
+ }
+
/**
* The contact-field shortcode processor
* We use an object method here instead of a static Grunion_Contact_Form_Field class method to parse contact-field shortcodes so that we can tie them to the contact-form object.
@@ -844,7 +1074,7 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
// No one to send it to :(
if ( !$valid_emails ) {
- return;
+ return false;
}
$to = $valid_emails;
@@ -852,11 +1082,11 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
// Make sure we're processing the form we think we're processing... probably a redundant check.
if ( $widget ) {
if ( 'widget-' . $widget != $_POST['contact-form-id'] ) {
- return;
+ return false;
}
} else {
if ( $post->ID != $_POST['contact-form-id'] ) {
- return;
+ return false;
}
}
@@ -937,7 +1167,7 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
// Is it spam?
$is_spam = apply_filters( 'contact_form_is_spam', $akismet_values );
if ( is_wp_error( $is_spam ) ) // WP_Error to abort
- return; // abort
+ return $is_spam; // abort
else if ( $is_spam === TRUE ) // TRUE to flag a spam
$spam = '***SPAM*** ';
@@ -959,14 +1189,16 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
$headers = 'From: ' . $comment_author .' <' . $from_email_addr . ">\r\n" .
'Reply-To: ' . $comment_author . ' <' . $reply_to_addr . ">\r\n" .
- "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"";
+ "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"";
$subject = apply_filters( 'contact_form_subject', $contact_form_subject );
- $time = date_i18n( __( 'l F j, Y \a\t g:i a', 'jetpack' ), current_time( 'timestamp' ) );
-
+ $date_time_format = _x( '%1$s \a\t %2$s', '{$date_format} \a\t {$time_format}', 'jetpack' );
+ $date_time_format = sprintf( $date_time_format, get_option( 'date_format' ), get_option( 'time_format' ) );
+ $time = date_i18n( $date_time_format, current_time( 'timestamp' ) );
+
$extra_content = '';
-
+
foreach ( $extra_values as $label => $value ) {
$extra_content .= $label . ': ' . trim( $value ) . "\n";
}
@@ -1072,6 +1304,10 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
elseif ( apply_filters( 'grunion_still_email_spam', FALSE ) == TRUE ) // don't send spam by default. Filterable.
wp_mail( $to, "{$spam}{$subject}", $message, $headers );
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
+ return self::success_message( $post_id, $this );
+ }
+
$redirect = wp_get_referer();
if ( !$redirect ) { // wp_get_referer() returns false if the referer is the same as the current page
$redirect = $_SERVER['REQUEST_URI'];
@@ -1168,12 +1404,12 @@ class Grunion_Contact_Form_Field extends Crunion_Contact_Form_Shortcode {
$unescaped_label = preg_replace( '/[^a-zA-Z0-9.-_:]/', '', $unescaped_label );
if ( empty( $id ) ) {
- $id = sanitize_title_with_dashes( 'g' + $form_id . '-' . $unescaped_label );
+ $id = sanitize_title_with_dashes( 'g' . $form_id . '-' . $unescaped_label );
$i = 0;
$max_tries = 24;
while ( isset( $form->fields[$id] ) ) {
$i++;
- $id = sanitize_title_with_dashes( 'g' + $form_id . '-' . $unescaped_label . '-' . $i );
+ $id = sanitize_title_with_dashes( 'g' . $form_id . '-' . $unescaped_label . '-' . $i );
if ( $i > $max_tries ) {
break;
@@ -1320,7 +1556,7 @@ class Grunion_Contact_Form_Field extends Crunion_Contact_Form_Shortcode {
case 'select' :
$r .= "\n<div>\n";
$r .= "\t\t<label for='" . esc_attr( $field_id ) . "' class='grunion-field-label select" . ( $this->is_error() ? ' form-error' : '' ) . "'>" . esc_html( $field_label ) . ( $field_required ? '<span>'. __( "(required)", 'jetpack' ) . '</span>' : '' ) . "</label>\n";
- $r .= "\t<select name='" . esc_attr( $field_id ) . "' id='" . esc_attr( $field_id ) . "' class='select' />\n";
+ $r .= "\t<select name='" . esc_attr( $field_id ) . "' id='" . esc_attr( $field_id ) . "' class='select' >\n";
foreach ( $this->get_attribute( 'options' ) as $option ) {
$option = Grunion_Contact_Form_Plugin::strip_tags( $option );
$r .= "\t\t<option" . selected( $option, $field_value, false ) . ">" . esc_html( $option ) . "</option>\n";
@@ -1328,6 +1564,14 @@ class Grunion_Contact_Form_Field extends Crunion_Contact_Form_Shortcode {
$r .= "\t</select>\n";
$r .= "\t</div>\n";
break;
+ case 'date' :
+ $r .= "\n<div>\n";
+ $r .= "\t\t<label for='" . esc_attr( $field_id ) . "' class='grunion-field-label " . esc_attr( $field_type ) . ( $this->is_error() ? ' form-error' : '' ) . "'>" . esc_html( $field_label ) . ( $field_required ? '<span>' . __( "(required)", 'jetpack' ) . '</span>' : '' ) . "</label>\n";
+ $r .= "\t\t<input type='date' name='" . esc_attr( $field_id ) . "' id='" . esc_attr( $field_id ) . "' value='" . esc_attr( $field_value ) . "' class='" . esc_attr( $field_type ) . "'/>\n";
+ $r .= "\t</div>\n";
+
+ wp_enqueue_script( 'grunion-frontend', plugins_url( 'js/grunion-frontend.js', __FILE__ ), array( 'jquery', 'jquery-ui-datepicker' ) );
+ break;
default : // text field
// note that any unknown types will produce a text input, so we can use arbitrary type names to handle
// input fields like name, email, url that require special validation or handling at POST
@@ -1373,7 +1617,7 @@ function grunion_delete_old_spam() {
# nothing special about 5000 or 11
# just trying to periodically recover deleted rows
$random_num = mt_rand( 1, 5000 );
- if ( apply_filters( 'grunion_optimize_table', ( $random_number == 11 ) ) ) {
+ if ( apply_filters( 'grunion_optimize_table', ( $random_num == 11 ) ) ) {
$wpdb->query( "OPTIMIZE TABLE $wpdb->posts" );
}
diff --git a/plugins/jetpack/modules/contact-form/grunion-form-view.php b/plugins/jetpack/modules/contact-form/grunion-form-view.php
index 836369a8..79d1242a 100644
--- a/plugins/jetpack/modules/contact-form/grunion-form-view.php
+++ b/plugins/jetpack/modules/contact-form/grunion-form-view.php
@@ -72,8 +72,8 @@ wp_localize_script( 'grunion', 'GrunionFB_i18n', array(
#sidemenu a { text-decoration:none; border-top: 1px solid #FFF; display:block; float:left; line-height:28px; padding:0 13px; outline: none; }
#sidemenu a.current { background-color:#F9F9F9; border-color:#DFDFDF #DFDFDF #F9F9F9; color:#D54E21; -moz-border-radius:4px 4px 0 0; border-radius:4px 4px 0 0; -webkit-border-radius:4px 4px 0 0; border-style:solid; border-width:1px; font-weight:normal; }
#sidemenu li { display:inline; margin-bottom:6px; line-height:200%; list-style:none outside none; margin:0; padding:0; text-align:center; white-space:nowrap; }
- .button { background-color:#FFFFFF; background:url("<?php echo get_bloginfo('url'); ?>/wp-admin/images/white-grad.png") repeat-x scroll left top #F2F2F2; border-color:#BBBBBB; min-width:80px; text-align:center; color:#464646; text-shadow:0 1px 0 #FFFFFF; border-style:solid; border-width:1px; cursor:pointer; width: auto; font-size:11px !important; line-height:13px; padding:3px 11px; margin-top: 12px; text-decoration:none; -moz-border-radius:11px; border-radius:11px; -webkit-border-radius:11px }
- .button-primary { background-color:#FFFFFF; font-weight: bold; background: url('<?php echo get_bloginfo('url'); ?>/wp-admin/images/button-grad-active.png') repeat-x scroll left top #21759B; border-color:#298CBA; text-align:center; color:#EAF2FA; text-shadow:0 -1px 0 rgba(0, 0, 0, 0.3); border-style:solid; border-width:1px; cursor:pointer; width: auto; font-size:11px !important; line-height:13px; padding:3px 11px; margin-top: 21px; text-decoration:none; -moz-border-radius:11px; border-radius:11px; -webkit-border-radius:11px }
+ .button { background-color:#f2f2f2; border-color:#BBBBBB; min-width:80px; text-align:center; color:#464646; text-shadow:0 1px 0 #FFFFFF; border-style:solid; border-width:1px; cursor:pointer; width: auto; font-size:11px !important; line-height:13px; padding:3px 11px; margin-top: 12px; text-decoration:none; -moz-border-radius:11px; border-radius:11px; -webkit-border-radius:11px }
+ .button-primary { background-color:#21759B; font-weight: bold; border-color:#298CBA; text-align:center; color:#EAF2FA; text-shadow:0 -1px 0 rgba(0, 0, 0, 0.3); border-style:solid; border-width:1px; cursor:pointer; width: auto; font-size:11px !important; line-height:13px; padding:3px 11px; margin-top: 21px; text-decoration:none; -moz-border-radius:11px; border-radius:11px; -webkit-border-radius:11px }
.clear { clear: both; }
.fb-add-field { padding-left: 10px; }
.fb-add-option { margin: 0 0 14px 100px; }
@@ -132,8 +132,8 @@ wp_localize_script( 'grunion', 'GrunionFB_i18n', array(
); ?></p>
<h3 style="margin-top: 21px;"><?php esc_html_e( 'Can I view my feedback within WordPress?', 'jetpack' ); ?></h3>
<p><?php printf(
- esc_html( _x( 'Yep, you can read your feedback at any time by clicking the "%1$s" link in the admin menu.', '%1$s = "Feedbacks" in an HTML link', 'jetpack' ) ),
- '<a id="fb-feedback" href="' . admin_url( 'edit.php?post_type=feedback' ) . '">' . esc_html__( 'Feedbacks', 'jetpack' ) . '</a>'
+ esc_html( _x( 'Yep, you can read your feedback at any time by clicking the "%1$s" link in the admin menu.', '%1$s = "Feedback" in an HTML link', 'jetpack' ) ),
+ '<a id="fb-feedback" href="' . admin_url( 'edit.php?post_type=feedback' ) . '">' . esc_html__( 'Feedback', 'jetpack' ) . '</a>'
); ?></p>
<div class="clear"></div>
</div>
@@ -144,10 +144,10 @@ wp_localize_script( 'grunion', 'GrunionFB_i18n', array(
</div>
<div id="fb-add-field" style="display: none;">
<h3><?php esc_html_e( 'Edit this new field', 'jetpack' ); ?></h3>
-
+
<label for="fb-new-label"><?php esc_html_e( 'Label', 'jetpack' ); ?></label>
<input type="text" id="fb-new-label" value="<?php esc_attr_e( 'New field', 'jetpack' ); ?>" />
-
+
<label for="fb-new-label"><?php esc_html_e( 'Field type', 'jetpack' ); ?></label>
<select id="fb-new-type">
<option value="checkbox"><?php esc_html_e( 'Checkbox', 'jetpack' ); ?></option>
@@ -160,7 +160,7 @@ wp_localize_script( 'grunion', 'GrunionFB_i18n', array(
<option value="url"><?php esc_html_e( 'Website', 'jetpack' ); ?></option>
</select>
<div class="clear"></div>
-
+
<div id="fb-options" style="display: none;">
<div id="fb-new-options">
<label for="fb-option0"><?php esc_html_e( 'Options', 'jetpack' ); ?></label>
@@ -170,14 +170,14 @@ wp_localize_script( 'grunion', 'GrunionFB_i18n', array(
<a href="#" id="fb-another-option"><?php esc_html_e( 'Add another option', 'jetpack' ); ?></a>
</div>
</div>
-
+
<div class="fb-required">
<label for="fb-new-label"></label>
<input type="checkbox" id="fb-new-required" />
<label for="fb-new-label" class="fb-radio-label"><?php esc_html_e( 'Required?', 'jetpack' ); ?></label>
<div class="clear"></div>
</div>
-
+
<input type="hidden" id="fb-field-id" />
<input type="submit" class="button" value="<?php esc_attr_e( 'Save this field', 'jetpack' ); ?>" id="fb-save-field" name="save">
</div>
@@ -186,9 +186,9 @@ wp_localize_script( 'grunion', 'GrunionFB_i18n', array(
<div id="fb-preview-form" class="fb-container">
<h1><?php esc_html_e( 'Here&#8217;s what your form will look like', 'jetpack' ); ?></h1>
<div id="sortable" class="fb-form-case">
-
+
<div id="fb-extra-fields" class="fb-extra-fields"></div>
-
+
<a href="#" id="fb-new-field" class="fb-add-field"><?php esc_html_e( 'Add a new field', 'jetpack' ); ?></a>
</div>
<input type="submit" class="button-primary" tabindex="4" value="<?php esc_attr_e( 'Add this form to my post', 'jetpack' ); ?>" id="fb-save-form" name="save">
diff --git a/plugins/jetpack/modules/contact-form/js/grunion.js b/plugins/jetpack/modules/contact-form/js/grunion.js
index 835f7f80..bbfd89e3 100644
--- a/plugins/jetpack/modules/contact-form/js/grunion.js
+++ b/plugins/jetpack/modules/contact-form/js/grunion.js
@@ -1,5 +1,5 @@
-if (!window.FB) {
- window.FB = {};
+if ( ! window.FB ) {
+ window.FB = {};
}
GrunionFB_i18n = jQuery.extend( {
@@ -426,7 +426,7 @@ FB.ContactForm = function() {
function showAndHideMessage (message) {
try {
var newMessage = (!message) ? GrunionFB_i18n.savedMessage : message;
- jQuery('#fb-success').html(newMessage);
+ jQuery('#fb-success').text(newMessage);
jQuery('#fb-success').slideDown('fast');
setTimeout(function () {
jQuery('#fb-success').slideUp('fast');
@@ -463,9 +463,9 @@ FB.ContactForm = function() {
var thisLabel = jQuery('#fb-new-label').val();
// Update preview
if (thisLabel.length === 0) {
- jQuery('#fb-new-field' + thisId + ' label .label-text').html("New field");
+ jQuery('#fb-new-field' + thisId + ' label .label-text').text( GrunionFB_i18n.newLabel );
} else {
- jQuery('#fb-new-field' + thisId + ' label .label-text').html(thisLabel);
+ jQuery('#fb-new-field' + thisId + ' label .label-text').text( thisLabel );
}
// Update fbForm object
fbForm.fields[thisId].label = thisLabel;
@@ -493,7 +493,7 @@ FB.ContactForm = function() {
var thisType = jQuery('#fb-new-type').val();
// Update preview
if (thisType === "radio") {
- jQuery('#fb-radio-' + thisId + '-' + thisOptionid + ' span').html(thisOptionValue);
+ jQuery('#fb-radio-' + thisId + '-' + thisOptionid + ' span').text(thisOptionValue);
} else {
jQuery('#fb-' + thisId + '-' + thisOptionid).text(thisOptionValue);
}
@@ -538,7 +538,7 @@ FB.ContactForm = function() {
var isLoaded = thisType;
var thisId = jQuery('#fb-field-id').val();
if (!thisType) { var thisType = jQuery('#fb-new-type').val(); }
- if (!thisLabelText) { var thisLabelText = jQuery('#fb-new-field' + thisId + ' .label-text').html(); }
+ if (!thisLabelText) { var thisLabelText = jQuery('#fb-new-field' + thisId + ' .label-text').text(); }
var isRequired = (thisRequired) ? '<span class="label-required">' + GrunionFB_i18n.requiredLabel + '</span>' : '';
var thisLabel = '<label fieldid="' + thisId + '" for="fb-field' + thisId + '"><span class="label-text">' + FB.esc_html( thisLabelText ) + '</span>' + isRequired + '</label>';
var thisRadio = '<input type="radio" name="radio-' + thisId + '" id="fb-field' + thisId + ' "disabled="disabled" />';
@@ -645,6 +645,8 @@ FB.ContactForm = function() {
content: contentSource
};
+ var $doc = jQuery(document);
+
jQuery.post(ajaxurl, data, function(response) {
// Setup fbForm
parseShortcode(jQuery.parseJSON(response));
@@ -666,7 +668,7 @@ FB.ContactForm = function() {
jQuery('#fb-new-required').click(function () {
updateRequired();
});
- jQuery('.fb-remove').live('click', function () {
+ $doc.on('click', '.fb-remove', function () {
showDesc();
deleteField(jQuery(this));
grabShortcode();
@@ -680,13 +682,13 @@ FB.ContactForm = function() {
hidePopup();
}
});
- jQuery('#fb-another-option').live('click', function () {
+ $doc.on('click', '#fb-another-option', function () {
addOption();
});
- jQuery('.fb-options').live('keyup', function () {
+ $doc.on('keyup', '.fb-options', function () {
updateOption(jQuery(this));
});
- jQuery('.fb-remove-option').live('click', function () {
+ $doc.on('click', '.fb-remove-option', function () {
removeOption(jQuery(this).attr('optionid'));
});
jQuery('#tab-preview a').click(function () {
@@ -708,21 +710,21 @@ FB.ContactForm = function() {
jQuery('#fb-field-subject').blur(function () {
updateSubject();
});
- jQuery('.fb-form-case .fb-new-fields').live('mouseenter', function () {
+ $doc.on('mouseenter', '.fb-form-case .fb-new-fields', function () {
hideShowEditLink('show', jQuery(this));
});
- jQuery('.fb-form-case .fb-new-fields').live('mouseleave', function () {
+ $doc.on('mouseleave', '.fb-form-case .fb-new-fields', function () {
hideShowEditLink('hide');
return false;
});
- jQuery('.fb-edit-field').live('click', function () {
+ $doc.on('click', '.fb-edit-field', function () {
editField(jQuery(this));
return false;
});
- jQuery('.fb-edit-field .fb-reorder').live('click', function () {
+ $doc.on('click', '.fb-edit-field .fb-reorder', function () {
return false;
});
- jQuery('#fb-save-field').live('click', function () {
+ $doc.on('click', '#fb-save-field', function () {
showDesc();
showAndHideMessage();
return false;
diff --git a/plugins/jetpack/modules/custom-css.php b/plugins/jetpack/modules/custom-css.php
index 2b5e6a34..051976a3 100644
--- a/plugins/jetpack/modules/custom-css.php
+++ b/plugins/jetpack/modules/custom-css.php
@@ -5,6 +5,7 @@
* Module Description: Customize the appearance of your site using CSS but without modifying your theme.
* Sort Order: 11
* First Introduced: 1.7
+ * Requires Connection: No
*/
function jetpack_load_custom_css() {
diff --git a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php
index f458a46e..c5826a0c 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php
@@ -736,7 +736,7 @@ class csstidy {
if (empty($this->sub_value_arr)) {
// Quote URLs in imports only if they're not already inside url() and not already quoted.
- if (substr($this->sub_value, 0, 4) != 'url(') {
+ if (substr($this->sub_value, 0, 4) != 'url(') {
if (!($this->sub_value{0} == substr($this->sub_value, -1) && in_array($this->sub_value{0}, array("'", '"')))) {
$this->sub_value = '"' . $this->sub_value . '"';
}
@@ -778,7 +778,7 @@ class csstidy {
}
else {
$this->sub_value = "format(";
-
+
foreach ($format_strings as $format_string) {
$this->sub_value .= '"' . str_replace('"', '\\"', $format_string) . '",';
}
@@ -844,7 +844,7 @@ class csstidy {
$_cur_string = $this->cur_string[count($this->cur_string)-1];
$temp_add = $string{$i};
- // Add another string to the stack. Strings can't be nested inside of quotes, only parentheses, but
+ // Add another string to the stack. Strings can't be nested inside of quotes, only parentheses, but
// parentheticals can be nested more than once.
if ($_str_char === ")" && ($string{$i} === "(" || $string{$i} === '"' || $string{$i} === '\'') && !csstidy::escaped($string, $i)) {
$this->cur_string[] = $string{$i};
@@ -1171,6 +1171,7 @@ class csstidy {
* @version 1.0
*/
function property_is_valid($property) {
+ $property = strtolower($property);
if (in_array(trim($property), $GLOBALS['csstidy']['multiple_properties'])) $property = trim($property);
$all_properties = & $GLOBALS['csstidy']['all_properties'];
return (isset($all_properties[$property]) && strpos($all_properties[$property], strtoupper($this->get_cfg('css_level'))) !== false );
diff --git a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php
index 364573a3..2ed9f803 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php
@@ -19,7 +19,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
@@ -262,8 +262,7 @@ class csstidy_optimise {
*/
function compress_important(&$string) {
if (csstidy::is_important($string)) {
- $string = csstidy::gvw_important($string) . '!important';
- }
+ $string = csstidy::gvw_important($string) . ' !important'; }
return $string;
}
@@ -627,7 +626,7 @@ class csstidy_optimise {
// don't try to explose background gradient !
if (stripos($str_value, "gradient(")!==FALSE)
return array('background'=>$str_value);
-
+
$background_prop_default = & $GLOBALS['csstidy']['background_prop_default'];
$repeat = array('repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'space');
$attachment = array('scroll', 'fixed', 'local');
@@ -713,7 +712,7 @@ class csstidy_optimise {
// if background properties is here and not empty, don't try anything
if (isset($input_css['background']) AND $input_css['background'])
return $input_css;
-
+
for ($i = 0; $i < $number_of_values; $i++) {
foreach ($background_prop_default as $bg_property => $default_value) {
// Skip if property does not exist
diff --git a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php
index 00a1956b..e2ed97e7 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php
@@ -19,7 +19,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
@@ -312,7 +312,7 @@ class csstidy_print {
elseif ($default_media) {
$this->parser->_add_token(AT_START, $default_media, true);
}
-
+
foreach ($val as $selector => $vali) {
if ($this->parser->get_cfg('sort_properties'))
ksort($vali);
diff --git a/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php b/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php
index f39ecbf8..de2d0bd6 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php
@@ -51,6 +51,14 @@ $GLOBALS['csstidy']['at_rules']['-moz-keyframes'] = 'at';
$GLOBALS['csstidy']['at_rules']['-ms-keyframes'] = 'at';
/**
+ * Non-standard viewport rule.
+ */
+$GLOBALS['csstidy']['at_rules']['viewport'] = 'is';
+$GLOBALS['csstidy']['at_rules']['-webkit-viewport'] = 'is';
+$GLOBALS['csstidy']['at_rules']['-moz-viewport'] = 'is';
+$GLOBALS['csstidy']['at_rules']['-ms-viewport'] = 'is';
+
+/**
* Non-standard CSS properties. They're not part of any spec, but we say
* they're in all of them so that we can support them.
*/
diff --git a/plugins/jetpack/modules/custom-css/csstidy/data.inc.php b/plugins/jetpack/modules/custom-css/csstidy/data.inc.php
index c0855681..dfb576d2 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/data.inc.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/data.inc.php
@@ -77,7 +77,7 @@ $GLOBALS['csstidy']['at_rules'] = array('page' => 'is','font-face' => 'is','char
$GLOBALS['csstidy']['unit_values'] = array ('background', 'background-position', 'background-size', 'border', 'border-top', 'border-right', 'border-bottom', 'border-left', 'border-width',
'border-top-width', 'border-right-width', 'border-left-width', 'border-bottom-width', 'bottom', 'border-spacing', 'column-gap', 'column-width',
'font-size', 'height', 'left', 'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', 'max-height',
- 'max-width', 'min-height', 'min-width', 'outline', 'outline-width', 'padding', 'padding-top', 'padding-right',
+ 'max-width', 'min-height', 'min-width', 'outline', 'outline-width', 'padding', 'padding-top', 'padding-right',
'padding-bottom', 'padding-left', 'perspective', 'right', 'top', 'text-indent', 'letter-spacing', 'word-spacing', 'width');
/**
@@ -587,7 +587,7 @@ $GLOBALS['csstidy']['quoted_string_properties'] = array('content', 'font', 'font
*
* @global array $GLOBALS['csstidy']['quoted_string_properties']
*/
-$GLOBALS['csstidy']['multiple_properties'] = array_merge( $GLOBALS['csstidy']['unit_values'], array('background', 'background-image', 'transition') );
+$GLOBALS['csstidy']['multiple_properties'] = array_merge( $GLOBALS['csstidy']['color_values'], $GLOBALS['csstidy']['unit_values'], array( 'transition', 'background-image', 'border-image', 'list-style-image' ) );
/**
* An array containing all predefined templates.
diff --git a/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php b/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php
index 9e6b24b0..61f95c7c 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php
@@ -16,7 +16,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
@@ -128,7 +128,7 @@ $lang['de'][15] = 'Standard (Kompromiss zwischen Lesbarkeit und Größe)';
$lang['de'][16] = 'Niedrig (höhere Lesbarkeit)';
$lang['de'][17] = 'Benutzerdefiniert (unten eingeben)';
$lang['de'][18] = 'Benutzerdefinierte <a href="http://csstidy.sourceforge.net/templates.php">Vorlage</a>';
-$lang['de'][19] = 'Optionen';
+$lang['de'][19] = 'Optionen';
$lang['de'][20] = 'Selektoren sortieren (Vorsicht)';
$lang['de'][21] = 'Eigenschaften sortieren';
$lang['de'][22] = 'Selektoren umgruppieren';
@@ -140,7 +140,7 @@ $lang['de'][27] = 'Kleinbuchstaben';
$lang['de'][28] = 'Keine oder ungültige CSS Eingabe oder falsche URL!';
$lang['de'][29] = 'Großbuchstaben';
$lang['de'][30] = 'kleingeschriebene Elementnamen benötigt für XHTML';
-$lang['de'][31] = 'Unnötige Backslashes entfernen';
+$lang['de'][31] = 'Unnötige Backslashes entfernen';
$lang['de'][32] = '!important-Hack konvertieren';
$lang['de'][33] = 'Als Datei ausgeben';
$lang['de'][34] = 'Größere Komprimierung augrund von kleineren Neuezeile-Zeichen';
@@ -271,7 +271,7 @@ $lang['zh'][24] = '壓縮色彩語法';
$lang['zh'][25] = '改用小寫選擇符';
$lang['zh'][26] = '屬性的字形:';
$lang['zh'][27] = '小寫';
-$lang['zh'][28] = '沒有輸入CSS, 語法不符合規定, 或是網址錯誤!';
+$lang['zh'][28] = '沒有輸入CSS, 語法不符合規定, 或是網址錯誤!';
$lang['zh'][29] = '大寫';
$lang['zh'][30] = 'XHTML必須使用小寫的元素名稱';
$lang['zh'][31] = '移除不必要的反斜線';
diff --git a/plugins/jetpack/modules/custom-css/custom-css.php b/plugins/jetpack/modules/custom-css/custom-css.php
index 9bc0c211..02fa7586 100644
--- a/plugins/jetpack/modules/custom-css/custom-css.php
+++ b/plugins/jetpack/modules/custom-css/custom-css.php
@@ -47,6 +47,8 @@ class Jetpack_Custom_CSS {
exit;
}
+ add_action( 'admin_enqueue_scripts', array( 'Jetpack_Custom_CSS', 'enqueue_scripts' ) );
+
if ( isset( $_GET['page'] ) && 'editcss' == $_GET['page'] && is_admin() ) {
// Do migration routine if necessary
Jetpack_Custom_CSS::upgrade();
@@ -56,6 +58,9 @@ class Jetpack_Custom_CSS {
add_action( 'wp_head', array( 'Jetpack_Custom_CSS', 'link_tag' ), 101 );
+ add_filter( 'jetpack_content_width', array( 'Jetpack_Custom_CSS', 'jetpack_content_width' ) );
+ add_filter( 'editor_max_image_size', array( 'Jetpack_Custom_CSS', 'editor_max_image_size' ), 10, 3 );
+
if ( !current_user_can( 'switch_themes' ) && !is_super_admin() )
return;
@@ -65,7 +70,7 @@ class Jetpack_Custom_CSS {
check_admin_referer( 'safecss' );
$save_result = self::save( array(
- 'css' => $_POST['safecss'],
+ 'css' => stripslashes( $_POST['safecss'] ),
'is_preview' => isset( $_POST['action'] ) && $_POST['action'] == 'preview',
'preprocessor' => isset( $_POST['custom_css_preprocessor'] ) ? $_POST['custom_css_preprocessor'] : '',
'add_to_existing' => isset( $_POST['add_to_existing'] ) ? $_POST['add_to_existing'] == 'true' : true,
@@ -108,6 +113,11 @@ class Jetpack_Custom_CSS {
$args = wp_parse_args( $args, $defaults );
+ if ( $args['content_width'] && intval( $args['content_width']) > 0 && ( ! isset( $GLOBALS['content_width'] ) || $args['content_width'] != $GLOBALS['content_width'] ) )
+ $args['content_width'] = intval( $args['content_width'] );
+ else
+ $args['content_width'] = false;
+
// Remove wp_filter_post_kses, this causes CSS escaping issues
remove_filter( 'content_save_pre', 'wp_filter_post_kses' );
remove_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' );
@@ -132,7 +142,7 @@ class Jetpack_Custom_CSS {
$csstidy->set_cfg( 'preserve_css', true );
$csstidy->set_cfg( 'template', dirname( __FILE__ ) . '/csstidy/wordpress-standard.tpl' );
- $css = $orig = stripslashes( $args['css'] );
+ $css = $orig = $args['css'];
$css = preg_replace( '/\\\\([0-9a-fA-F]{4})/', '\\\\\\\\$1', $prev = $css );
@@ -161,11 +171,6 @@ class Jetpack_Custom_CSS {
$css = $csstidy->print->plain();
}
- if ( $args['content_width'] && intval( $args['content_width']) > 0 && ( ! isset( $GLOBALS['content_width'] ) || $args['content_width'] != $GLOBALS['content_width'] ) )
- $custom_content_width = intval( $args['content_width'] );
- else
- $custom_content_width = false;
-
if ( $args['add_to_existing'] )
$add_to_existing = 'yes';
else
@@ -179,9 +184,12 @@ class Jetpack_Custom_CSS {
update_option( 'safecss_preview_rev', intval( get_option( 'safecss_preview_rev' ) ) + 1);
update_metadata( 'post', $safecss_revision_id, 'custom_css_add', $add_to_existing );
- update_metadata( 'post', $safecss_revision_id, 'content_width', $custom_content_width );
+ update_metadata( 'post', $safecss_revision_id, 'content_width', $args['content_width'] );
update_metadata( 'post', $safecss_revision_id, 'custom_css_preprocessor', $args['preprocessor'] );
+ delete_option( 'safecss_add' );
+ delete_option( 'safecss_content_width' );
+
if ( $args['is_preview'] ) {
return $safecss_revision_id;
}
@@ -198,12 +206,18 @@ class Jetpack_Custom_CSS {
update_option( 'safecss_rev', intval( get_option( 'safecss_rev' ) ) + 1 );
update_post_meta( $safecss_post_id, 'custom_css_add', $add_to_existing );
- update_post_meta( $safecss_post_id, 'content_width', $custom_content_width );
+ update_post_meta( $safecss_post_id, 'content_width', $args['content_width'] );
update_post_meta( $safecss_post_id, 'custom_css_preprocessor', $args['preprocessor'] );
+
+ delete_option( 'safecss_add' );
+ delete_option( 'safecss_content_width' );
+
update_metadata( 'post', $safecss_post_revision['ID'], 'custom_css_add', $add_to_existing );
- update_metadata( 'post', $safecss_post_revision['ID'], 'content_width', $custom_content_width );
+ update_metadata( 'post', $safecss_post_revision['ID'], 'content_width', $args['content_width'] );
update_metadata( 'post', $safecss_post_revision['ID'], 'custom_css_preprocessor', $args['preprocessor'] );
+ delete_option( 'safecss_preview_add' );
+
return $safecss_post_id;
}
@@ -230,16 +244,16 @@ class Jetpack_Custom_CSS {
$custom_css_post_id = wp_cache_get( 'custom_css_post_id' );
if ( false === $custom_css_post_id ) {
- $custom_css_post = array_shift( get_posts( array(
+ $custom_css_posts = get_posts( array(
'posts_per_page' => 1,
'post_type' => 'safecss',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC'
- ) ) );
+ ) );
- if ( $custom_css_post )
- $custom_css_post_id = $custom_css_post->ID;
+ if ( count( $custom_css_posts ) > 0 )
+ $custom_css_post_id = $custom_css_posts[0]->ID;
else
$custom_css_post_id = 0;
@@ -350,19 +364,35 @@ class Jetpack_Custom_CSS {
}
static function skip_stylesheet() {
- if ( Jetpack_Custom_CSS::is_customizer_preview() ) {
+ $skip_stylesheet = apply_filters( 'safecss_skip_stylesheet', null );
+
+ if ( null !== $skip_stylesheet ) {
+ return $skip_stylesheet;
+ } elseif ( Jetpack_Custom_CSS::is_customizer_preview() ) {
return false;
- }
- else {
+ } else {
if ( Jetpack_Custom_CSS::is_preview() ) {
$safecss_post = Jetpack_Custom_CSS::get_current_revision();
- return (bool) ( get_option( 'safecss_preview_add' ) == 'no' || get_post_meta( $safecss_post['ID'], 'custom_css_add', true ) == 'no' );
+ if ( $safecss_post )
+ return (bool) ( get_post_meta( $safecss_post['ID'], 'custom_css_add', true ) == 'no' );
+ else
+ return (bool) ( get_option( 'safecss_preview_add' ) == 'no' );
}
else {
$custom_css_post_id = Jetpack_Custom_CSS::post_id();
- return (bool) ( get_option( 'safecss_add' ) == 'no' || ( $custom_css_post_id && get_post_meta( $custom_css_post_id, 'custom_css_add', true ) == 'no' ) );
+ if ( $custom_css_post_id ) {
+ $custom_css_add = get_post_meta( $custom_css_post_id, 'custom_css_add', true );
+
+ // It is possible for the CSS to be stored in a post but for the safecss_add option
+ // to have not been upgraded yet if the user hasn't opened their Custom CSS editor
+ // since October 2012.
+ if ( ! empty( $custom_css_add ) )
+ return (bool) ( $custom_css_add === 'no' );
+ }
+
+ return (bool) ( get_option( 'safecss_add' ) == 'no' );
}
}
}
@@ -494,7 +524,7 @@ class Jetpack_Custom_CSS {
if ( $css == '' )
return;
- $href = trailingslashit( site_url() );
+ $href = home_url( '/' );
$href = add_query_arg( 'custom-css', 1, $href );
$href = add_query_arg( 'csblog', $blog_id, $href );
$href = add_query_arg( 'cscache', 6, $href );
@@ -508,6 +538,8 @@ class Jetpack_Custom_CSS {
?>
<link rel="stylesheet" id="custom-css-css" type="text/css" href="<?php echo esc_url( $href ); ?>" />
<?php
+
+ do_action( 'safecss_link_tag_post' );
}
static function style_filter( $current ) {
@@ -571,7 +603,7 @@ class Jetpack_Custom_CSS {
$parent = 'themes.php';
$title = __( 'Edit CSS', 'jetpack' );
$hook = add_theme_page( $title, $title, 'edit_theme_options', 'editcss', array( 'Jetpack_Custom_CSS', 'admin' ) );
- add_action( "admin_print_scripts-$hook", array( 'Jetpack_Custom_CSS', 'enqueue_scripts' ) );
+
add_action( "admin_head-$hook", array( 'Jetpack_Custom_CSS', 'admin_head' ) );
add_action( "load-revision.php", array( 'Jetpack_Custom_CSS', 'prettify_post_revisions' ) );
add_action( "load-$hook", array( 'Jetpack_Custom_CSS', 'update_title' ) );
@@ -588,26 +620,6 @@ class Jetpack_Custom_CSS {
static function prettify_post_revisions() {
add_filter( 'the_title', array( 'Jetpack_Custom_CSS', 'post_title' ), 10, 2 );
- add_action( 'admin_head', array( 'Jetpack_Custom_CSS', 'remove_title_excerpt_from_revisions' ) );
- }
-
- static function remove_title_excerpt_from_revisions() {
- global $post;
-
- if ( !$post ) {
- return;
- }
-
- if ( 'safecss' != $post->post_type ) {
- return;
- }
- ?>
- <style type="text/css">
- #revision-field-post_title, #revision-field-post_excerpt {
- display: none;
- }
- </style>
- <?php
}
static function post_title( $title, $post_id ) {
@@ -626,159 +638,39 @@ class Jetpack_Custom_CSS {
return __( 'Custom CSS Stylesheet', 'jetpack' );
}
- static function enqueue_scripts() {
+ static function enqueue_scripts( $hook ) {
+ if ( 'appearance_page_editcss' != $hook )
+ return;
+
wp_enqueue_script( 'postbox' );
+ wp_enqueue_script( 'custom-css-editor', plugins_url( 'custom-css/js/css-editor.js', __FILE__ ), 'jquery', '20130325', true );
+ wp_enqueue_style( 'custom-css-editor', plugins_url( 'custom-css/css/css-editor.css', __FILE__ ) );
if ( defined( 'SAFECSS_USE_ACE' ) && SAFECSS_USE_ACE ) {
$url = plugins_url( 'custom-css/js/', __FILE__ );
+
wp_enqueue_script( 'jquery.spin' );
wp_enqueue_script( 'safecss-ace', $url . 'ace/ace.js', array(), '20130213', true );
wp_enqueue_script( 'safecss-ace-css', $url . 'ace/mode-css.js', array( 'safecss-ace' ), '20130213', true );
+ wp_enqueue_script( 'safecss-ace-less', $url . 'ace/mode-less.js', array( 'safecss-ace' ), '20130213', true );
+ wp_enqueue_script( 'safecss-ace-scss', $url . 'ace/mode-scss.js', array( 'safecss-ace' ), '20130213', true );
wp_enqueue_script( 'safecss-ace-use', $url . 'safecss-ace.js', array( 'jquery', 'safecss-ace-css' ), '20130213', true );
+
+ wp_enqueue_style( 'custom-css-ace', plugins_url( 'custom-css/css/ace.css', __FILE__ ) );
}
}
static function admin_head() {
- ?>
- <style type="text/css">
- #safecssform {
- position: relative;
- }
-
- #poststuff {
- padding-top: 0;
- }
-
- #safecss {
- min-height: 250px;
- width: 100%;
- }
-
- .misc-pub-section > span {
- font-weight: bold;
- }
-
- .misc-pub-section > div {
- margin-top: 3px;
- }
-
- <?php
-
- if ( defined( 'SAFECSS_USE_ACE' ) && SAFECSS_USE_ACE ) {
-
- ?>
- #safecss-container {
- position: relative;
- width: 99.5%;
- height: 400px;
- border: 1px solid #dfdfdf;
- border-radius: 3px;
- }
-
- #safecss-container .ace_editor {
- font-family: Consolas, Monaco, Courier, monospace;
- }
-
- #safecss-ace {
- width: 100%;
- height: 100%;
- display: none; /* Hide on load otherwise it looks weird */
- }
-
- #safecss-ace.ace_editor {
- display: block;
- }
-
- #safecss-container .ace-tm .ace_gutter {
- background-color: #ededed;
- }
- <?php
- }
-
+ if ( defined( 'SAFECSS_USE_ACE' ) && SAFECSS_USE_ACE ) {
?>
- </style>
- <script type="text/javascript">
- /*<![CDATA[*/
- var safecssResize, safecssInit;
-
+ <script type="text/javascript">
+ /*<![CDATA[*/
+ var SAFECSS_USE_ACE = true;
+ var safecssAceSrcPath = <?php echo json_encode( parse_url( plugins_url( 'custom-css/js/ace/', __FILE__ ), PHP_URL_PATH ) ); ?>;
+ /*]]>*/
+ </script>
<?php
-
- if ( defined( 'SAFECSS_USE_ACE' ) && SAFECSS_USE_ACE ) {
- ?>var safecssAceSrcPath = <?php echo json_encode( parse_url( plugins_url( 'custom-css/js/ace/', __FILE__ ), PHP_URL_PATH ) ); ?>;<?php
- }
-
- ?>
-
- ( function ( $ ) {
- var safe, win;
-
- safecssResize = function () {
- safe.height( win.height() - safe.offset().top - 250 );
- };
-
- safecssInit = function() {
- safe = $('#safecss');
- win = $(window);
-
- postboxes.add_postbox_toggles('editcss');
- safecssResize();
- var button = document.getElementById( 'preview' );
- button.onclick = function ( event ) {
- <?php
-
- // hack for now for previewing.
- // TODO: move all of this JS into its own file.
- if ( defined( 'SAFECSS_USE_ACE' ) && SAFECSS_USE_ACE ) { echo "\t\taceSyncCSS();\n"; }
-
- ?>
- document.forms["safecssform"].target = "csspreview";
- document.forms["safecssform"].action.value = 'preview';
- document.forms["safecssform"].submit();
- document.forms["safecssform"].target = "";
- document.forms["safecssform"].action.value = 'save';
-
- event = event || window.event;
-
- if ( event.preventDefault )
- event.preventDefault();
-
- return false;
- }
- };
-
- window.onresize = safecssResize;
- addLoadEvent( safecssInit );
- } )( jQuery );
-
- jQuery( function ( $ ) {
- $( '.edit-preprocessor' ).bind( 'click', function ( e ) {
- e.preventDefault();
-
- $( '#preprocessor-select' ).slideDown();
- $( this ).hide();
- } );
-
- $( '.cancel-preprocessor' ).bind( 'click', function ( e ) {
- e.preventDefault();
-
- $( '#preprocessor-select' ).slideUp( function () {
- $( '.edit-preprocessor' ).show();
- $( '#preprocessor_choices' ).val( $( '#custom_css_preprocessor' ).val() );
- } );
- } );
-
- $( '.save-preprocessor' ).bind( 'click', function ( e ) {
- e.preventDefault();
-
- $( '#preprocessor-select' ).slideUp();
- $( '#preprocessor-display' ).text( $( '#preprocessor_choices option:selected' ).text() );
- $( '#custom_css_preprocessor' ).val( $( '#preprocessor_choices' ).val() );
- $( '.edit-preprocessor' ).show();
- } );
- } );
- /*]]>*/
- </script>
- <?php
+ }
}
static function saved_message() {
@@ -787,12 +679,12 @@ class Jetpack_Custom_CSS {
static function admin() {
add_meta_box( 'submitdiv', __( 'Publish', 'jetpack' ), array( __CLASS__, 'publish_box' ), 'editcss', 'side' );
+ add_action( 'custom_css_submitbox_misc_actions', array( __CLASS__, 'content_width_settings' ) );
$safecss_post = Jetpack_Custom_CSS::get_post();
if ( ! empty( $safecss_post ) && 0 < $safecss_post['ID'] && wp_get_post_revisions( $safecss_post['ID'] ) )
add_meta_box( 'revisionsdiv', __( 'CSS Revisions', 'jetpack' ), array( __CLASS__, 'revisions_meta_box' ), 'editcss', 'side' );
-
?>
<div class="wrap columns-2">
<?php do_action( 'custom_design_header' ); ?>
@@ -833,6 +725,103 @@ class Jetpack_Custom_CSS {
<?php
}
+ /**
+ * Content width setting callback
+ */
+ static function content_width_settings() {
+ $safecss_post = Jetpack_Custom_CSS::get_current_revision();
+
+ $custom_content_width = get_post_meta( $safecss_post['ID'], 'content_width', true );
+
+ // If custom content width hasn't been overridden and the theme has a content_width value, use that as a default.
+ if ( $custom_content_width <= 0 && ! empty( $GLOBALS['content_width'] ) )
+ $custom_content_width = $GLOBALS['content_width'];
+
+ if ( ! $custom_content_width || ( isset( $GLOBALS['content_width'] ) && $custom_content_width == $GLOBALS['content_width'] ) )
+ $custom_content_width = '';
+
+ ?>
+ <div class="misc-pub-section">
+ <label><?php esc_html_e( 'Content Width:', 'jetpack' ); ?></label>
+ <span id="content-width-display" data-default-text="<?php esc_attr_e( 'Default', 'jetpack' ); ?>" data-custom-text="<?php esc_attr_e( '%s px', 'jetpack' ); ?>"><?php echo $custom_content_width ? sprintf( esc_html__( '%s px', 'jetpack' ), $custom_content_width ) : esc_html_e( 'Default', 'jetpack' ); ?></span>
+ <a class="edit-content-width hide-if-no-js" href="#content-width"><?php echo esc_html_e( 'Edit', 'jetpack' ); ?></a>
+ <div id="content-width-select" class="hide-if-js">
+ <input type="hidden" name="custom_content_width" id="custom_content_width" value="<?php echo esc_attr( $custom_content_width ); ?>" />
+ <p>
+ <?php
+
+ printf(
+ __( 'Limit width to %1$s pixels for videos, full size images, and other shortcodes. (<a href="%2$s">More info</a>.)', 'jetpack' ),
+ '<input type="text" id="custom_content_width_visible" value="' . esc_attr( $custom_content_width ) . '" size="4" />',
+ apply_filters( 'safecss_limit_width_link', 'http://jetpack.me/support/custom-css/#limited-width' )
+ );
+
+ ?>
+ </p>
+ <?php
+
+ if ( !empty( $GLOBALS['content_width'] ) && $custom_content_width != $GLOBALS['content_width'] ) {
+ if ( function_exists( 'wp_get_theme' ) )
+ $current_theme = wp_get_theme()->Name;
+ else
+ $current_theme = get_current_theme();
+
+ ?>
+ <p><?php printf( __( 'The default content width for the %s theme is %d pixels.', 'jetpack' ), $current_theme, intval( $GLOBALS['content_width'] ) ); ?></p>
+ <?php
+ }
+
+ ?>
+ <a class="save-content-width hide-if-no-js button" href="#content-width"><?php esc_html_e( 'OK', 'jetpack' ); ?></a>
+ <a class="cancel-content-width hide-if-no-js" href="#content-width"><?php esc_html_e( 'Cancel', 'jetpack' ); ?></a>
+ </div>
+ <script type="text/javascript">
+ jQuery( function ( $ ) {
+ var defaultContentWidth = <?php echo isset( $GLOBALS['content_width'] ) ? json_encode( intval( $GLOBALS['content_width'] ) ) : 0; ?>;
+
+ $( '.edit-content-width' ).bind( 'click', function ( e ) {
+ e.preventDefault();
+
+ $( '#content-width-select' ).slideDown();
+ $( this ).hide();
+ } );
+
+ $( '.cancel-content-width' ).bind( 'click', function ( e ) {
+ e.preventDefault();
+
+ $( '#content-width-select' ).slideUp( function () {
+ $( '.edit-content-width' ).show();
+ $( '#custom_content_width_visible' ).val( $( '#custom_content_width' ).val() );
+ } );
+ } );
+
+ $( '.save-content-width' ).bind( 'click', function ( e ) {
+ e.preventDefault();
+
+ $( '#content-width-select' ).slideUp();
+
+ var newContentWidth = parseInt( $( '#custom_content_width_visible' ).val(), 10 );
+
+ if ( newContentWidth && newContentWidth != defaultContentWidth ) {
+ $( '#content-width-display' ).text(
+ $( '#content-width-display' )
+ .data( 'custom-text' )
+ .replace( '%s', $( '#custom_content_width_visible' ).val() )
+ );
+ }
+ else {
+ $( '#content-width-display' ).text( $( '#content-width-display' ).data( 'default-text' ) );
+ }
+
+ $( '#custom_content_width' ).val( $( '#custom_content_width_visible' ).val() );
+ $( '.edit-content-width' ).show();
+ } );
+ } );
+ </script>
+ </div>
+ <?php
+ }
+
static function publish_box() {
?>
<div id="minor-publishing">
@@ -897,34 +886,6 @@ class Jetpack_Custom_CSS {
<a class="save-css-mode hide-if-no-js button" href="#css-mode"><?php esc_html_e( 'OK', 'jetpack' ); ?></a>
<a class="cancel-css-mode hide-if-no-js" href="#css-mode"><?php esc_html_e( 'Cancel', 'jetpack' ); ?></a>
</div>
- <script type="text/javascript">
- jQuery( function ( $ ) {
- $( '.edit-css-mode' ).bind( 'click', function ( e ) {
- e.preventDefault();
-
- $( '#css-mode-select' ).slideDown();
- $( this ).hide();
- } );
-
- $( '.cancel-css-mode' ).bind( 'click', function ( e ) {
- e.preventDefault();
-
- $( '#css-mode-select' ).slideUp( function () {
- $( '.edit-css-mode' ).show();
- $( 'input[name=add_to_existing_display][value=' + $( '#add_to_existing' ).val() + ']' ).attr( 'checked', true );
- } );
- } );
-
- $( '.save-css-mode' ).bind( 'click', function ( e ) {
- e.preventDefault();
-
- $( '#css-mode-select' ).slideUp();
- $( '#css-mode-display' ).text( $( 'input[name=add_to_existing_display]:checked' ).val() == 'true' ? 'Add-on' : 'Replacement' );
- $( '#add_to_existing' ).val( $( 'input[name=add_to_existing_display]:checked' ).val() );
- $( '.edit-css-mode' ).show();
- } );
- } );
- </script>
</div>
<?php do_action( 'custom_css_submitbox_misc_actions' ); ?>
</div>
@@ -1012,9 +973,15 @@ class Jetpack_Custom_CSS {
update_post_meta( $safecss_post_id, 'custom_css_add', 'yes' );
update_post_meta( $safecss_post_id, 'content_width', false );
update_post_meta( $safecss_post_id, 'custom_css_preprocessor', '' );
+
+ delete_option( 'safecss_add' );
+ delete_option( 'safecss_content_width' );
+
update_metadata( 'post', $safecss_revision['ID'], 'custom_css_add', 'yes' );
update_metadata( 'post', $safecss_revision['ID'], 'content_width', false );
update_metadata( 'post', $safecss_revision['ID'], 'custom_css_preprocessor', '' );
+
+ delete_option( 'safecss_preview_add' );
}
static function is_customizer_preview() {
@@ -1072,9 +1039,15 @@ class Jetpack_Custom_CSS {
update_metadata( 'post', $safecss_revision['ID'], 'content_width', $content_width );
update_metadata( 'post', $safecss_revision['ID'], 'custom_css_add', $custom_css_add );
update_metadata( 'post', $safecss_revision['ID'], 'custom_css_preprocessor', $preprocessor );
+
+ delete_option( 'safecss_add' );
+ delete_option( 'safecss_content_width' );
+
update_post_meta( $_post->ID, 'content_width', $content_width );
update_post_meta( $_post->ID, 'custom_css_add', $custom_css_add );
update_post_meta( $_post->ID, 'custom_css_preprocessor', $preprocessor );
+
+ delete_option( 'safecss_preview_add' );
}
/**
@@ -1194,6 +1167,40 @@ class Jetpack_Custom_CSS {
return esc_url_raw( $post_link );
}
+
+ /**
+ * When on the edit screen, make sure the custom content width
+ * setting is applied to the large image size.
+ */
+ static function editor_max_image_size( $dims, $size = 'medium', $context = null ) {
+ list( $width, $height ) = $dims;
+
+ if ( 'large' == $size && 'edit' == $context )
+ $width = Jetpack::get_content_width();
+
+ return array( $width, $height );
+ }
+
+ /**
+ * Override the content_width with a custom value if one is set.
+ */
+ static function jetpack_content_width( $content_width ) {
+ $custom_content_width = 0;
+
+ if ( Jetpack_Custom_CSS::is_preview() ) {
+ $safecss_post = Jetpack_Custom_CSS::get_current_revision();
+ $custom_content_width = intval( get_post_meta( $safecss_post['ID'], 'content_width', true ) );
+ } else if ( ! Jetpack_Custom_CSS::is_freetrial() ) {
+ $custom_css_post_id = Jetpack_Custom_CSS::post_id();
+ if ( $custom_css_post_id )
+ $custom_content_width = intval( get_post_meta( $custom_css_post_id, 'content_width', true ) );
+ }
+
+ if ( $custom_content_width > 0 )
+ $content_width = $custom_content_width;
+
+ return $content_width;
+ }
}
class Jetpack_Safe_CSS {
diff --git a/plugins/jetpack/modules/custom-css/custom-css/js/ace/ace.js b/plugins/jetpack/modules/custom-css/custom-css/js/ace/ace.js
index 520b8fca..375915bf 100644
--- a/plugins/jetpack/modules/custom-css/custom-css/js/ace/ace.js
+++ b/plugins/jetpack/modules/custom-css/custom-css/js/ace/ace.js
@@ -8,4 +8,3 @@
ace[key] = a[key];
});
})();
- \ No newline at end of file
diff --git a/plugins/jetpack/modules/custom-css/custom-css/js/ace/worker-css.js b/plugins/jetpack/modules/custom-css/custom-css/js/ace/worker-css.js
index 59ceeaf5..54c2a3e0 100644
--- a/plugins/jetpack/modules/custom-css/custom-css/js/ace/worker-css.js
+++ b/plugins/jetpack/modules/custom-css/custom-css/js/ace/worker-css.js
@@ -1 +1,7886 @@
-"no use strict";function initBaseUrls(e){require.tlns=e}function initSender(){var e=require(null,"ace/lib/event_emitter").EventEmitter,t=require(null,"ace/lib/oop"),n=function(){};return function(){t.implement(this,e),this.callback=function(e,t){postMessage({type:"call",id:t,data:e})},this.emit=function(e,t){postMessage({type:"event",name:e,data:t})}}.call(n.prototype),new n}if(typeof window!="undefined"&&window.document)throw"atempt to load ace worker into main window instead of webWorker";var console={log:function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})},error:function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})}},window={console:console},normalizeModule=function(e,t){if(t.indexOf("!")!==-1){var n=t.split("!");return normalizeModule(e,n[0])+"!"+normalizeModule(e,n[1])}if(t.charAt(0)=="."){var r=e.split("/").slice(0,-1).join("/"),t=r+"/"+t;while(t.indexOf(".")!==-1&&i!=t)var i=t,t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}return t},require=function(e,t){if(!t.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");var t=normalizeModule(e,t),n=require.modules[t];if(n)return n.initialized||(n.initialized=!0,n.exports=n.factory().exports),n.exports;var r=t.split("/");r[0]=require.tlns[r[0]]||r[0];var i=r.join("/")+".js";return require.id=t,importScripts(i),require(e,t)};require.modules={},require.tlns={};var define=function(e,t,n){arguments.length==2?(n=t,typeof e!="string"&&(t=e,e=require.id)):arguments.length==1&&(n=e,e=require.id);if(e.indexOf("text!")===0)return;var r=function(t,n){return require(e,t,n)};require.modules[e]={factory:function(){var e={exports:{}},t=n(r,e.exports,e);return t&&(e.exports=t),e}}},main,sender;onmessage=function(e){var t=e.data;if(t.command){if(!main[t.command])throw new Error("Unknown command:"+t.command);main[t.command].apply(main,t.args)}else if(t.init){initBaseUrls(t.tlns),require(null,"ace/lib/fixoldbrowsers"),sender=initSender();var n=require(null,t.module)[t.classname];main=new n(sender)}else t.event&&sender&&sender._emit(t.event,t.data)},define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],function(e,t,n){e("./regexp"),e("./es5-shim")}),define("ace/lib/regexp",["require","exports","module"],function(e,t,n){function o(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function u(e,t,n){if(Array.prototype.indexOf)return e.indexOf(t,n);for(var r=n||0;r<e.length;r++)if(e[r]===t)return r;return-1}var r={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},i=r.exec.call(/()??/,"")[1]===undefined,s=function(){var e=/^/g;return r.test.call(e,""),!e.lastIndex}();if(s&&i)return;RegExp.prototype.exec=function(e){var t=r.exec.apply(this,arguments),n,a;if(typeof e=="string"&&t){!i&&t.length>1&&u(t,"")>-1&&(a=RegExp(this.source,r.replace.call(o(this),"g","")),r.replace.call(e.slice(t.index),a,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===undefined&&(t[e]=undefined)}));if(this._xregexp&&this._xregexp.captureNames)for(var f=1;f<t.length;f++)n=this._xregexp.captureNames[f-1],n&&(t[n]=t[f]);!s&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--}return t},s||(RegExp.prototype.test=function(e){var t=r.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t})}),define("ace/lib/es5-shim",["require","exports","module"],function(e,t,n){function m(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError;var r=o.call(arguments,1),i=function(){if(this instanceof i){var e=function(){};e.prototype=n.prototype;var s=new e,u=n.apply(s,r.concat(o.call(arguments)));return u!==null&&Object(u)===u?u:s}return n.apply(t,r.concat(o.call(arguments)))};return i});var r=Function.prototype.call,i=Array.prototype,s=Object.prototype,o=i.slice,u=r.bind(s.toString),a=r.bind(s.hasOwnProperty),f,l,c,h,p;if(p=a(s,"__defineGetter__"))f=r.bind(s.__defineGetter__),l=r.bind(s.__defineSetter__),c=r.bind(s.__lookupGetter__),h=r.bind(s.__lookupSetter__);Array.isArray||(Array.isArray=function(t){return u(t)=="[object Array]"}),Array.prototype.forEach||(Array.prototype.forEach=function(t){var n=D(this),r=arguments[1],i=0,s=n.length>>>0;if(u(t)!="[object Function]")throw new TypeError;while(i<s)i in n&&t.call(r,n[i],i,n),i++}),Array.prototype.map||(Array.prototype.map=function(t){var n=D(this),r=n.length>>>0,i=Array(r),s=arguments[1];if(u(t)!="[object Function]")throw new TypeError;for(var o=0;o<r;o++)o in n&&(i[o]=t.call(s,n[o],o,n));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){var n=D(this),r=n.length>>>0,i=[],s=arguments[1];if(u(t)!="[object Function]")throw new TypeError;for(var o=0;o<r;o++)o in n&&t.call(s,n[o],o,n)&&i.push(n[o]);return i}),Array.prototype.every||(Array.prototype.every=function(t){var n=D(this),r=n.length>>>0,i=arguments[1];if(u(t)!="[object Function]")throw new TypeError;for(var s=0;s<r;s++)if(s in n&&!t.call(i,n[s],s,n))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(t){var n=D(this),r=n.length>>>0,i=arguments[1];if(u(t)!="[object Function]")throw new TypeError;for(var s=0;s<r;s++)if(s in n&&t.call(i,n[s],s,n))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(t){var n=D(this),r=n.length>>>0;if(u(t)!="[object Function]")throw new TypeError;if(!r&&arguments.length==1)throw new TypeError;var i=0,s;if(arguments.length>=2)s=arguments[1];else do{if(i in n){s=n[i++];break}if(++i>=r)throw new TypeError}while(!0);for(;i<r;i++)i in n&&(s=t.call(void 0,s,n[i],i,n));return s}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(t){var n=D(this),r=n.length>>>0;if(u(t)!="[object Function]")throw new TypeError;if(!r&&arguments.length==1)throw new TypeError;var i,s=r-1;if(arguments.length>=2)i=arguments[1];else do{if(s in n){i=n[s--];break}if(--s<0)throw new TypeError}while(!0);do s in this&&(i=t.call(void 0,i,n[s],s,n));while(s--);return i}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var n=D(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=M(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i<r;i++)if(i in n&&n[i]===t)return i;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(t){var n=D(this),r=n.length>>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,M(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__||(t.constructor?t.constructor.prototype:s)});if(!Object.getOwnPropertyDescriptor){var d="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(t,n){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(d+t);if(!a(t,n))return;var r,i,o;r={enumerable:!0,configurable:!0};if(p){var u=t.__proto__;t.__proto__=s;var i=c(t,n),o=h(t,n);t.__proto__=u;if(i||o)return i&&(r.get=i),o&&(r.set=o),r}return r.value=t[n],r}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(t){return Object.keys(t)});if(!Object.create){var v;Object.prototype.__proto__===null?v=function(){return{__proto__:null}}:v=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(t,n){var r;if(t===null)r=v();else{if(typeof t!="object")throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var i=function(){};i.prototype=t,r=new i,r.__proto__=t}return n!==void 0&&Object.defineProperties(r,n),r}}if(Object.defineProperty){var g=m({}),y=typeof document=="undefined"||m(document.createElement("div"));if(!g||!y)var b=Object.defineProperty}if(!Object.defineProperty||b){var w="Property description must be an object: ",E="Object.defineProperty called on non-object: ",S="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(t,n,r){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(E+t);if(typeof r!="object"&&typeof r!="function"||r===null)throw new TypeError(w+r);if(b)try{return b.call(Object,t,n,r)}catch(i){}if(a(r,"value"))if(p&&(c(t,n)||h(t,n))){var o=t.__proto__;t.__proto__=s,delete t[n],t[n]=r.value,t.__proto__=o}else t[n]=r.value;else{if(!p)throw new TypeError(S);a(r,"get")&&f(t,n,r.get),a(r,"set")&&l(t,n,r.set)}return t}}Object.defineProperties||(Object.defineProperties=function(t,n){for(var r in n)a(n,r)&&Object.defineProperty(t,r,n[r]);return t}),Object.seal||(Object.seal=function(t){return t}),Object.freeze||(Object.freeze=function(t){return t});try{Object.freeze(function(){})}catch(x){Object.freeze=function(t){return function(n){return typeof n=="function"?n:t(n)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(t){return t}),Object.isSealed||(Object.isSealed=function(t){return!1}),Object.isFrozen||(Object.isFrozen=function(t){return!1}),Object.isExtensible||(Object.isExtensible=function(t){if(Object(t)===t)throw new TypeError;var n="";while(a(t,n))n+="?";t[n]=!0;var r=a(t,n);return delete t[n],r});if(!Object.keys){var T=!0,N=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],C=N.length;for(var k in{toString:null})T=!1;Object.keys=function P(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Object.keys called on a non-object");var P=[];for(var t in e)a(e,t)&&P.push(t);if(T)for(var n=0,r=C;n<r;n++){var i=N[n];a(e,i)&&P.push(i)}return P}}if(!Date.prototype.toISOString||(new Date(-621987552e5)).toISOString().indexOf("-000001")===-1)Date.prototype.toISOString=function(){var t,n,r,i;if(!isFinite(this))throw new RangeError;t=[this.getUTCMonth()+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()],i=this.getUTCFullYear(),i=(i<0?"-":i>9999?"+":"")+("00000"+Math.abs(i)).slice(0<=i&&i<=9999?-4:-6),n=t.length;while(n--)r=t[n],r<10&&(t[n]="0"+r);return i+"-"+t.slice(0,2).join("-")+"T"+t.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"};Date.now||(Date.now=function(){return(new Date).getTime()}),Date.prototype.toJSON||(Date.prototype.toJSON=function(t){if(typeof this.toISOString!="function")throw new TypeError;return this.toISOString()}),Date.parse("+275760-09-13T00:00:00.000Z")!==864e13&&(Date=function(e){var t=function i(t,n,r,s,o,u,a){var f=arguments.length;if(this instanceof e){var l=f==1&&String(t)===t?new e(i.parse(t)):f>=7?new e(t,n,r,s,o,u,a):f>=6?new e(t,n,r,s,o,u):f>=5?new e(t,n,r,s,o):f>=4?new e(t,n,r,s):f>=3?new e(t,n,r):f>=2?new e(t,n):f>=1?new e(t):new e;return l.constructor=i,l}return e.apply(this,arguments)},n=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{3}))?)?(?:Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$");for(var r in e)t[r]=e[r];return t.now=e.now,t.UTC=e.UTC,t.prototype=e.prototype,t.prototype.constructor=t,t.parse=function(r){var i=n.exec(r);if(i){i.shift();for(var s=1;s<7;s++)i[s]=+(i[s]||(s<3?1:0)),s==1&&i[s]--;var o=+i.pop(),u=+i.pop(),a=i.pop(),f=0;if(a){if(u>23||o>59)return NaN;f=(u*60+o)*6e4*(a=="+"?-1:1)}var l=+i[0];return 0<=l&&l<=99?(i[0]=l+400,e.UTC.apply(this,i)+f-126227808e5):e.UTC.apply(this,i)+f}return e.parse.apply(this,arguments)},t}(Date));var L=" \n \f\r   ᠎              \u2028\u2029";if(!String.prototype.trim||L.trim()){L="["+L+"]";var A=new RegExp("^"+L+L+"*"),O=new RegExp(L+L+"*$");String.prototype.trim=function(){return String(this).replace(A,"").replace(O,"")}}var M=function(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e},_="a"[0]!="a",D=function(e){if(e==null)throw new TypeError;return _&&typeof e=="string"&&e?e.split(""):Object(e)}}),define("ace/lib/event_emitter",["require","exports","module"],function(e,t,n){var r={};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry=this._eventRegistry||{},this._defaultHandlers=this._defaultHandlers||{};var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!="object"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=function(){this.propagationStopped=!0}),t.preventDefault||(t.preventDefault=function(){this.defaultPrevented=!0});for(var i=0;i<n.length;i++){n[i](t);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t)},r.setDefaultHandler=function(e,t){this._defaultHandlers=this._defaultHandlers||{};if(this._defaultHandlers[e])throw new Error("The default handler for '"+e+"' is already set");this._defaultHandlers[e]=t},r.on=r.addEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];n||(n=this._eventRegistry[e]=[]),n.indexOf(t)==-1&&n.push(t)},r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define("ace/lib/oop",["require","exports","module"],function(e,t,n){t.inherits=function(){var e=function(){};return function(t,n){e.prototype=n.prototype,t.super_=n.prototype,t.prototype=new e,t.prototype.constructor=t}}(),t.mixin=function(e,t){for(var n in t)e[n]=t[n]},t.implement=function(e,n){t.mixin(e,n)}}),define("ace/mode/css_worker",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/worker/mirror","ace/mode/css/csslint"],function(e,t,n){var r=e("../lib/oop"),i=e("../lib/lang"),s=e("../worker/mirror").Mirror,o=e("./css/csslint").CSSLint,u=t.Worker=function(e){s.call(this,e),this.setTimeout(400),this.ruleset=null,this.setDisabledRules("ids"),this.setInfoRules("adjoining-classes|qualified-headings|zero-units|gradients|import|outline-none")};r.inherits(u,s),function(){this.setInfoRules=function(e){typeof e=="string"&&(e=e.split("|")),this.infoRules=i.arrayToMap(e),this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.setDisabledRules=function(e){if(!e)this.ruleset=null;else{typeof e=="string"&&(e=e.split("|"));var t={};o.getRules().forEach(function(e){t[e.id]=!0}),e.forEach(function(e){delete t[e]}),console.log(t),this.ruleset=t}this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.onUpdate=function(){var e=this.doc.getValue(),t=this.infoRules,n=o.verify(e,this.ruleset);this.sender.emit("csslint",n.messages.map(function(e){return{row:e.line-1,column:e.col-1,text:e.message,type:t[e.rule.id]?"info":e.type}}))}}.call(u.prototype)}),define("ace/lib/lang",["require","exports","module"],function(e,t,n){t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){return(new Array(t+1)).join(e)};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(