Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Plugin updates

Achievements
CMS Tree Page View
FeedWordPress
Flexi Pages Widget
Widget Logic
  • Loading branch information...
commit 673feacac111a2f1e14313a1d4c2feae10113bac 1 parent 8c72ef8
@craigcook craigcook authored
Showing with 4,646 additions and 1,432 deletions.
  1. +376 −378 plugins/achievements/dpa.pot
  2. +11 −11 plugins/achievements/includes/achievements-classes.php
  3. +9 −2 plugins/achievements/includes/achievements-core.php
  4. +2 −2 plugins/achievements/includes/achievements-templatetags.php
  5. +11 −11 plugins/achievements/loader.php
  6. +9 −5 plugins/achievements/readme.txt
  7. +320 −134 plugins/cms-tree-page-view/functions.php
  8. +8 −3 plugins/cms-tree-page-view/index.php
  9. BIN  plugins/cms-tree-page-view/languages/cms-tree-page-view-ru_RU.mo
  10. +315 −76 plugins/cms-tree-page-view/languages/cms-tree-page-view-ru_RU.po
  11. BIN  plugins/cms-tree-page-view/languages/cms-tree-page-view-sv_SE.mo
  12. +372 −0 plugins/cms-tree-page-view/languages/cms-tree-page-view-sv_SE.po
  13. BIN  plugins/cms-tree-page-view/languages/cms-tree-page-view.mo
  14. +114 −75 plugins/cms-tree-page-view/languages/cms-tree-page-view.pot
  15. +49 −13 plugins/cms-tree-page-view/readme.txt
  16. +103 −13 plugins/cms-tree-page-view/scripts/cms_tree_page_view.js
  17. BIN  plugins/cms-tree-page-view/styles/images/switch-view-icons.png
  18. +119 −44 plugins/cms-tree-page-view/styles/styles.css
  19. +20 −20 plugins/feedwordpress/admin-ui.php
  20. +4 −7 plugins/feedwordpress/categories-page.php
  21. +1 −48 plugins/feedwordpress/compatability.php
  22. +109 −1 plugins/feedwordpress/diagnostics-page.php
  23. +74 −11 plugins/feedwordpress/feeds-page.php
  24. +21 −4 plugins/feedwordpress/feedtime.class.php
  25. +73 −0 plugins/feedwordpress/feedwordpie.class.php
  26. +55 −0 plugins/feedwordpress/feedwordpie_item.class.php
  27. +1 −1  plugins/feedwordpress/feedwordpress-content-type-sniffer.class.php
  28. +1 −2  plugins/feedwordpress/feedwordpress-elements.css
  29. +1 −10 plugins/feedwordpress/feedwordpress-elements.js
  30. +225 −97 plugins/feedwordpress/feedwordpress.php
  31. +36 −14 plugins/feedwordpress/feedwordpress_file.class.php
  32. +44 −3 plugins/feedwordpress/feedwordpress_parser.class.php
  33. +6 −5 plugins/feedwordpress/feedwordpresshtml.class.php
  34. +69 −69 plugins/feedwordpress/feedwordpresshttpauthenticator.class.php
  35. +149 −0 plugins/feedwordpress/feedwordpresslocalpost.class.php
  36. +308 −0 plugins/feedwordpress/feedwordpressparsedpostmeta.class.php
  37. +6 −6 plugins/feedwordpress/feedwordpressrpc.class.php
  38. +16 −19 plugins/feedwordpress/feedwordpresssyndicationpage.class.php
  39. +12 −5 plugins/feedwordpress/magpiefromsimplepie.class.php
  40. +38 −0 plugins/feedwordpress/performance-page.php
  41. +0 −1  plugins/feedwordpress/posts-page.php
  42. +103 −5 plugins/feedwordpress/readme.txt
  43. +297 −175 plugins/feedwordpress/syndicatedlink.class.php
  44. +167 −115 plugins/feedwordpress/syndicatedpost.class.php
  45. +48 −10 plugins/feedwordpress/syndicationdataqueries.class.php
  46. +1 −1  plugins/flexi-pages-widget/flexi-pages-widget.php
  47. BIN  plugins/flexi-pages-widget/languages/flexipages-be_BY.mo
  48. +132 −0 plugins/flexi-pages-widget/languages/flexipages-be_BY.po
  49. BIN  plugins/flexi-pages-widget/languages/flexipages-bg_BG.mo
  50. +140 −0 plugins/flexi-pages-widget/languages/flexipages-bg_BG.po
  51. BIN  plugins/flexi-pages-widget/languages/flexipages-ga_IE.mo
  52. +107 −0 plugins/flexi-pages-widget/languages/flexipages-ga_IE.po
  53. BIN  plugins/flexi-pages-widget/languages/flexipages-sr_RS.mo
  54. +106 −0 plugins/flexi-pages-widget/languages/flexipages-sr_RS.po
  55. BIN  plugins/flexi-pages-widget/languages/flexipages-zh_CN.mo
  56. +109 −0 plugins/flexi-pages-widget/languages/flexipages-zh_CN.po
  57. BIN  plugins/widget-logic/languages/widget-logic-de_DE.mo
  58. +95 −0 plugins/widget-logic/languages/widget-logic-de_DE.po
  59. BIN  plugins/widget-logic/languages/widget-logic-es_ES.mo
  60. +103 −0 plugins/widget-logic/languages/widget-logic-es_ES.po
  61. +101 −0 plugins/widget-logic/languages/widget-logic.pot
  62. +50 −36 plugins/widget-logic/widget_logic.php
View
754 plugins/achievements/dpa.pot
@@ -1,32 +1,17 @@
# Translation source file for Paul Gibbs' (paul@byotos.com) WordPress plugin, "Achievements for BuddyPress".
-# Achievements is copyright (C) 2009-12 Paul Gibbs.
-# This file is distributed under the same license as the "Achievements" package.
+# Achievements is copyright (C) 2009-13 Paul Gibbs.
msgid ""
msgstr ""
"Project-Id-Version: \n"
-"Report-Msgid-Bugs-To: http://buddypress.org/community/groups/achievements/\n"
-"POT-Creation-Date: 2012-01-02 13:45:07+00:00\n"
+"Report-Msgid-Bugs-To: http://wordpress.org/tag/achievements\n"
+"POT-Creation-Date: 2013-01-02 19:23:34+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"PO-Revision-Date: 2012-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
-#: includes/achievements-filters.php:83 includes/achievements-filters.php:106
-msgid "Viewing member %1$s to %2$s (of %3$s active members)"
-msgstr ""
-
-#: includes/achievements-filters.php:84 includes/achievements-filters.php:105
-msgid ""
-"Viewing member %1$s to %2$s (of %3$s members) who have unlocked this "
-"Achievement"
-msgstr ""
-
-#: includes/achievements-filters.php:123
-msgid "Unlocked %s ago"
-msgstr ""
-
#: includes/achievements-admin.php:32
msgid ""
"<strong>Achievements is almost ready</strong>. Have you just upgraded to a "
@@ -299,9 +284,8 @@ msgstr ""
msgid "Send"
msgstr ""
-#: includes/achievements-admin.php:434
+#: includes/achievements-admin.php:434 includes/achievements-core.php:174
#: includes/achievements-templatetags.php:1430
-#: includes/achievements-core.php:174
msgid "Change Picture"
msgstr ""
@@ -317,6 +301,195 @@ msgid ""
"Enter keywords here to search for in your images' titles and descriptions:"
msgstr ""
+#: includes/achievements-classes.php:301
+msgid "This can't be zero."
+msgstr ""
+
+#: includes/achievements-classes.php:303
+msgid "This can't be blank."
+msgstr ""
+
+#: includes/achievements-classes.php:312
+msgid "Choose an event."
+msgstr ""
+
+#: includes/achievements-classes.php:315
+msgid "This needs to be at least one."
+msgstr ""
+
+#: includes/achievements-classes.php:318 includes/achievements-classes.php:327
+msgid "This needs to be less than two hundred characters long."
+msgstr ""
+
+#: includes/achievements-classes.php:321
+msgid "The Achievement's name must be unique; this one is already in use."
+msgstr ""
+
+#: includes/achievements-classes.php:324
+msgid "Missing Achievement description."
+msgstr ""
+
+#: includes/achievements-classes.php:331
+msgid "This slug conflicts with something important; please try another."
+msgstr ""
+
+#: includes/achievements-classes.php:334
+msgid "The slug must be unique; this one is already in use."
+msgstr ""
+
+#: includes/achievements-core.php:108
+msgid "Achievements <span>%s</span>"
+msgstr ""
+
+#: includes/achievements-core.php:112
+#: includes/templates/achievements/index.php:20
+msgid "My Achievements <span>%s</span>"
+msgstr ""
+
+#: includes/achievements-core.php:116 includes/achievements-core.php:262
+msgid "My Achievements"
+msgstr ""
+
+#: includes/achievements-core.php:139 includes/achievements-core.php:153
+msgid "Home"
+msgstr ""
+
+#: includes/achievements-core.php:163
+msgid "Unlocked By <span>%s</span>"
+msgstr ""
+
+#: includes/achievements-core.php:186
+#: includes/achievements-templatetags.php:1433
+msgid "Delete"
+msgstr ""
+
+#: includes/achievements-core.php:199
+#: includes/achievements-templatetags.php:1436
+msgid "Edit"
+msgstr ""
+
+#: includes/achievements-core.php:212
+msgid "Grant"
+msgstr ""
+
+#: includes/achievements-core.php:297
+msgid "Achievement RSS Feed"
+msgstr ""
+
+#: includes/achievements-core.php:701
+msgid "Sorry, there was no activity found. Please try a different filter."
+msgstr ""
+
+#: includes/achievements-core.php:702
+msgid "Sorry, there was no activity found."
+msgstr ""
+
+#: includes/achievements-core.php:1729
+msgid "The Achievement's picture has been updated."
+msgstr ""
+
+#: includes/achievements-core.php:1734
+msgid ""
+"There was an error changing the Achievement's picture, please try again."
+msgstr ""
+
+#: includes/achievements-core.php:1803
+msgid "The Achievement's details have been updated."
+msgstr ""
+
+#: includes/achievements-core.php:1814
+msgid ""
+"An error has occurred and the Achievement's details have not been updated. "
+"See below for details."
+msgstr ""
+
+#: includes/achievements-core.php:1837
+msgid "You need to select at least one person to give this Achievement to!"
+msgstr ""
+
+#: includes/achievements-core.php:1854
+msgid "The specified members have successfully received this Achievement."
+msgstr ""
+
+#: includes/achievements-core.php:1883
+msgid "There was an error deleting the Achievement, please try again."
+msgstr ""
+
+#: includes/achievements-core.php:1892
+msgid "The Achievement was deleted successfully."
+msgstr ""
+
+#: includes/achievements-core.php:1970
+msgid "Achievement created succesfully!"
+msgstr ""
+
+#: includes/achievements-core.php:1986
+msgid ""
+"An error has occurred and the Achievement has not been created. See below "
+"for details."
+msgstr ""
+
+#: includes/achievements-core.php:2006
+msgid "Yes"
+msgstr ""
+
+#: includes/achievements-core.php:2007
+msgid "No"
+msgstr ""
+
+#: includes/achievements-core.php:2014
+msgid "You unlock an achievement"
+msgstr ""
+
+#: includes/achievements-core.php:2046
+msgid "Achievement unlocked"
+msgstr ""
+
+#: includes/achievements-core.php:2075
+msgid "%1$s unlocked %2$s"
+msgstr ""
+
+#: includes/achievements-core.php:2086
+msgid "%1$s created the Achievement %2$s"
+msgstr ""
+
+#: includes/achievements-filters.php:83 includes/achievements-filters.php:106
+msgid "Viewing member %1$s to %2$s (of %3$s active members)"
+msgstr ""
+
+#: includes/achievements-filters.php:84 includes/achievements-filters.php:105
+msgid ""
+"Viewing member %1$s to %2$s (of %3$s members) who have unlocked this "
+"Achievement"
+msgstr ""
+
+#: includes/achievements-filters.php:123
+msgid "Unlocked %s ago"
+msgstr ""
+
+#: includes/achievements-notifications.php:36
+msgid "Achievement unlocked: %s"
+msgstr ""
+
+#: includes/achievements-notifications.php:41
+msgid "Achievements unlocked!"
+msgstr ""
+
+#: includes/achievements-notifications.php:79
+msgid "[%1$s] Achievement unlocked: %2$s"
+msgstr ""
+
+#: includes/achievements-notifications.php:80
+msgid ""
+"\n"
+"You have unlocked an Achievement: %1$s\n"
+"\n"
+"To review this and see all of your Achievements, go to %2$s\n"
+"\n"
+"---------------------\n"
+"To disable these notifications please log in and go to: %3$s"
+msgstr ""
+
#: includes/achievements-templatetags.php:378
msgid "Viewing Achievements %1$s to %2$s (of %3$s Achievements)"
msgstr ""
@@ -429,16 +602,6 @@ msgstr ""
msgid "Other"
msgstr ""
-#: includes/achievements-templatetags.php:1433
-#: includes/achievements-core.php:186
-msgid "Delete"
-msgstr ""
-
-#: includes/achievements-templatetags.php:1436
-#: includes/achievements-core.php:199
-msgid "Edit"
-msgstr ""
-
#: includes/achievements-templatetags.php:1439
msgid "Give"
msgstr ""
@@ -472,153 +635,162 @@ msgstr ""
msgid "View Achievements"
msgstr ""
-#: includes/templates/achievements/achievements-loop.php:23
-msgid "This Achievement is worth %s points."
+#: includes/achievements-widgets.php:27
+msgid "Sitewide leaderboard"
msgstr ""
-#: includes/templates/achievements/achievements-loop.php:29
-msgid "Unlocked %s"
+#: includes/achievements-widgets.php:28
+msgid "Achievements Leaderboard"
msgstr ""
-#: includes/templates/achievements/achievements-loop.php:42
-msgid "Inactive"
+#: includes/achievements-widgets.php:73
+msgid "Position"
msgstr ""
-#: includes/templates/achievements/achievements-loop.php:79
-msgid "There were no Achievements found matching &ldquo;%s.&rdquo;"
+#. translators: column heading, indicating numerical position in a list
+#: includes/achievements-widgets.php:73
+msgid "#"
msgstr ""
-#: includes/templates/achievements/achievements-loop.php:81
-msgid "You haven't unlocked any Achievements yet"
+#: includes/achievements-widgets.php:74
+msgid "Member"
msgstr ""
-#: includes/templates/achievements/achievements-loop.php:83
-msgid "%s hasn't unlocked any Achievements yet"
+#: includes/achievements-widgets.php:75
+msgid "Score"
msgstr ""
-#: includes/templates/achievements/achievements-loop.php:85
-msgid "Oops, no Achievements were found!"
+#: includes/achievements-widgets.php:131
+msgid "Achievement Leaderboard"
msgstr ""
-#: includes/templates/achievements/single/achievement-header.php:24
-msgid "%s point"
-msgid_plural "%s points"
-msgstr[0] ""
-msgstr[1] ""
+#: includes/achievements-widgets.php:137 includes/achievements-widgets.php:276
+#: includes/achievements-widgets.php:400 includes/achievements-widgets.php:509
+#: includes/achievements-widgets.php:638 includes/achievements-widgets.php:743
+msgid "Title"
+msgstr ""
-#: includes/templates/achievements/single/achievement-header.php:27
-msgid "Inactive Achievement"
+#: includes/achievements-widgets.php:141
+msgid "Limit to this many results"
msgstr ""
-#: includes/templates/achievements/single/achievement-header.php:30
-msgid "Only %s person has unlocked this Achievement"
-msgid_plural "%s people have unlocked this Achievement"
-msgstr[0] ""
-msgstr[1] ""
+#: includes/achievements-widgets.php:145
+msgid "Appearance"
+msgstr ""
-#: includes/templates/achievements/single/grant.php:13
-msgid "Select people to give this Achievement to."
+#: includes/achievements-widgets.php:169
+msgid "League table"
msgstr ""
-#: includes/templates/achievements/single/grant.php:22
-msgid "Give Achievement"
+#: includes/achievements-widgets.php:169
+msgid "Modern"
msgstr ""
-#: includes/templates/achievements/single/delete.php:4
-msgid ""
-"WARNING: Any members who have unlocked this Achievement will have it "
-"removed. There is no way back, please be careful with this option."
+#: includes/achievements-widgets.php:188
+msgid "A photo grid of a member's unlocked Achievements"
msgstr ""
-#: includes/templates/achievements/single/delete.php:7
-msgid "I understand the consequences of deleting this Achievement."
+#: includes/achievements-widgets.php:189
+msgid "Achievements, Unlocked"
msgstr ""
-#: includes/templates/achievements/single/delete.php:10
-msgid "Delete Achievement"
+#: includes/achievements-widgets.php:231 includes/achievements-widgets.php:356
+msgid "Show All"
msgstr ""
-#: includes/templates/achievements/single/edit.php:4
-#: includes/templates/achievements/create.php:28
-msgid ""
-"Some of the Action options below may not be relevant to the type or event of "
-"the Achievement."
+#: includes/achievements-widgets.php:265
+msgid "Your Recent Achievements"
msgstr ""
-#: includes/templates/achievements/single/change-picture.php:17
-msgid ""
-"We've noticed that you've got a lot of pictures to choose from. <a href='%"
-"s'>Set a filter</a> to restrict which images are retrieved from your <a "
-"href='%s'>WordPress Media Library</a>."
+#: includes/achievements-widgets.php:280 includes/achievements-widgets.php:642
+msgid "Limit to this many Achievements"
msgstr ""
-#: includes/templates/achievements/single/change-picture.php:28
-msgid "Update Picture"
+#: includes/achievements-widgets.php:284 includes/achievements-widgets.php:646
+#: includes/achievements-widgets.php:747
+msgid "Always show as logged in member"
msgstr ""
-#: includes/templates/achievements/single/change-picture.php:46
+#: includes/achievements-widgets.php:307
msgid ""
-"Before you can choose a picture, you need to upload an image to the <a "
-"href='%s'>WordPress Media Library</a>."
+"A photo grid of all the Achievements available on this site; intended for "
+"multisite"
msgstr ""
-#: includes/templates/achievements/single/change-picture.php:50
-msgid ""
-"Unfortunately, there aren't any pictures to choose from. You'll need to ask "
-"an Administrator to upload some to the WordPress Media Library for you."
+#: includes/achievements-widgets.php:308
+msgid "Achievements, All"
msgstr ""
-#: includes/templates/achievements/index.php:7
-#: includes/templates/achievements/create.php:10
-msgid "Achievements Directory"
+#: includes/achievements-widgets.php:390
+msgid "All Available Achievements"
msgstr ""
-#: includes/templates/achievements/index.php:7
-msgid "Create an Achievement"
+#: includes/achievements-widgets.php:404
+msgid "Show this many Achievements"
msgstr ""
-#: includes/templates/achievements/index.php:17
-msgid "All Achievements <span>%s</span>"
+#: includes/achievements-widgets.php:408
+msgid "Always show non site-specific Achievements"
msgstr ""
-#: includes/templates/achievements/index.php:20
-#: includes/achievements-core.php:112
-msgid "My Achievements <span>%s</span>"
+#: includes/achievements-widgets.php:430
+msgid "Displays a single Achievement in detail"
msgstr ""
-#: includes/templates/achievements/index.php:27
-#: includes/templates/members/single/achievements/unlocked.php:9
-msgid "Order By:"
+#: includes/achievements-widgets.php:431
+msgid "Achievements, Featured"
msgstr ""
-#: includes/templates/achievements/index.php:29
-#: includes/templates/members/single/achievements/unlocked.php:12
-msgid "Alphabetical"
+#: includes/achievements-widgets.php:463
+msgid "%s points"
msgstr ""
-#: includes/templates/achievements/index.php:30
-#: includes/templates/members/single/achievements/unlocked.php:13
-msgid "Event Count"
+#: includes/achievements-widgets.php:470
+msgid "Show More"
msgstr ""
-#: includes/templates/achievements/index.php:31
-msgid "Newest"
+#: includes/achievements-widgets.php:503
+msgid "Featured Achievement"
msgstr ""
-#: includes/templates/achievements/index.php:32
-#: includes/templates/achievements/_addedit.php:74
-#: includes/templates/members/single/achievements/unlocked.php:14
-msgid "Points"
+#: includes/achievements-widgets.php:513
+msgid "Achievement"
msgstr ""
-#: includes/templates/achievements/create.php:10
-#: includes/templates/achievements/_addedit.php:114
-msgid "Create Achievement"
+#: includes/achievements-widgets.php:552
+msgid "A photo grid of Achievements which the member is yet to unlock"
msgstr ""
-#: includes/templates/achievements/create.php:30
-msgid ""
-"After you create the Achievement, you'll be able to choose a picture for it."
+#: includes/achievements-widgets.php:553
+msgid "Achievements, Locked"
+msgstr ""
+
+#: includes/achievements-widgets.php:627
+msgid "Unlock These Achievements"
+msgstr ""
+
+#: includes/achievements-widgets.php:670
+msgid "Displays a member's Achievement score"
+msgstr ""
+
+#: includes/achievements-widgets.php:671
+msgid "Achievements, Member's Score"
+msgstr ""
+
+#: includes/achievements-widgets.php:733
+msgid "Achievement Score"
+msgstr ""
+
+#: includes/feeds/dpa-myachievements-feed.php:28
+msgid "%s's Achievement Feed"
+msgstr ""
+
+#: includes/feeds/dpa-myachievements-feed.php:31
+msgid "Activity feed for the achievement, %s"
+msgstr ""
+
+#: includes/feeds/dpa-myachievements-feed.php:50
+msgid "Comments: %s"
msgstr ""
#: includes/templates/achievements/_addedit.php:6
@@ -663,6 +835,12 @@ msgstr ""
msgid "Explain how to unlock this Achievement."
msgstr ""
+#: includes/templates/achievements/_addedit.php:74
+#: includes/templates/achievements/index.php:32
+#: includes/templates/members/single/achievements/unlocked.php:14
+msgid "Points"
+msgstr ""
+
#: includes/templates/achievements/_addedit.php:75
msgid ""
"Points are awarded when Achievements are unlocked. They are used as a "
@@ -701,326 +879,146 @@ msgstr ""
msgid "Update Achievement"
msgstr ""
-#: includes/templates/members/single/achievements/unlocked.php:11
-msgid "Recently Unlocked"
-msgstr ""
-
-#: includes/achievements-classes.php:301
-msgid "This can't be zero."
-msgstr ""
-
-#: includes/achievements-classes.php:303
-msgid "This can't be blank."
-msgstr ""
-
-#: includes/achievements-classes.php:312
-msgid "Choose an event."
-msgstr ""
-
-#: includes/achievements-classes.php:315
-msgid "This needs to be at least one."
-msgstr ""
-
-#: includes/achievements-classes.php:318 includes/achievements-classes.php:327
-msgid "This needs to be less than two hundred characters long."
-msgstr ""
-
-#: includes/achievements-classes.php:321
-msgid "The Achievement's name must be unique; this one is already in use."
+#: includes/templates/achievements/_addedit.php:114
+#: includes/templates/achievements/create.php:10
+msgid "Create Achievement"
msgstr ""
-#: includes/achievements-classes.php:324
-msgid "Missing Achievement description."
+#: includes/templates/achievements/achievements-loop.php:23
+msgid "This Achievement is worth %s points."
msgstr ""
-#: includes/achievements-classes.php:331
-msgid "This slug conflicts with something important; please try another."
+#: includes/templates/achievements/achievements-loop.php:29
+msgid "Unlocked %s"
msgstr ""
-#: includes/achievements-classes.php:334
-msgid "The slug must be unique; this one is already in use."
+#: includes/templates/achievements/achievements-loop.php:42
+msgid "Inactive"
msgstr ""
-#: includes/feeds/dpa-myachievements-feed.php:28
-msgid "%s's Achievement Feed"
+#: includes/templates/achievements/achievements-loop.php:79
+msgid "There were no Achievements found matching &ldquo;%s.&rdquo;"
msgstr ""
-#: includes/feeds/dpa-myachievements-feed.php:31
-msgid "Activity feed for the achievement, %s"
+#: includes/templates/achievements/achievements-loop.php:81
+msgid "You haven't unlocked any Achievements yet"
msgstr ""
-#: includes/feeds/dpa-myachievements-feed.php:50
-msgid "Comments: %s"
+#: includes/templates/achievements/achievements-loop.php:83
+msgid "%s hasn't unlocked any Achievements yet"
msgstr ""
-#: includes/achievements-notifications.php:36
-msgid "Achievement unlocked: %s"
+#: includes/templates/achievements/achievements-loop.php:85
+msgid "Oops, no Achievements were found!"
msgstr ""
-#: includes/achievements-notifications.php:41
-msgid "Achievements unlocked!"
+#: includes/templates/achievements/create.php:10
+#: includes/templates/achievements/index.php:7
+msgid "Achievements Directory"
msgstr ""
-#: includes/achievements-notifications.php:79
-msgid "[%1$s] Achievement unlocked: %2$s"
+#: includes/templates/achievements/create.php:28
+#: includes/templates/achievements/single/edit.php:4
+msgid ""
+"Some of the Action options below may not be relevant to the type or event of "
+"the Achievement."
msgstr ""
-#: includes/achievements-notifications.php:80
+#: includes/templates/achievements/create.php:30
msgid ""
-"\n"
-"You have unlocked an Achievement: %1$s\n"
-"\n"
-"To review this and see all of your Achievements, go to %2$s\n"
-"\n"
-"---------------------\n"
-"To disable these notifications please log in and go to: %3$s"
+"After you create the Achievement, you'll be able to choose a picture for it."
msgstr ""
-#: includes/achievements-core.php:108
-msgid "Achievements <span>%s</span>"
+#: includes/templates/achievements/index.php:7
+msgid "Create an Achievement"
msgstr ""
-#: includes/achievements-core.php:116 includes/achievements-core.php:262
-msgid "My Achievements"
+#: includes/templates/achievements/index.php:17
+msgid "All Achievements <span>%s</span>"
msgstr ""
-#: includes/achievements-core.php:139 includes/achievements-core.php:153
-msgid "Home"
+#: includes/templates/achievements/index.php:27
+#: includes/templates/members/single/achievements/unlocked.php:9
+msgid "Order By:"
msgstr ""
-#: includes/achievements-core.php:163
-msgid "Unlocked By <span>%s</span>"
+#: includes/templates/achievements/index.php:29
+#: includes/templates/members/single/achievements/unlocked.php:12
+msgid "Alphabetical"
msgstr ""
-#: includes/achievements-core.php:212
-msgid "Grant"
+#: includes/templates/achievements/index.php:30
+#: includes/templates/members/single/achievements/unlocked.php:13
+msgid "Event Count"
msgstr ""
-#: includes/achievements-core.php:297
-msgid "Achievement RSS Feed"
+#: includes/templates/achievements/index.php:31
+msgid "Newest"
msgstr ""
-#: includes/achievements-core.php:701
-msgid "Sorry, there was no activity found. Please try a different filter."
-msgstr ""
+#: includes/templates/achievements/single/achievement-header.php:24
+msgid "%s point"
+msgid_plural "%s points"
+msgstr[0] ""
+msgstr[1] ""
-#: includes/achievements-core.php:702
-msgid "Sorry, there was no activity found."
+#: includes/templates/achievements/single/achievement-header.php:27
+msgid "Inactive Achievement"
msgstr ""
-#: includes/achievements-core.php:1729
-msgid "The Achievement's picture has been updated."
-msgstr ""
+#: includes/templates/achievements/single/achievement-header.php:30
+msgid "Only %s person has unlocked this Achievement"
+msgid_plural "%s people have unlocked this Achievement"
+msgstr[0] ""
+msgstr[1] ""
-#: includes/achievements-core.php:1734
+#: includes/templates/achievements/single/change-picture.php:17
msgid ""
-"There was an error changing the Achievement's picture, please try again."
+"We've noticed that you've got a lot of pictures to choose from. <a "
+"href='%s'>Set a filter</a> to restrict which images are retrieved from your "
+"<a href='%s'>WordPress Media Library</a>."
msgstr ""
-#: includes/achievements-core.php:1803
-msgid "The Achievement's details have been updated."
+#: includes/templates/achievements/single/change-picture.php:28
+msgid "Update Picture"
msgstr ""
-#: includes/achievements-core.php:1814
+#: includes/templates/achievements/single/change-picture.php:46
msgid ""
-"An error has occurred and the Achievement's details have not been updated. "
-"See below for details."
-msgstr ""
-
-#: includes/achievements-core.php:1837
-msgid "You need to select at least one person to give this Achievement to!"
-msgstr ""
-
-#: includes/achievements-core.php:1854
-msgid "The specified members have successfully received this Achievement."
-msgstr ""
-
-#: includes/achievements-core.php:1883
-msgid "There was an error deleting the Achievement, please try again."
-msgstr ""
-
-#: includes/achievements-core.php:1892
-msgid "The Achievement was deleted successfully."
-msgstr ""
-
-#: includes/achievements-core.php:1970
-msgid "Achievement created succesfully!"
+"Before you can choose a picture, you need to upload an image to the <a "
+"href='%s'>WordPress Media Library</a>."
msgstr ""
-#: includes/achievements-core.php:1986
+#: includes/templates/achievements/single/change-picture.php:50
msgid ""
-"An error has occurred and the Achievement has not been created. See below "
-"for details."
-msgstr ""
-
-#: includes/achievements-core.php:2006
-msgid "Yes"
-msgstr ""
-
-#: includes/achievements-core.php:2007
-msgid "No"
-msgstr ""
-
-#: includes/achievements-core.php:2014
-msgid "You unlock an achievement"
-msgstr ""
-
-#: includes/achievements-core.php:2046
-msgid "Achievement unlocked"
-msgstr ""
-
-#: includes/achievements-core.php:2075
-msgid "%1$s unlocked %2$s"
-msgstr ""
-
-#: includes/achievements-core.php:2086
-msgid "%1$s created the Achievement %2$s"
-msgstr ""
-
-#: includes/achievements-widgets.php:27
-msgid "Sitewide leaderboard"
-msgstr ""
-
-#: includes/achievements-widgets.php:28
-msgid "Achievements Leaderboard"
-msgstr ""
-
-#: includes/achievements-widgets.php:73
-msgid "Position"
-msgstr ""
-
-#. translators: column heading, indicating numerical position in a list
-#: includes/achievements-widgets.php:73
-msgid "#"
-msgstr ""
-
-#: includes/achievements-widgets.php:74
-msgid "Member"
-msgstr ""
-
-#: includes/achievements-widgets.php:75
-msgid "Score"
-msgstr ""
-
-#: includes/achievements-widgets.php:131
-msgid "Achievement Leaderboard"
-msgstr ""
-
-#: includes/achievements-widgets.php:137 includes/achievements-widgets.php:276
-#: includes/achievements-widgets.php:400 includes/achievements-widgets.php:509
-#: includes/achievements-widgets.php:638 includes/achievements-widgets.php:743
-msgid "Title"
-msgstr ""
-
-#: includes/achievements-widgets.php:141
-msgid "Limit to this many results"
-msgstr ""
-
-#: includes/achievements-widgets.php:145
-msgid "Appearance"
-msgstr ""
-
-#: includes/achievements-widgets.php:169
-msgid "League table"
-msgstr ""
-
-#: includes/achievements-widgets.php:169
-msgid "Modern"
-msgstr ""
-
-#: includes/achievements-widgets.php:188
-msgid "A photo grid of a member's unlocked Achievements"
-msgstr ""
-
-#: includes/achievements-widgets.php:189
-msgid "Achievements, Unlocked"
-msgstr ""
-
-#: includes/achievements-widgets.php:231 includes/achievements-widgets.php:356
-msgid "Show All"
-msgstr ""
-
-#: includes/achievements-widgets.php:265
-msgid "Your Recent Achievements"
-msgstr ""
-
-#: includes/achievements-widgets.php:280 includes/achievements-widgets.php:642
-msgid "Limit to this many Achievements"
-msgstr ""
-
-#: includes/achievements-widgets.php:284 includes/achievements-widgets.php:646
-#: includes/achievements-widgets.php:747
-msgid "Always show as logged in member"
+"Unfortunately, there aren't any pictures to choose from. You'll need to ask "
+"an Administrator to upload some to the WordPress Media Library for you."
msgstr ""
-#: includes/achievements-widgets.php:307
+#: includes/templates/achievements/single/delete.php:4
msgid ""
-"A photo grid of all the Achievements available on this site; intended for "
-"multisite"
-msgstr ""
-
-#: includes/achievements-widgets.php:308
-msgid "Achievements, All"
-msgstr ""
-
-#: includes/achievements-widgets.php:390
-msgid "All Available Achievements"
-msgstr ""
-
-#: includes/achievements-widgets.php:404
-msgid "Show this many Achievements"
-msgstr ""
-
-#: includes/achievements-widgets.php:408
-msgid "Always show non site-specific Achievements"
-msgstr ""
-
-#: includes/achievements-widgets.php:430
-msgid "Displays a single Achievement in detail"
-msgstr ""
-
-#: includes/achievements-widgets.php:431
-msgid "Achievements, Featured"
-msgstr ""
-
-#: includes/achievements-widgets.php:463
-msgid "%s points"
-msgstr ""
-
-#: includes/achievements-widgets.php:470
-msgid "Show More"
-msgstr ""
-
-#: includes/achievements-widgets.php:503
-msgid "Featured Achievement"
-msgstr ""
-
-#: includes/achievements-widgets.php:513
-msgid "Achievement"
-msgstr ""
-
-#: includes/achievements-widgets.php:552
-msgid "A photo grid of Achievements which the member is yet to unlock"
+"WARNING: Any members who have unlocked this Achievement will have it "
+"removed. There is no way back, please be careful with this option."
msgstr ""
-#: includes/achievements-widgets.php:553
-msgid "Achievements, Locked"
+#: includes/templates/achievements/single/delete.php:7
+msgid "I understand the consequences of deleting this Achievement."
msgstr ""
-#: includes/achievements-widgets.php:627
-msgid "Unlock These Achievements"
+#: includes/templates/achievements/single/delete.php:10
+msgid "Delete Achievement"
msgstr ""
-#: includes/achievements-widgets.php:670
-msgid "Displays a member's Achievement score"
+#: includes/templates/achievements/single/grant.php:13
+msgid "Select people to give this Achievement to."
msgstr ""
-#: includes/achievements-widgets.php:671
-msgid "Achievements, Member's Score"
+#: includes/templates/achievements/single/grant.php:22
+msgid "Give Achievement"
msgstr ""
-#: includes/achievements-widgets.php:733
-msgid "Achievement Score"
+#: includes/templates/members/single/achievements/unlocked.php:11
+msgid "Recently Unlocked"
msgstr ""
#: loader.php:46
View
22 plugins/achievements/includes/achievements-classes.php
@@ -422,13 +422,13 @@ function get( $args ) {
break;
case 'active':
- $sql = $wpdb->prepare( "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 1" );
- $sql_total_count = $wpdb->prepare( "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 1" );
+ $sql = "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 1";
+ $sql_total_count ="SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 1";
break;
case 'inactive':
- $sql = $wpdb->prepare( "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 0" );
- $sql_total_count = $wpdb->prepare( "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 0" );
+ $sql = "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 0";
+ $sql_total_count = "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 0";
break;
case 'single':
@@ -445,8 +445,8 @@ function get( $args ) {
case 'eventcount':
case 'newest':
case 'points':
- $sql = $wpdb->prepare( "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}" );
- $sql_total_count = $wpdb->prepare( "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}" );
+ $sql = "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}";
+ $sql_total_count = "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}";
break;
}
@@ -471,7 +471,7 @@ function get( $args ) {
// Only admins see inactive Achievements in the Directory.
if ( !dpa_permission_can_user_edit() ) {
if ( $search_terms ) {
- $admin_sql = $wpdb->prepare( " AND is_active=1" );
+ $admin_sql = " AND is_active=1";
$sql .= $admin_sql;
$sql_total_count .= $admin_sql;
@@ -648,9 +648,9 @@ function dpa_get_total_achievements_count() {
$admin_sql = '';
if ( !dpa_permission_can_user_edit() )
- $admin_sql = $wpdb->prepare( "WHERE is_active=1" );
+ $admin_sql = "WHERE is_active=1";
- $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->achievements->table_achievements} {$admin_sql}" ) );
+ $count = $wpdb->get_var( "SELECT COUNT(id) FROM {$bp->achievements->table_achievements} {$admin_sql}" );
wp_cache_set( 'dpa_get_total_achievements_count', $count, 'dpa' );
}
@@ -670,10 +670,10 @@ function dpa_get_total_achievements_count_for_user( $user_id = false ) {
global $bp, $wpdb;
if ( !$user_id )
- $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
+ $user_id = ( ! empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
if ( !$count = wp_cache_get( 'dpa_get_total_achievements_count_for_user_' . $user_id, 'bp' ) ) {
- $admin_sql = $wpdb->prepare( "AND (is_active = 1 OR is_active = 2)" );
+ $admin_sql = "AND (is_active = 1 OR is_active = 2)";
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a, {$bp->achievements->table_unlocked} as u WHERE a.id = u.achievement_id AND u.user_id = %d {$admin_sql}", $user_id ) );
wp_cache_set( 'dpa_get_total_achievements_count_for_user_' . $user_id, $count, 'bp' );
}
View
11 plugins/achievements/includes/achievements-core.php
@@ -51,6 +51,7 @@
function dpa_setup_globals() {
global $bp;
+ $bp->achievements = new stdClass;
$bp->achievements->id = 'achievements';
$bp->achievements->slug = DPA_SLUG;
$bp->achievements->table_achievements = $bp->table_prefix . 'achievements';
@@ -258,6 +259,7 @@ function dpa_setup_admin_bar() {
// My Achievements
$wp_admin_nav[] = array(
+ 'id' => 'dpa-my-achievements',
'parent' => 'my-account-' . $bp->achievements->id,
'title' => __( 'My Achievements', 'dpa' ),
'href' => trailingslashit( $link . DPA_SLUG_MY_ACHIEVEMENTS )
@@ -450,7 +452,7 @@ function dpa_get_active_actions() {
global $bp, $wpdb;
if ( !$actions = wp_cache_get( 'dpa_active_actions', 'dpa' ) ) {
- $actions = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT action.name FROM {$bp->achievements->table_achievements} as achievement, {$bp->achievements->table_actions} as action WHERE achievement.action_id = action.id AND achievement.action_id != -1 AND (achievement.is_active = 1 OR achievement.is_active = 2)" ) );
+ $actions = $wpdb->get_results( "SELECT DISTINCT action.name FROM {$bp->achievements->table_achievements} as achievement, {$bp->achievements->table_actions} as action WHERE achievement.action_id = action.id AND achievement.action_id != -1 AND (achievement.is_active = 1 OR achievement.is_active = 2)" );
wp_cache_set( 'dpa_active_actions', $actions, 'dpa' );
}
return apply_filters( 'dpa_get_active_actions', (array)$actions );
@@ -468,7 +470,7 @@ function dpa_get_actions() {
global $bp, $wpdb;
if ( !$actions = wp_cache_get( 'dpa_actions', 'dpa' ) ) {
- $actions = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->achievements->table_actions} ORDER BY category, description" ) );
+ $actions = $wpdb->get_results( "SELECT * FROM {$bp->achievements->table_actions} ORDER BY category, description" );
wp_cache_set( 'dpa_actions', $actions, 'dpa' );
}
return apply_filters( 'dpa_get_actions', (array)$actions );
@@ -1962,6 +1964,11 @@ function dpa_screen_achievement_create() {
$achievements_errors = $achievement->save();
if ( !is_wp_error( $achievements_errors ) ) {
+
+ // Avoid PHP warning
+ if ( ! isset( $achievements_template ) )
+ $achievements_template = new stdClass;
+
$achievements_template->achievement = $achievement; // Required for dpa_record_activity()
if ( 1 == $achievement->is_active )
View
4 plugins/achievements/includes/achievements-templatetags.php
@@ -1103,7 +1103,7 @@ function dpa_addedit_action_groups() {
function dpa_get_addedit_action_groups() {
global $bp, $wpdb;
- $groups = $wpdb->get_results( $wpdb->prepare( "SELECT id, name FROM {$bp->groups->table_name} ORDER BY name ASC" ) );
+ $groups = $wpdb->get_results( "SELECT id, name FROM {$bp->groups->table_name} ORDER BY name ASC" );
$current_group_id = $bp->achievements->current_achievement->group_id;
$selected = ( $current_group_id < 1 ) ? 'selected="selected"' : '';
$options = array( sprintf( '<option value="%1$d"%2$s>%3$s</option>', apply_filters( 'dpa_get_achievement_group_id', -1 ), $selected, __( '(All groups)', 'dpa' ) ) );
@@ -1144,7 +1144,7 @@ function dpa_get_grant_achievement_userlist() {
else
$column = "user_status";
- $members = $wpdb->get_results( $wpdb->prepare( "SELECT ID, display_name FROM {$wpdb->users} WHERE {$column} = 0 ORDER BY display_name ASC" ) );
+ $members = $wpdb->get_results( "SELECT ID, display_name FROM {$wpdb->users} WHERE {$column} = 0 ORDER BY display_name ASC" );
foreach ( $members as $member )
$options[] = sprintf( '<li><input type="checkbox" name="members[]" id="m-%1$d" value="%2$d" />%3$s', apply_filters( 'bp_get_member_user_id', $member->ID ), apply_filters( 'bp_get_member_user_id', $member->ID ), apply_filters( 'bp_get_member_user_nicename', $member->display_name ) );
View
22 plugins/achievements/loader.php
@@ -13,9 +13,9 @@
Plugin Name: Achievements
Plugin URI: http://achievementsapp.com/
Description: Achievements gives your BuddyPress community fresh impetus by promoting and rewarding social interaction with challenges, badges and points.
-Version: 2.3
+Version: 2.4
Requires at least: WP 3.0.1, BuddyPress 1.5
-Tested up to: WP 3.3.1, BuddyPress 1.6
+Tested up to: WP 3.5.999, BuddyPress 1.6.3
License: General Public License version 3
Author: Paul Gibbs
Author URI: http://byotos.com/
@@ -24,7 +24,7 @@
Text Domain: dpa
"Achievements for BuddyPress"
-Copyright (C) 2009-12 Paul Gibbs
+Copyright (C) 2009-13 Paul Gibbs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as published by
@@ -166,7 +166,7 @@ function dpa_install_and_upgrade() {
break;
case 1:
- $wpdb->query( $wpdb->prepare( "ALTER TABLE {$table_prefix}achievements ADD COLUMN site_id bigint(20) NOT NULL" ) );
+ $wpdb->query( "ALTER TABLE {$table_prefix}achievements ADD COLUMN site_id bigint(20) NOT NULL" );
$wpdb->update( "{$table_prefix}achievements", array( 'site_id' => BP_ROOT_BLOG ), null, '%d' );
break;
@@ -206,15 +206,15 @@ function dpa_install_and_upgrade() {
break;
case 4:
- $wpdb->query( $wpdb->prepare( "CREATE INDEX name ON {$table_prefix}achievements (name(20))" ) );
- $wpdb->query( $wpdb->prepare( "CREATE INDEX action_id ON {$table_prefix}achievements (action_id)" ) );
- $wpdb->query( $wpdb->prepare( "CREATE INDEX description ON {$table_prefix}achievements (description(20))" ) );
+ $wpdb->query( "CREATE INDEX name ON {$table_prefix}achievements (name(20))" );
+ $wpdb->query( "CREATE INDEX action_id ON {$table_prefix}achievements (action_id)" );
+ $wpdb->query( "CREATE INDEX description ON {$table_prefix}achievements (description(20))" );
break;
case 5:
- $wpdb->query( $wpdb->prepare( "ALTER TABLE {$table_prefix}achievements ADD COLUMN group_id bigint(20) NOT NULL" ) );
+ $wpdb->query( "ALTER TABLE {$table_prefix}achievements ADD COLUMN group_id bigint(20) NOT NULL" );
$wpdb->update( "{$table_prefix}achievements", array( 'group_id' => -1 ), null, '%d' );
- $wpdb->query( $wpdb->prepare( "CREATE INDEX group_id ON {$table_prefix}achievements (group_id)" ) );
+ $wpdb->query( "CREATE INDEX group_id ON {$table_prefix}achievements (group_id)" );
break;
case 6:
@@ -242,7 +242,7 @@ function dpa_install_and_upgrade() {
break;
case 9:
- $wpdb->query( $wpdb->prepare( "ALTER TABLE {$table_prefix}achievements_actions ADD COLUMN is_group_action int(1) NOT NULL" ) );
+ $wpdb->query( "ALTER TABLE {$table_prefix}achievements_actions ADD COLUMN is_group_action int(1) NOT NULL" );
$wpdb->update( "{$table_prefix}achievements_actions", array( 'is_group_action' => 0 ), null, '%d' );
$wpdb->update( "{$table_prefix}achievements_actions", array( 'is_group_action' => 1 ), array( 'category' => 'groups' ), '%d' );
break;
@@ -306,7 +306,7 @@ function dpa_install_and_upgrade() {
break;
case 19:
- $wpdb->query( $wpdb->prepare( "CREATE INDEX is_active ON {$table_prefix}achievements (is_active)" ) );
+ $wpdb->query( "CREATE INDEX is_active ON {$table_prefix}achievements (is_active)" );
break;
case 20:
View
14 plugins/achievements/readme.txt
@@ -4,8 +4,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=P3K7Z
Tags: buddypress,achievement,cubepoints,reward,points,score,rank,social,gaming,tokens,status,badge,WoW,Warcraft,games,challenges
License: General Public License version 3
Requires at least: WP 3.0.1, BuddyPress 1.5
-Tested up to: WP 3.3.1, BuddyPress 1.6
-Stable tag: 2.3
+Tested up to: WP 3.5.999, BuddyPress 1.6.3
+Stable tag: 2.4
Achievements gives your BuddyPress community fresh impetus by promoting and rewarding social interaction with challenges, badges and points.
@@ -25,6 +25,10 @@ For information, support, premium enhancements and developer documentation, visi
1. To get started, visit your site, and select the "Achievements" in the main navigation.
== Changelog ==
+= 2.4 =
+* Compatibility fixes for WordPress 3.5. Props to Norm Huelsman for the initial patch.
+* Fix PHP warnings.
+
= 2.3 =
* Improves compatibility with some themes.
@@ -88,15 +92,15 @@ For information, support, premium enhancements and developer documentation, visi
* The historical release history has been moved to a better place.
== Upgrade Notice ==
-= 2.3 =
-* Improves compatibility with some themes.
+= 2.4 =
+* Improves compatibility with WordPress 3.5.
== Frequently Asked Questions ==
For information, support, and developer documentation, visit http://achievementsapp.com/.
== License ==
"Achievements for BuddyPress"
-Copyright (C) 2009-12 Paul Gibbs
+Copyright (C) 2009-13 Paul Gibbs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as published by
View
454 plugins/cms-tree-page-view/functions.php
@@ -1,5 +1,36 @@
<?php
+
+/**
+ * Example how to use action cms_tree_page_view_post_can_edit to modify if a user can edit the page/post
+ */
+/*
+add_action("cms_tree_page_view_post_can_edit", function($can_edit, $post_id) {
+
+ if ($post_id === 163) $can_edit = FALSE;
+
+ return $can_edit;
+
+}, 10, 2);
+
+
+add_action("cms_tree_page_view_post_user_can_add_inside", function($can_edit, $post_id) {
+
+ if ($post_id === 233) $can_edit = FALSE;
+
+ return $can_edit;
+
+}, 10, 2);
+
+add_action("cms_tree_page_view_post_user_can_add_after", function($can_edit, $post_id) {
+
+ if ($post_id === 142) $can_edit = FALSE;
+
+ return $can_edit;
+
+}, 10, 2);
+*/
+
/**
* Use the ajax action-thingie to catch our form with new pages
* Add pages and then redirect to...?
@@ -175,10 +206,15 @@ function cms_tpv_add_pages() {
// require("FirePHPCore/FirePHP.class.php");
// $firephp = FirePHP::getInstance(true);
+/**
+ * Output and add hooks in head
+ */
function cms_tpv_admin_head() {
if (!cms_tpv_is_one_of_our_pages()) return;
+ cms_tpv_setup_postsoverview();
+
global $cms_tpv_view;
if (isset($_GET["cms_tpv_view"])) {
$cms_tpv_view = htmlspecialchars($_GET["cms_tpv_view"]);
@@ -214,7 +250,10 @@ function cms_tpv_is_one_of_our_pages() {
$options = cms_tpv_get_options();
$post_type = cms_tpv_get_selected_post_type();
- $current_screen = get_current_screen(); # sf_d($current_screen);
+
+ if (! function_exists("get_current_screen")) return FALSE;
+
+ $current_screen = get_current_screen();
$is_plugin_page = FALSE;
// Check if current page is one of the ones defined in $options["menu"]
@@ -225,10 +264,16 @@ function cms_tpv_is_one_of_our_pages() {
}
}
+ // Check if current page is one of the ones defined in $options["postsoverview"]
+ if ($current_screen->base === "edit" && in_array($current_screen->post_type, $options["postsoverview"])) {
+ $is_plugin_page = TRUE;
+ }
+
if ($current_screen->id === "settings_page_cms-tpv-options") {
// Is settings page for plugin
$is_plugin_page = TRUE;
} elseif ($current_screen->id === "dashboard" && !empty($options["dashboard"])) {
+ // At least one post type is enabled to be visible on dashboard
$is_plugin_page = TRUE;
}
@@ -241,7 +286,6 @@ function cms_tpv_is_one_of_our_pages() {
*/
function cms_admin_enqueue_scripts() {
-
if (cms_tpv_is_one_of_our_pages()) {
// renamed from cookie to fix problems with mod_security
@@ -285,6 +329,7 @@ function cms_admin_enqueue_scripts() {
"Password_protected_page" => __("Password protected page", 'cms-tree-page-view'),
"Adding_page" => __("Adding page...", 'cms-tree-page-view'),
"Adding" => __("Adding ...", 'cms-tree-page-view'),
+ "No posts found" => __("No posts found.", 'cms-tree-page-view')
);
wp_localize_script( "cms_tree_page_view", 'cmstpv_l10n', $oLocale);
@@ -292,20 +337,133 @@ function cms_admin_enqueue_scripts() {
}
+function cms_tpv_load_textdomain() {
+ // echo "load textdomain";
+ if (is_admin()) {
+ load_plugin_textdomain('cms-tree-page-view', WP_CONTENT_DIR . "/plugins/languages", "/cms-tree-page-view/languages");
+ }
+}
function cms_tpv_admin_init() {
// DEBUG
//wp_enqueue_script( "jquery-hotkeys" );
- load_plugin_textdomain('cms-tree-page-view', WP_CONTENT_DIR . "/plugins/languages", "/cms-tree-page-view/languages");
-
// add row to plugin page
+
add_filter( 'plugin_row_meta', 'cms_tpv_set_plugin_row_meta', 10, 2 );
}
/**
+ * Check if this is a post overview page and that plugin is enabled for this overview page
+ */
+function cms_tpv_setup_postsoverview() {
+
+ $options = cms_tpv_get_options();
+ $current_screen = get_current_screen();
+
+ if ("edit" === $current_screen->base && in_array($current_screen->post_type, $options["postsoverview"])) {
+
+ // Ok, this is a post overview page that we are enabled for
+ add_filter("views_" . $current_screen->id, "cmstpv_filter_views_edit_postsoverview");
+
+ cmstpv_postoverview_head();
+
+ }
+
+}
+
+/**
+ * Add style etc to wp head to minimize flashing content
+ */
+function cmstpv_postoverview_head() {
+
+ if ( isset($_GET["mode"]) && $_GET["mode"] === "tree" ) {
+ ?>
+ <style>
+ /* hide and position WP things */
+ /* TODO: move this to wp head so we don't have time to see wps own stuff */
+ .subsubsub, .tablenav.bottom, .tablenav .actions, .wp-list-table, .search-box, .tablenav .tablenav-pages { display: none !important; }
+ .tablenav.top { float: right; }
+ .view-switch { visibility: hidden; }
+ </style>
+ <?php
+ } else {
+ // post overview is enabled, but not active
+ // make room for our icon directly so page does not look jerky while adding it
+ ?>
+ <style>
+ .view-switch {
+ padding-right: 23px;
+ }
+ </style>
+ <?php
+ }
+
+}
+
+/**
+ * Output tree and html code for post overview page
+ */
+function cmstpv_filter_views_edit_postsoverview($filter_var) {
+
+ $current_screen = get_current_screen();
+
+ ob_start();
+ cms_tpv_print_common_tree_stuff();
+ $tree_common_stuff = ob_get_clean();
+
+ /*
+ on non hierarcical post types this one exists:
+ tablenav-pages one-page
+ then after:
+ <div class="view-switch">
+
+ if view-switch exists: add item to it
+ if view-switch not exists: add it + item to it
+
+ http://playground.ep/wordpress/wp-admin/images/list.png
+ */
+ $mode = "tree";
+ $class = isset($_GET["mode"]) && $_GET["mode"] == $mode ? " class='current' " : "";
+ $title = __("Tree View", 'cms-tree-page-view');
+ $tree_a = "<a href='" . esc_url( add_query_arg( 'mode', $mode, $_SERVER['REQUEST_URI'] ) ) . "' $class> <img id='view-switch-$mode' src='" . esc_url( includes_url( 'images/blank.gif' ) ) . "' width='20' height='20' title='$title' alt='$title' /></a>\n";
+
+ // Copy of wordpress own, if it does not exist
+ $wp_list_a = "";
+ if (is_post_type_hierarchical( $current_screen->post_type ) ) {
+
+ $mode = "list";
+ $class = isset($_GET["mode"]) && $_GET["mode"] != $mode ? " class='cmstpv_add_list_view' " : " class='cmstpv_add_list_view current' ";
+ $title = __("List View");
+ $wp_list_a = "<a href='" . esc_url( add_query_arg( 'mode', $mode, $_SERVER['REQUEST_URI'] ) ) . "' $class><img id='view-switch-$mode' src='" . esc_url( includes_url( 'images/blank.gif' ) ) . "' width='20' height='20' title='$title' alt='$title' /></a>\n";
+
+ }
+
+ $out = "";
+ $out .= $tree_a;
+ $out .= $wp_list_a;
+
+ // Output tree related stuff if that view/mode is selected
+ if (isset($_GET["mode"]) && $_GET["mode"] === "tree") {
+
+ $out .= sprintf('
+ <div class="cmstpv-postsoverview-wrap">
+ %1$s
+ </div>
+ ', $tree_common_stuff);
+
+ }
+
+ echo $out;
+
+ return $filter_var;
+
+}
+
+
+/**
* Add settings link to plugin page
* Hopefully this helps some people to find the settings page quicker
*/
@@ -322,30 +480,42 @@ function cms_tpv_set_plugin_row_meta($links, $file) {
}
-// save settings
+/**
+ * Save settings, called when saving settings in general > cms tree page view
+ */
function cms_tpv_save_settings() {
+
if (isset($_POST["cms_tpv_action"]) && $_POST["cms_tpv_action"] == "save_settings") {
+
$options = array();
$options["dashboard"] = (array) $_POST["post-type-dashboard"];
$options["menu"] = (array) $_POST["post-type-menu"];
+ $options["postsoverview"] = (array) $_POST["post-type-postsoverview"];
+
update_option('cms_tpv_options', $options); // enable this to show box
+
}
+
}
/**
* Add widget to dashboard
*/
function cms_tpv_wp_dashboard_setup() {
+
+ // echo "setup dashboard";
+
// add dashboard to capability edit_pages only
if (current_user_can("edit_pages")) {
$options = cms_tpv_get_options();
foreach ($options["dashboard"] as $one_dashboard_post_type) {
$post_type_object = get_post_type_object($one_dashboard_post_type);
$new_func_name = create_function('', "cms_tpv_dashboard('$one_dashboard_post_type');");
- $widget_name = _x(sprintf('%1$s Tree', $post_type_object->labels->name), "name of dashboard", "cms-tree-page-view");
+ $widget_name = sprintf( _x('%1$s Tree', "name of dashboard", "cms-tree-page-view"), $post_type_object->labels->name);
wp_add_dashboard_widget( "cms_tpv_dashboard_widget_{$one_dashboard_post_type}", $widget_name, $new_func_name );
}
}
+
}
@@ -371,7 +541,7 @@ function cms_tpv_admin_menu() {
$post_type_object = get_post_type_object($one_menu_post_type);
$menu_name = _x("Tree View", "name in menu", "cms-tree-page-view");
- $page_title = _x(sprintf('%1$s Tree View', $post_type_object->labels->name), "title on page with tree", "cms-tree-page-view");
+ $page_title = sprintf(_x('%1$s Tree View', "title on page with tree", "cms-tree-page-view"), $post_type_object->labels->name);
add_submenu_page($slug, $page_title, $menu_name, $post_type_object->cap->edit_posts, "cms-tpv-page-$one_menu_post_type", "cms_tpv_pages_page");
}
@@ -379,7 +549,6 @@ function cms_tpv_admin_menu() {
}
-
/**
* Output options page
*/
@@ -389,65 +558,103 @@ function cms_tpv_options() {
<div class="wrap">
<?php cms_tpv_show_annoying_box(); ?>
-
+
+ <?php screen_icon(); ?>
<h2><?php echo CMS_TPV_NAME ?> <?php _e("settings", 'cms-tree-page-view') ?></h2>
- <form method="post" action="options.php">
+ <form method="post" action="options.php" class="cmtpv_options_form">
+
<?php wp_nonce_field('update-options'); ?>
<h3><?php _e("Select where to show a tree for pages and custom post types", 'cms-tree-page-view')?></h3>
- <?php
- $options = cms_tpv_get_options();
-
- $post_types = get_post_types(array(
- "show_ui" => TRUE
- ), "objects");
- $arr_page_options = array();
- foreach ($post_types as $one_post_type) {
- $name = $one_post_type->name;
-
- if ($name == "post") {
- // no support for pages. you could show them.. but since we can't reorder them there is not idea to show them.. or..?
- // 14 jul 2011: ok, let's enable it for posts too. some people says it useful
- // http://wordpress.org/support/topic/this-plugin-should-work-also-on-posts
- // continue;
- }
-
- $arr_page_options[] = "post-type-dashboard-$name";
- $arr_page_options[] = "post-type-menu-$name";
- echo "<p>";
- echo "<strong>".$one_post_type->label."</strong>";
+ <table class="form-table">
- $checked = (in_array($name, $options["dashboard"])) ? " checked='checked' " : "";
- echo "<br />";
- echo "<input $checked type='checkbox' name='post-type-dashboard[]' value='$name' id='post-type-dashboard-$name' /> <label for='post-type-dashboard-$name'>" . __("On dashboard", 'cms-tree-page-view') . "</label>";
+ <tbody>
- $checked = (in_array($name, $options["menu"])) ? " checked='checked' " : "";
- echo "<br />";
- echo "<input $checked type='checkbox' name='post-type-menu[]' value='$name' id='post-type-menu-$name' /> <label for='post-type-menu-$name'>" . __("In menu", 'cms-tree-page-view') . "</label>";
- echo "</p>";
+ <?php
+
+ $options = cms_tpv_get_options();
- }
+ $post_types = get_post_types(array(
+ "show_ui" => TRUE
+ ), "objects");
+
+ $arr_page_options = array();
+ foreach ($post_types as $one_post_type) {
+
+ $name = $one_post_type->name;
+
+ if ($name === "post") {
+ // no support for pages. you could show them.. but since we can't reorder them there is not idea to show them.. or..?
+ // 14 jul 2011: ok, let's enable it for posts too. some people says it useful
+ // http://wordpress.org/support/topic/this-plugin-should-work-also-on-posts
+ // continue;
+ } else if ($name === "attachment") {
+ // No support for media/attachment
+ continue;
+ }
+
+ $arr_page_options[] = "post-type-dashboard-$name";
+ $arr_page_options[] = "post-type-menu-$name";
+ $arr_page_options[] = "post-type-postsoverview-$name";
+
+ echo "<tr>";
+
+ echo "<th scope='row'>";
+ echo "<p>".$one_post_type->label."</p>";
+ echo "</th>";
+
+ echo "<td>";
+
+ echo "<p>";
+
+ $checked = (in_array($name, $options["dashboard"])) ? " checked='checked' " : "";
+ echo "<input $checked type='checkbox' name='post-type-dashboard[]' value='$name' id='post-type-dashboard-$name' /> <label for='post-type-dashboard-$name'>" . __("On dashboard", 'cms-tree-page-view') . "</label>";
+
+ echo "<br />";
+ $checked = (in_array($name, $options["menu"])) ? " checked='checked' " : "";
+ echo "<input $checked type='checkbox' name='post-type-menu[]' value='$name' id='post-type-menu-$name' /> <label for='post-type-menu-$name'>" . __("In menu", 'cms-tree-page-view') . "</label>";
+
+ echo "<br />";
+ $checked = (in_array($name, $options["postsoverview"])) ? " checked='checked' " : "";
+ echo "<input $checked type='checkbox' name='post-type-postsoverview[]' value='$name' id='post-type-postsoverview-$name' /> <label for='post-type-postsoverview-$name'>" . __("On post overview screen", 'cms-tree-page-view') . "</label>";
+
+ echo "</p>";
+
+ echo "</td>";
+
+ echo "</tr>";
+
+ }
+
+ ?>
+ </tbody>
+ </table>
- ?>
-
<input type="hidden" name="action" value="update" />
<input type="hidden" name="cms_tpv_action" value="save_settings" />
<input type="hidden" name="page_options" value="<?php echo join($arr_page_options, ",") ?>" />
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes', 'cms-tree-page-view') ?>" />
</p>
+
</form>
+
</div>
<?php
}
+/**
+ * Load settings
+ * @return array with options
+ */
function cms_tpv_get_options() {
$arr_options = (array) get_option('cms_tpv_options');
- $arr_options["dashboard"] = (array) $arr_options["dashboard"];
- $arr_options["menu"] = (array) $arr_options["menu"];
+ $arr_options["dashboard"] = (array) @$arr_options["dashboard"];
+ $arr_options["menu"] = (array) @$arr_options["menu"];
+ $arr_options["postsoverview"] = (array) @$arr_options["postsoverview"];
return $arr_options;
}
@@ -483,12 +690,14 @@ function cms_tpv_is_post_type_hierarchical($post_type_object) {
return $is_hierarchical;
}
-
+/**
+ * Get number of posts from WPML
+ */
function cms_tpv_get_wpml_post_counts($post_type) {
global $wpdb;
- $arr_statuses = array("publish", "draft", "trash");
+ $arr_statuses = array("publish", "draft", "trash", "future", "private");
$arr_counts = array();
foreach ($arr_statuses as $post_status) {
@@ -508,8 +717,10 @@ function cms_tpv_get_wpml_post_counts($post_type) {
WHERE p.post_type='{$post_type}' AND t.element_type='post_{$post_type}' {$extra_cond}
GROUP BY language_code
";
+
$res = $wpdb->get_results($sql);
+ $langs = array();
$langs['all'] = 0;
foreach($res as $r) {
$langs[$r->language_code] = $r->c;
@@ -535,7 +746,7 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
if (!$post_type) {
$post_type = cms_tpv_get_selected_post_type();
}
- #echo "post_type: $post_type";
+
$post_type_object = get_post_type_object($post_type);
$get_pages_args = array("post_type" => $post_type);
@@ -563,16 +774,16 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
$langs = array();
$wpml_post_counts = cms_tpv_get_wpml_post_counts($post_type);
-
- $post_count_all = @$wpml_post_counts["publish"][$wpml_current_lang] + @$wpml_post_counts["draft"][$wpml_current_lang];
- $post_count_publish = @$wpml_post_counts["publish"][$wpml_current_lang];
- $post_count_trash = @$wpml_post_counts["trash"][$wpml_current_lang];
-
+
+ $post_count_all = (int) @$wpml_post_counts["private"][$wpml_current_lang] + (int) @$wpml_post_counts["future"][$wpml_current_lang] + (int) @$wpml_post_counts["publish"][$wpml_current_lang] + (int) @$wpml_post_counts["draft"][$wpml_current_lang];
+ $post_count_publish = (int) @$wpml_post_counts["publish"][$wpml_current_lang];
+ $post_count_trash = (int) @$wpml_post_counts["trash"][$wpml_current_lang];
+
foreach ($wpml_post_counts["publish"] as $one_wpml_lang => $one_wpml_lang_count) {
if ("all" === $one_wpml_lang) continue;
- $lang_post_count_all = $wpml_post_counts["publish"][$one_wpml_lang] + $wpml_post_counts["draft"][$one_wpml_lang];
- $lang_post_count_publish = $wpml_post_counts["publish"][$one_wpml_lang];
- $lang_post_count_trash = $wpml_post_counts["trash"][$one_wpml_lang];
+ $lang_post_count_all = (int) @$wpml_post_counts["publish"][$one_wpml_lang] + (int) @$wpml_post_counts["draft"][$one_wpml_lang];
+ $lang_post_count_publish = (int) @$wpml_post_counts["publish"][$one_wpml_lang];
+ $lang_post_count_trash = (int) @$wpml_post_counts["trash"][$one_wpml_lang];
$status_data_attributes["all"] .= " data-post-count-{$one_wpml_lang}='{$lang_post_count_all}' ";
$status_data_attributes["publish"] .= " data-post-count-{$one_wpml_lang}='{$lang_post_count_publish}' ";
$status_data_attributes["trash"] .= " data-post-count-{$one_wpml_lang}='{$lang_post_count_trash}' ";
@@ -627,28 +838,22 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
$selected = "current";
}
- $lang_count = @$wpml_post_counts["publish"][$one_lang["language_code"]] + @$wpml_post_counts["draft"][$one_lang["language_code"]];
+ $lang_count = (int) @$wpml_post_counts["publish"][$one_lang["language_code"]] + (int) @$wpml_post_counts["draft"][$one_lang["language_code"]];
$lang_out .= "
<li>
<a class='cms_tvp_switch_lang $selected cms_tpv_switch_language_code_{$one_lang["language_code"]}' href='#'>
$one_lang_details[display_name]
<span class='count'>(" . $lang_count . ")</span>
- </a> | </li>";
+ </a> |</li>";
}
- $lang_out = preg_replace('/ \| <\/li>$/', "</li>", $lang_out);
+ $lang_out = preg_replace('/ \|<\/li>$/', "</li>", $lang_out);
$lang_out .= "</ul>";
echo $lang_out;
}
}
- if (empty($pages)) {
-
- echo '<div class="updated fade below-h2"><p>' . __("No posts found.", 'cms-tree-page-view') . '</p></div>';
-
- }
-
if (true) {
// start the party!
@@ -659,14 +864,12 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
<a class="cms_tvp_view_all <?php echo ($cms_tpv_view=="all") ? "current" : "" ?>" href="#" <?php echo $status_data_attributes["all"] ?>>
<?php _e("All", 'cms-tree-page-view') ?>
<span class="count">(<?php echo $post_count_all ?>)</span>
- </a> |
- </li>
+ </a> |</li>
<li class="cms_tvp_view_is_status_view">
<a class="cms_tvp_view_public <?php echo ($cms_tpv_view=="public") ? "current" : "" ?>" href="#" <?php echo $status_data_attributes["publish"] ?>>
<?php _e("Public", 'cms-tree-page-view') ?>
<span class="count">(<?php echo $post_count_publish ?>)</span>
- </a> |
- </li>
+ </a> |</li>
<li class="cms_tvp_view_is_status_view">
<a class="cms_tvp_view_trash <?php echo ($cms_tpv_view=="trash") ? "current" : "" ?>" href="#" <?php echo $status_data_attributes["trash"] ?>>
<?php _e("Trash", 'cms-tree-page-view') ?>
@@ -687,7 +890,7 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
<form class="cms_tree_view_search_form" method="get" action="">
<input type="text" name="search" class="cms_tree_view_search" />
<a title="<?php _e("Clear search", 'cms-tree-page-view') ?>" class="cms_tree_view_search_form_reset" href="#">x</a>
- <input type="submit" class="cms_tree_view_search_submit" value="<?php _e("Search", 'cms-tree-page-view') ?>" />
+ <input type="submit" class="cms_tree_view_search_submit button button-small" value="<?php _e("Search", 'cms-tree-page-view') ?>" />
<span class="cms_tree_view_search_form_working"><?php _e("Searching...", 'cms-tree-page-view') ?></span>
<span class="cms_tree_view_search_form_no_hits"><?php _e("Nothing found.", 'cms-tree-page-view') ?></span>
</form>
@@ -725,12 +928,12 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
<span class='cms_tpv_action_add_page'><?php echo $post_type_object->labels->add_new_item ?></span>
- <a href="#" title='<?php _e("Add new page after", "cms-tree-page-view")?>' class='cms_tpv_action_add_page_after'><?php _e("After", "cms-tree-page-view")?></a>
+ <a class='cms_tpv_action_add_page_after' href="#" title='<?php _e("Add new page after", "cms-tree-page-view")?>' ><?php _e("After", "cms-tree-page-view")?></a>
<?php
// if post type is hierarchical we can add pages inside
if (cms_tpv_is_post_type_hierarchical($post_type_object)) {
- ?><a href="#" title='<?php _e("Add new page inside", "cms-tree-page-view")?>' class='cms_tpv_action_add_page_inside'><?php _e("Inside", "cms-tree-page-view")?></a><?php
+ ?><a class='cms_tpv_action_add_page_inside' href="#" title='<?php _e("Add new page inside", "cms-tree-page-view")?>' ><?php _e("Inside", "cms-tree-page-view")?></a><?php
}
// if post status = draft then we can not add pages inside because wordpress currently can not keep its parent if we edit the page
?>
@@ -759,21 +962,21 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
</ul>
</div>
- <div>
- Position<br>
+ <div class="cms_tpv_add_position">
+ <?php _e("Position", "cms-tree-page-view") ?><br>
<label><input type="radio" name="cms_tpv_add_type" value="after"> <?php _e("After", "cms-tree-page-view") ?></label>
<label><input type="radio" name="cms_tpv_add_type" value="inside"> <?php _e("Inside", "cms-tree-page-view") ?></label>
</div>
<div>
- Status<br>
+ <? _e("Status", "cms-tree-page-view") ?><br>
<label><input type="radio" name="cms_tpv_add_status" value="draft" checked> <?php _e("Draft", "cms-tree-page-view") ?></label>
<label><input type="radio" name="cms_tpv_add_status" value="published"> <?php _e("Published", "cms-tree-page-view") ?></label>
</div>
<div>
- <input type="submit" value="Add" class="button-primary">
+ <input type="submit" value="<?php _e("Add", "cms-tree-page-view") ?>" class="button-primary">
<?php _e("or", "cms-tree-page-view") ?>
<a href="#" class="cms_tpv_add_cancel"><?php _e("cancel", "cms-tree-page-view") ?></a>
</div>
@@ -799,6 +1002,13 @@ function cms_tpv_print_common_tree_stuff($post_type = "") {
</div>
<?php
}
+
+ if (empty($pages)) {
+
+ echo '<div class="updated fade below-h2"><p>' . __("No posts found.", 'cms-tree-page-view') . '</p></div>';
+
+ }
+
?>
</div>
@@ -825,7 +1035,8 @@ function cms_tpv_pages_page() {
<div class="wrap">
<?php echo get_screen_icon(); ?>
<h2><?php
- $page_title = _x(sprintf('%1$s Tree View', $post_type_object->labels->name), "headline of page with tree", "cms-tree-page-view");
+
+ $page_title = sprintf(_x('%1$s Tree View', "headline of page with tree", "cms-tree-page-view"), $post_type_object->labels->name);
echo $page_title;
// Add "add new" link the same way as the regular post page has
@@ -833,56 +1044,9 @@ function cms_tpv_pages_page() {
echo ' <a href="' . esc_url( $post_new_file ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
}
-
-
-
?></h2>
<?php
- /*
- Not so much nagging, since I'm a nice guy.
- <div class="bonny-plugins-inner-sidebar">
- <h3>Support the author</h3>
- <p>
- If you like this plugin you are welcome to support the author by donating:
- </p>
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="text-align: center">
- <input type="hidden" name="cmd" value="_s-xclick">
- <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHXwYJKoZIhvcNAQcEoIIHUDCCB0wCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYArzkksMbzVWCE3kMsAGZ6xe4p6CQcaIaH3w9JF5RS6Z8PIelZw26PHvfrQUVAUCL3IecfDVU0hjDCDfvmQe16lNZSVvy57uwk20ryOTf5IJ7Ujulw1G0T0Fpc7M9Mb0FRWblgnbETeEREzRZiGZBPfI+cn9rghM1Sb3xcYGWFfujELMAkGBSsOAwIaBQAwgdwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIZb6E5mM+R7iAgbgoPH19h/wvJIJR8lPTFEg2qb4bpstEjDo5rgjbdWEBbVp1dtFXdDCf4Nbivm5yvk2Ugf5sDsX1OiOcotl/1E8tW5VesSIkYtVmTgBbr9wkWuZPT8RKrvRVSVgWHxwXV4/eYFwxDsheL04BZYUV6lPSSEBPnEtO4Rn2AfBKo/gYqfb8zdu23FpWKrUMlRQ2ETDFINliKnDNx59aFEbTP85eOQpqetm/fDQKtGebOSpFTJ3TxlM3U54coIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTEwMTE2MjIyNzQyWjAjBgkqhkiG9w0BCQQxFgQUiaTKjuxCgwQjZm+TAmb0/tQbdWIwDQYJKoZIhvcNAQEBBQAEgYAn4V+IMVl19uvdDieOk8Wahvy1QYm+UfdMQn8ZuHOAswJ9vYreuqcradc4EL0kWH/o2/wzPWxoT3S2fqgdrVeKm8hnsXOWcpuFYMMu9fdLCe0wak8jpzTb02gm+LfYnK/dxe5FkgmzR2HN0tAdl+xlSUUApUZ1yZsXgWe9kFKZdg==-----END PKCS7-----">
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
- <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
- </form>
-
- <p style="text-align: center">
- <a href="http://flattr.com/thing/117882/CMS-Tree-Page-View-Plugin-for-WordPress" target="_blank">
- <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a>
- </p>
-
- <p>
- You can also show your appreciation
- by giving the plugin a <a href="http://wordpress.org/extend/plugins/cms-tree-page-view/">good rating over at the plugin directory</a>
- or blog or tweet something nice about this plugin.
- </p>
-
- <h3>Support</h3>
- <p>If you have any problems with this plugins please check out the <a href="http://wordpress.org/tags/cms-tree-page-view?forum_id=10">support forum</a>.</p>
-
- <h3>More CMS related plugins</h3>
- <p>These are some more plugins that enhance the CMS functionality of WordPress. Please check them out!</p>
- <ul>
- <li><a href="http://wordpress.org/extend/plugins/admin-menu-tree-page-view/">Admin Menu Tree Page View</a></li>
- <li><a href="http://wordpress.org/extend/plugins/simple-history/">Simple History</a></li>
- <li><a href="http://wordpress.org/extend/plugins/simple-fields/">Simple Fields</a></li>
- <li><a href="http://wordpress.org/extend/plugins/simple-front-end-edit-buttons/">Simple Front End Edit Buttons</a></li>
- </ul>
-
-
- </div>
- */
- ?>
-
- <?php
- // cms_tpv_show_annoying_box();
cms_tpv_print_common_tree_stuff($post_type);
?>
@@ -941,6 +1105,7 @@ function cms_tpv_get_pages($args = null) {
#do_action_ref_array('parse_query', array(&$this));
#print_r($get_posts_args);
+
$pages = get_posts($get_posts_args);
// filter out pages for wpml, by applying same filter as get_pages does
@@ -972,6 +1137,7 @@ function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $po
global $current_screen;
$screen = convert_to_screen("edit");
$screen->post_type = null;
+ $post_type_object = get_post_type_object($post_type);
ob_start(); // some plugins, for example magic fields, return javascript and things here. we're not compatible with that, so just swallow any output
$posts_columns = get_column_headers($screen);
@@ -1038,18 +1204,32 @@ function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $po
$title = __("<Untitled page>", 'cms-tree-page-view');
}
$title = esc_html($title);
- #$title = html_entity_decode($title, ENT_COMPAT, "UTF-8");
- #$title = html_entity_decode($title, ENT_COMPAT);
- // can edit?
- if ( current_user_can( 'edit_page', $page_id ) ) {
- $user_can_edit_page = true;
- $user_can_edit_page_css = "cms_tpv_user_can_edit_page_yes";
+ $arr_page_css_styles = array();
+ $user_can_edit_page = apply_filters("cms_tree_page_view_post_can_edit", current_user_can( $post_type_object->cap->edit_post, $page_id), $page_id);
+ $user_can_add_inside = apply_filters("cms_tree_page_view_post_user_can_add_inside", current_user_can( $post_type_object->cap->edit_post, $page_id), $page_id);
+ $user_can_add_after = apply_filters("cms_tree_page_view_post_user_can_add_after", current_user_can( $post_type_object->cap->edit_post, $page_id), $page_id);
+
+ if ( $user_can_edit_page ) {
+ $arr_page_css_styles[] = "cms_tpv_user_can_edit_page_yes";
+ } else {
+ $arr_page_css_styles[] = "cms_tpv_user_can_edit_page_no";
+ }
+
+ if ( $user_can_add_inside ) {
+ $arr_page_css_styles[] = "cms_tpv_user_can_add_page_inside_yes";
} else {
- $user_can_edit_page = false;
- $user_can_edit_page_css = "cms_tpv_user_can_edit_page_no";
+ $arr_page_css_styles[] = "cms_tpv_user_can_add_page_inside_no";
}
+ if ( $user_can_add_after ) {
+ $arr_page_css_styles[] = "cms_tpv_user_can_add_page_after_yes";
+ } else {
+ $arr_page_css_styles[] = "cms_tpv_user_can_add_page_after_no";
+ }
+
+ $page_css = join(" ", $arr_page_css_styles);
+
// fetch columns
$str_columns = "";
foreach ( $posts_columns as $column_name => $column_display_name ) {
@@ -1104,7 +1284,7 @@ function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $po
<?php /* "xhref": "<?php echo $editLink ?>", */ ?>
"id": "cms-tpv-<?php echo $onePage->ID ?>",
<?php /* "xtitle": "<?php _e("Click to edit. Drag to move.", 'cms-tree-page-view') ?>", */ ?>
- "class": "<?php echo $user_can_edit_page_css ?>"
+ "class": "<?php echo $page_css ?>"
},
<?php echo $strState ?>
"metadata": {
@@ -1121,6 +1301,8 @@ function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $po
"modified_author": "<?php echo $post_author ?>",
"columns": <?php echo $str_columns ?>,
"user_can_edit_page": "<?php echo (int) $user_can_edit_page ?>",