├── .gitignore
├── LICENSE
├── admin
├── class-settings-page.php
├── class-users-profile.php
└── class-welcome-dashboard.php
├── assets
└── images
│ ├── owned-minifig-widget.png
│ └── theme-years-widget.png
├── banner-1544x500.png
├── banner-772x250.png
├── brickset-api.php
├── inc
├── class-oembed.php
├── class-search-functions.php
├── class-shortcodes.php
├── class-template-tags.php
├── class-update-functions.php
├── class-utilities.php
└── widgets
│ ├── class-minifig-owned-widget.php
│ ├── class-set-widget.php
│ ├── class-theme-widget.php
│ └── class-theme-years-widget.php
├── languages
├── default.mo
└── default.po
├── readme.md
├── readme.txt
├── screenshot-1.png
├── screenshot-2.png
├── screenshot-3.png
└── webservice-definition.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # osx noise
2 | .DS_Store
3 | profile
4 |
5 | # xcode noise
6 | build/*
7 | *.mode1
8 | *.mode1v3
9 | *.mode2v3
10 | *.perspective
11 | *.perspectivev3
12 | *.pbxuser
13 | *.xcworkspace
14 | xcuserdata
15 |
16 | # svn & cvs
17 | .svn
18 | CVS
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/admin/class-settings-page.php:
--------------------------------------------------------------------------------
1 |
46 |
". __( 'If no retail price is available for the currency selected the plugin should', 'bs_api' ).":";
181 | echo "
";
182 | echo " ";
183 | echo "
".__( 'Brickset provides retail prices in US dollars, CA dollars, and UK pound sterling ', 'bs_api' )."";
184 |
185 | }
186 |
187 | /**
188 | * Control if the Bricklink link should be appended to the set display
189 | *
190 | * @author Nate Jacobs
191 | * @date 6/2/13
192 | * @since 1.3
193 | */
194 | public function bricklink_callback()
195 | {
196 | $settings = (array) get_option( 'brickset-api-settings' );
197 | $bricklink = isset( $settings['bricklink_link'] ) ? esc_attr( $settings['bricklink_link'] ) : '';
198 |
199 | echo "";
200 | echo " ";
201 | }
202 |
203 | /**
204 | * Control how long the transient is kept for
205 | *
206 | * @author Nate Jacobs
207 | * @date 6/3/13
208 | * @since 1.3
209 | */
210 | public function transient_callback()
211 | {
212 | $settings = (array) get_option( 'brickset-api-settings' );
213 | $transient = isset( $settings['transient'] ) ? esc_attr( $settings['transient'] ) : '';
214 |
215 | echo "";
216 | echo " ";
217 | echo " ";
218 | echo "
".__( 'The plugin uses the WordPress Transient API to store the data returned from Brickset to reduce page load times. By increasing the time the data is stored it requires fewer requests to Brickset. However, if the data changes frequently then your site will display out-of-date data until the cache expires.', 'bs_api' )."";
219 | }
220 | }
221 |
222 | $brickset_settings = new BricksetAPISettingsPage();
--------------------------------------------------------------------------------
/admin/class-users-profile.php:
--------------------------------------------------------------------------------
1 | get_user_hash( $user->ID );
40 | ?>
41 |
42 |
43 |
88 | get_theme_years($themeName);
129 |
130 | // check for errors
131 | if( is_wp_error( $brickset ) )
132 | {
133 | echo $brickset->get_error_message();
134 | }
135 | else
136 | {
137 | foreach ( $years as $year )
138 | {
139 | $url = "http://brickset.com/browse/years/?year=$year->year&Theme=".urlencode($year->theme);
140 |
141 | echo __( 'Year', 'bs_api' ).': '.$year->year;
142 | echo ' ';
143 | echo __( 'Number of Sets', 'bs_api' ).': '.$year->setCount.'';
144 | echo '';
145 | }
146 |
147 | echo $after_widget;
148 | }
149 | }
150 | }
--------------------------------------------------------------------------------
/languages/default.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NateJacobs/Brickset-API/ae7ecc4053c13c9fb7c8109386767dace08f4055/languages/default.mo
--------------------------------------------------------------------------------
/languages/default.po:
--------------------------------------------------------------------------------
1 | msgid ""
2 | msgstr ""
3 | "Project-Id-Version: bs_api\n"
4 | "POT-Creation-Date: 2013-09-13 22:43-0700\n"
5 | "PO-Revision-Date: 2013-09-13 22:43-0700\n"
6 | "Last-Translator: Nate Jacobs \n"
7 | "Language-Team: \n"
8 | "MIME-Version: 1.0\n"
9 | "Content-Type: text/plain; charset=UTF-8\n"
10 | "Content-Transfer-Encoding: 8bit\n"
11 | "X-Generator: Poedit 1.5.7\n"
12 | "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
13 | "X-Poedit-Basepath: ../\n"
14 | "X-Poedit-SearchPath-0: admin\n"
15 | "X-Poedit-SearchPath-1: inc\n"
16 | "X-Poedit-SearchPath-2: .\n"
17 |
18 | #: admin/class-settings-page.php:28 admin/class-settings-page.php:48
19 | msgid "Brickset API Settings"
20 | msgstr ""
21 |
22 | #: admin/class-settings-page.php:29
23 | msgid "Brickset API"
24 | msgstr ""
25 |
26 | #: admin/class-settings-page.php:70
27 | msgid "API Key"
28 | msgstr ""
29 |
30 | #: admin/class-settings-page.php:77
31 | msgid "Enter your API Key"
32 | msgstr ""
33 |
34 | #: admin/class-settings-page.php:85
35 | msgid "Template Tag Settings"
36 | msgstr ""
37 |
38 | #: admin/class-settings-page.php:92
39 | msgid "Which currency to use?"
40 | msgstr ""
41 |
42 | #: admin/class-settings-page.php:100
43 | msgid "Display link to Bricklink?"
44 | msgstr ""
45 |
46 | #: admin/class-settings-page.php:131
47 | msgid "You may obtain a key at "
48 | msgstr ""
49 |
50 | #: admin/class-settings-page.php:160
51 | msgid ""
52 | "These settings control what is displayed when you use the provided template "
53 | "tags, shortcodes, widgets and oembed."
54 | msgstr ""
55 |
56 | #: admin/class-settings-page.php:177
57 | msgid "US Dollar"
58 | msgstr ""
59 |
60 | #: admin/class-settings-page.php:178
61 | msgid "CA Dollar"
62 | msgstr ""
63 |
64 | #: admin/class-settings-page.php:179
65 | msgid "UK Pound Sterling"
66 | msgstr ""
67 |
68 | #: admin/class-settings-page.php:180
69 | msgid ""
70 | "If no retail price is available for the currency selected the plugin should"
71 | msgstr ""
72 |
73 | #: admin/class-settings-page.php:181
74 | msgid "Display the word Unknown"
75 | msgstr ""
76 |
77 | #: admin/class-settings-page.php:182
78 | msgid "Display the US retail price"
79 | msgstr ""
80 |
81 | #: admin/class-settings-page.php:183
82 | msgid ""
83 | "Brickset provides retail prices in US dollars, CA dollars, and UK pound "
84 | "sterling "
85 | msgstr ""
86 |
87 | #: admin/class-settings-page.php:199
88 | msgid "Yes"
89 | msgstr ""
90 |
91 | #: admin/class-settings-page.php:200
92 | msgid "No"
93 | msgstr ""
94 |
95 | #: admin/class-settings-page.php:215
96 | msgid "One Day"
97 | msgstr ""
98 |
99 | #: admin/class-settings-page.php:216
100 | msgid "One Week"
101 | msgstr ""
102 |
103 | #: admin/class-settings-page.php:217
104 | msgid "One Month"
105 | msgstr ""
106 |
107 | #: admin/class-settings-page.php:218
108 | msgid ""
109 | "The plugin uses the WordPress Transient API to store the data returned from "
110 | "Brickset to reduce page load times. By increasing the time the data is "
111 | "stored it requires fewer requests to Brickset. However, if the data changes "
112 | "frequently then your site will display out-of-date data until the cache "
113 | "expires."
114 | msgstr ""
115 |
116 | #: admin/class-users-profile.php:41
117 | msgid "Brickset Login Information"
118 | msgstr ""
119 |
120 | #: admin/class-users-profile.php:42
121 | msgid ""
122 | "If the Brickset Identifier is filled you do not need to add your username "
123 | "and password unless you have changed your password on Brickset."
124 | msgstr ""
125 |
126 | #: admin/class-users-profile.php:45
127 | msgid "Brickset Username"
128 | msgstr ""
129 |
130 | #: admin/class-users-profile.php:49
131 | msgid "Brickset Password"
132 | msgstr ""
133 |
134 | #: admin/class-users-profile.php:53
135 | msgid "Brickset Identifier"
136 | msgstr ""
137 |
138 | #: admin/class-welcome-dashboard.php:53 admin/class-welcome-dashboard.php:54
139 | #: admin/class-welcome-dashboard.php:61 admin/class-welcome-dashboard.php:62
140 | msgid "Welcome to Brickset API"
141 | msgstr ""
142 |
143 | #: admin/class-welcome-dashboard.php:100 admin/class-welcome-dashboard.php:154
144 | #, php-format
145 | msgid "Welcome to Brickset API %s"
146 | msgstr ""
147 |
148 | #: admin/class-welcome-dashboard.php:101 admin/class-welcome-dashboard.php:155
149 | msgid ""
150 | "Thank you for updating to the latest version! Brickset API helps you display "
151 | "and manage your LEGO® collection right from your WordPress site."
152 | msgstr ""
153 |
154 | #: admin/class-welcome-dashboard.php:105 admin/class-welcome-dashboard.php:159
155 | #, php-format
156 | msgid "What's New in %s"
157 | msgstr ""
158 |
159 | #: admin/class-welcome-dashboard.php:107 admin/class-welcome-dashboard.php:161
160 | msgid "Credits"
161 | msgstr ""
162 |
163 | #: admin/class-welcome-dashboard.php:112
164 | msgid "New Widgets"
165 | msgstr ""
166 |
167 | #: admin/class-welcome-dashboard.php:115
168 | msgid "Count of Owned Minifigs"
169 | msgstr ""
170 |
171 | #: admin/class-welcome-dashboard.php:116
172 | msgid "Show off the total count of all the minifigs you own."
173 | msgstr ""
174 |
175 | #: admin/class-welcome-dashboard.php:118
176 | msgid "Years a Theme was Available"
177 | msgstr ""
178 |
179 | #: admin/class-welcome-dashboard.php:119
180 | msgid ""
181 | "Display how many sets were made each year a theme was available. A link is "
182 | "included to the theme page on Brickset.com"
183 | msgstr ""
184 |
185 | #: admin/class-welcome-dashboard.php:126
186 | msgid "For the Developers"
187 | msgstr ""
188 |
189 | #: admin/class-welcome-dashboard.php:128
190 | msgid "Transient Filters"
191 | msgstr ""
192 |
193 | #: admin/class-welcome-dashboard.php:129
194 | msgid ""
195 | "You can now override the default caching of the Brickset API using "
196 | "add_filter. By default the plugin caches Brickset data for 24 hours to "
197 | "reduce page load times. By increasing the time the data is stored it "
198 | "requires fewer requests to Brickset. However, if the data changes frequently "
199 | "then your site will display out-of-date data until the cache expires."
200 | msgstr ""
201 |
202 | #: admin/class-welcome-dashboard.php:132
203 | msgid "Filter Shortcodes"
204 | msgstr ""
205 |
206 | #: admin/class-welcome-dashboard.php:133
207 | msgid ""
208 | "The plugin now takes advantage of the feature added in WordPress 3.6 to "
209 | "enable filtering of the shortcode attributes. You can learn more by reading"
210 | msgstr ""
211 |
212 | #: admin/class-welcome-dashboard.php:133
213 | msgid "this article"
214 | msgstr ""
215 |
216 | #: admin/class-welcome-dashboard.php:133
217 | msgid "by WordPress lead developer Mark Jaquith."
218 | msgstr ""
219 |
220 | #: admin/class-welcome-dashboard.php:138
221 | msgid "Go to the Brickset API Settings"
222 | msgstr ""
223 |
224 | #: admin/class-welcome-dashboard.php:165
225 | msgid "The Brickset API Plugin is created by the following developers."
226 | msgstr ""
227 |
228 | #: admin/class-welcome-dashboard.php:191
229 | #, php-format
230 | msgid "View %s"
231 | msgstr ""
232 |
233 | #: inc/class-oembed.php:192 inc/class-shortcodes.php:54
234 | #: inc/class-template-tags.php:204 inc/widgets/class-set-widget.php:119
235 | msgid "BrickLink"
236 | msgstr ""
237 |
238 | #: inc/class-oembed.php:207 inc/class-shortcodes.php:70
239 | #: inc/class-template-tags.php:218 inc/widgets/class-set-widget.php:132
240 | msgid " Unknown"
241 | msgstr ""
242 |
243 | #: inc/class-oembed.php:218 inc/class-oembed.php:269
244 | #: inc/class-shortcodes.php:81 inc/class-template-tags.php:159
245 | #: inc/class-template-tags.php:229 inc/widgets/class-set-widget.php:143
246 | msgid "Set Name"
247 | msgstr ""
248 |
249 | #: inc/class-oembed.php:219 inc/class-oembed.php:269
250 | #: inc/class-shortcodes.php:82 inc/class-template-tags.php:159
251 | #: inc/class-template-tags.php:230 inc/widgets/class-set-widget.php:55
252 | #: inc/widgets/class-set-widget.php:59 inc/widgets/class-set-widget.php:144
253 | msgid "Set Number"
254 | msgstr ""
255 |
256 | #: inc/class-oembed.php:220 inc/class-oembed.php:269
257 | #: inc/class-shortcodes.php:83 inc/class-template-tags.php:93
258 | #: inc/class-template-tags.php:231 inc/widgets/class-set-widget.php:145
259 | #: inc/widgets/class-theme-years-widget.php:141
260 | msgid "Year"
261 | msgstr ""
262 |
263 | #: inc/class-oembed.php:221 inc/class-shortcodes.php:84
264 | #: inc/class-template-tags.php:232 inc/widgets/class-set-widget.php:146
265 | msgid "Theme"
266 | msgstr ""
267 |
268 | #: inc/class-oembed.php:222 inc/class-shortcodes.php:85
269 | #: inc/class-template-tags.php:55 inc/class-template-tags.php:233
270 | #: inc/widgets/class-set-widget.php:147
271 | msgid "Subtheme"
272 | msgstr ""
273 |
274 | #: inc/class-oembed.php:223 inc/class-shortcodes.php:86
275 | #: inc/class-template-tags.php:234 inc/widgets/class-set-widget.php:148
276 | #, php-format
277 | msgid "%s Retail Price"
278 | msgstr ""
279 |
280 | #: inc/class-oembed.php:224 inc/class-oembed.php:269
281 | #: inc/class-shortcodes.php:87 inc/class-template-tags.php:235
282 | #: inc/widgets/class-set-widget.php:149
283 | msgid "Pieces"
284 | msgstr ""
285 |
286 | #: inc/class-oembed.php:225 inc/class-shortcodes.php:88
287 | #: inc/class-template-tags.php:236 inc/widgets/class-set-widget.php:150
288 | msgid "Minifigs"
289 | msgstr ""
290 |
291 | #: inc/class-oembed.php:226 inc/class-shortcodes.php:89
292 | #: inc/class-template-tags.php:237 inc/widgets/class-set-widget.php:151
293 | msgid "Set Guide"
294 | msgstr ""
295 |
296 | #: inc/class-oembed.php:269 inc/class-template-tags.php:159
297 | msgid "Image"
298 | msgstr ""
299 |
300 | #: inc/class-search-functions.php:191
301 | msgid "The date is not formatted correctly."
302 | msgstr ""
303 |
304 | #: inc/class-search-functions.php:246
305 | msgid "No set number requested."
306 | msgstr ""
307 |
308 | #: inc/class-search-functions.php:278 inc/class-search-functions.php:305
309 | #: inc/class-utilities.php:240 inc/class-utilities.php:244
310 | msgid "No user specified."
311 | msgstr ""
312 |
313 | #: inc/class-search-functions.php:343
314 | msgid "No theme requested."
315 | msgstr ""
316 |
317 | #: inc/class-search-functions.php:381
318 | msgid "No subtheme requested."
319 | msgstr ""
320 |
321 | #: inc/class-search-functions.php:419
322 | msgid "No year requested."
323 | msgstr ""
324 |
325 | #: inc/class-search-functions.php:447 inc/class-search-functions.php:491
326 | #: inc/class-utilities.php:309
327 | msgid "No set ID requested."
328 | msgstr ""
329 |
330 | #: inc/class-search-functions.php:545
331 | msgid "No search criteria specified."
332 | msgstr ""
333 |
334 | #: inc/class-search-functions.php:574 inc/class-search-functions.php:652
335 | msgid "The query requested is not a valid string."
336 | msgstr ""
337 |
338 | #: inc/class-search-functions.php:640
339 | msgid ""
340 | "You must include at least one of the following: query, owned, or wanted."
341 | msgstr ""
342 |
343 | #: inc/class-template-tags.php:55 inc/class-template-tags.php:93
344 | msgid "Set Count"
345 | msgstr ""
346 |
347 | #: inc/class-template-tags.php:55
348 | msgid "First Year"
349 | msgstr ""
350 |
351 | #: inc/class-template-tags.php:55
352 | msgid "Last Year"
353 | msgstr ""
354 |
355 | #: inc/class-template-tags.php:126
356 | msgid "Popular Searches on Brickset"
357 | msgstr ""
358 |
359 | #: inc/class-update-functions.php:136 inc/class-update-functions.php:227
360 | msgid "No quantity specified."
361 | msgstr ""
362 |
363 | #: inc/class-update-functions.php:140 inc/class-update-functions.php:231
364 | msgid "The quantity is not an integer."
365 | msgstr ""
366 |
367 | #: inc/class-update-functions.php:219 inc/class-update-functions.php:269
368 | msgid "No minifig number specified."
369 | msgstr ""
370 |
371 | #: inc/class-utilities.php:33
372 | msgid "Specify a type of request: get or post"
373 | msgstr ""
374 |
375 | #: inc/class-utilities.php:46
376 | msgid "Don't Panic! Something went wrong and Brickset didn't reply."
377 | msgstr ""
378 |
379 | #: inc/class-utilities.php:50
380 | msgid "Unknown error occurred"
381 | msgstr ""
382 |
383 | #: inc/class-utilities.php:54
384 | msgid "Sorry, no sets were found for that query"
385 | msgstr ""
386 |
387 | #: inc/class-utilities.php:208
388 | msgid "One of the sets requested is not a number."
389 | msgstr ""
390 |
391 | #: inc/class-utilities.php:248
392 | msgid "The user ID passed is not a valid user."
393 | msgstr ""
394 |
395 | #: inc/class-utilities.php:253
396 | msgid "The user ID passed does not have a Brickset API identifier on file."
397 | msgstr ""
398 |
399 | #: inc/class-utilities.php:271
400 | msgid "Owned is not a true or false value."
401 | msgstr ""
402 |
403 | #: inc/class-utilities.php:274
404 | msgid "Wanted is not a true or false value."
405 | msgstr ""
406 |
407 | #: inc/class-utilities.php:291
408 | msgid "The theme or subtheme requested is not a valid string."
409 | msgstr ""
410 |
411 | #: inc/class-utilities.php:313
412 | msgid "The set ID requested is not numeric."
413 | msgstr ""
414 |
415 | #: inc/class-utilities.php:336
416 | msgid "The year requested is not a valid year."
417 | msgstr ""
418 |
419 | #: inc/class-utilities.php:340
420 | msgid "The year is not in the accepted range, 1950 to year +1."
421 | msgstr ""
422 |
423 | #: inc/widgets/class-minifig-owned-widget.php:35
424 | msgid "A count of all the minifigs owned from Brickset for a user."
425 | msgstr ""
426 |
427 | #: inc/widgets/class-minifig-owned-widget.php:36
428 | msgid "Brickset Owned Minifigs"
429 | msgstr ""
430 |
431 | #: inc/widgets/class-minifig-owned-widget.php:50
432 | msgid "Owned Minifigs"
433 | msgstr ""
434 |
435 | #: inc/widgets/class-minifig-owned-widget.php:55
436 | #: inc/widgets/class-theme-widget.php:58
437 | msgid "Title"
438 | msgstr ""
439 |
440 | #: inc/widgets/class-minifig-owned-widget.php:59
441 | msgid "Which user to display minifigs for?"
442 | msgstr ""
443 |
444 | #: inc/widgets/class-set-widget.php:40
445 | msgid ""
446 | "A widget that display the details of a particular set from the Brickset.com "
447 | "database."
448 | msgstr ""
449 |
450 | #: inc/widgets/class-set-widget.php:41
451 | msgid "Brickset Set Details"
452 | msgstr ""
453 |
454 | #: inc/widgets/class-theme-widget.php:38
455 | msgid ""
456 | "A listing of all themes from Brickset sorted alphabetically with links to "
457 | "the theme pages on Brickset.com."
458 | msgstr ""
459 |
460 | #: inc/widgets/class-theme-widget.php:39 inc/widgets/class-theme-widget.php:54
461 | msgid "Brickset Themes"
462 | msgstr ""
463 |
464 | #: inc/widgets/class-theme-years-widget.php:37
465 | msgid ""
466 | "A listing of all years a particular theme was available with links to the "
467 | "year/theme page on Brickset.com."
468 | msgstr ""
469 |
470 | #: inc/widgets/class-theme-years-widget.php:38
471 | msgid "Brickset Theme Years"
472 | msgstr ""
473 |
474 | #: inc/widgets/class-theme-years-widget.php:64
475 | msgid "Theme Name"
476 | msgstr ""
477 |
478 | #: inc/widgets/class-theme-years-widget.php:125
479 | msgid " Years Available"
480 | msgstr ""
481 |
482 | #: inc/widgets/class-theme-years-widget.php:143
483 | msgid "Number of Sets"
484 | msgstr ""
485 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Brickset API #
2 |
3 | **This version is outdated. The Brickset API is now on version 2.0 and this code will no longer work.**
4 |
5 | Version 1.4
6 |
7 | Works with WordPress v3.5+
8 | Works with Brickset API v2
9 |
10 | Display your favorite LEGO® set information on your website using the Brickset API.
11 |
12 | ## Description ##
13 |
14 | This plugin is an implementation of the Brickset Webservice. It includes methods to get LEGO® set and theme data from Brickset as well as pre-formated methods to display set data. The set data requested is cached daily to reduce HTTP requests and page load time. Please visit [Brickset](http://brickset.com/) for more information on the [webservice](http://www.brickset.com/webservices). You can obtain an API key from [Brickset](http://brickset.com/contact/).
15 |
16 | The main development is all happening on [GitHub](https://github.com/NateJacobs/Brickset-API).
17 |
18 | This is not an official Brickset.com plugin. LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this plugin.
19 |
20 | ## Oembed ##
21 | You can paste a Brickset set or theme url into your post or page. Once you publish the post or page information about the set or theme will be displayed. Two example URLs are below.
22 |
23 | * Set URL: http://brickset.com/detail/?Set=79003-1
24 | * Theme URL: http://brickset.com/browse/themes/?theme=The%20Hobbit
25 |
26 | ## Template Tags ##
27 | The plugin has numerous template tags you are able to use in your theme. They are listed below with a short description.
28 |
29 | * `brickset_themes();` outputs a list of all themes.
30 | * `brickset_subthemes( $theme );` outputs a table of all subthemes of the theme specified, the number of sets, and years available.
31 | * `brickset_theme_years( $theme );` outputs a table of all the years the specified theme was available and the number of sets each year.
32 | * `brickset_popular_searches();` outputs a list of the most popular search terms on Brickset.com.
33 | * `brickset_updated_since( $date );` outputs a table of the sets updated since the date specified. The table includes thumbnail, set name and set number.
34 | * `brickset_set_number( $set );` outputs a list of details about the sets specified. More than one set can be requested by separating the set numbers with a comma, e.g. '1380,10240'.
35 |
36 | ## Shortcode ##
37 | The plugin has a shortcode you may use in your posts and pages to display information about a set or sets.
38 |
39 | * `[bs_set number='XXX']` outputs information about a specific set. Thumbnail, set name, set number, pieces, theme, subtheme and year. You can display multiple sets by seperating the set numbers with a comma.
40 |
41 | ## Widgets ##
42 | The plugin has four widgets you can activate in your theme. The first displays a list of all themes on Brickset with a link to browse each theme on Brickset.com and the second to display the details about a specific set. The third allows you to show off the total count of your minifigs. The last widget displays a count of sets produced in each year for a given theme.
43 |
44 | ## Advanced Use ##
45 | This example shows how to get the data about a specific set. You can find the developer docs [here](https://github.com/NateJacobs/Brickset-API/wiki).
46 |
47 | 1. Instantiate the class.
48 | ```
49 | $brickset = new BricksetAPISearch();
50 | ```
51 |
52 | 2. Pass a set number to the get_by_number method.
53 | ```
54 | $set_data = $brickset->get_by_number( '8014' );
55 | ```
56 | 3. Test for an error
57 | ```
58 | if( is_wp_error( $set_data ) {
59 | echo $set_data->get_error_message;
60 | }
61 | ```
62 |
63 | 4. Display the results how you like. This will display the set's theme.
64 | ```
65 | else {
66 | echo $set_data->theme;
67 | }
68 | ```
69 |
70 | ## Road Map ##
71 | 1. Template tags to display sets specific to a user.
72 | 2. Caching of images
73 |
74 | You can follow all the open feature requests and enhancements on [GitHub](https://github.com/NateJacobs/Brickset-API/issues?milestone=&page=1&state=open).
75 |
76 | ## Installation ##
77 |
78 | 1. Upload the entire `brickset-api` folder to the `wp-content/plugins/` directory of your WordPress installation or download from the Plugin Repository
79 | 2. Activate the plugin through the Plugins menu in WordPress
80 | 3. Add your Brickset.com API key to the Brickset settings page which can be found as a submenu under the Settings menu
81 | 3. Either add a Brickset link (url) to a set or theme in a post or page, or add a template tag to a theme file, or for advanced use instantiate the class and create your own display method.
82 |
83 | ## Frequently Asked Questions ##
84 |
85 | ### Can I add sets to my set list on Brickset with this plugin? ###
86 | Yes you can, but it requires writing custom code using the API functions of the plugin.
87 |
88 | ### Does this plugin require an API Key from Brickset ###
89 | To display more than twenty sets from a search query an API key is required. You can obtain one by contacting Brickset on this [page](http://brickset.com/contact/).
90 |
91 | ## Screenshots ##
92 | ###1. Individual Set Display###
93 | 
94 |
95 | ###2. Years theme is available###
96 | 
97 |
98 | ###3. Sets in space theme###
99 | 
100 |
101 |
102 | ## Changelog ##
103 |
104 | ### Version 1.4.0 ###
105 | * New owned minifig widget - display how many minifigs you own
106 | * New theme years widget - display how many sets were produced for a given theme in a given year
107 | * Introduce filters to enable overwriting the default cache time of 24 hours for Brickset data
108 | * Add third parameter to shortcode functions
109 |
110 | ### Version 1.3 ###
111 | * Add a new widget to display set details
112 | * Add current_user_can check to user profile settings
113 | * Administrators can now select which currency (US dollar, CA dollar, UK pound) is displayed when using the built in template tags, shortcode and oembed set data
114 | * Administrators can choose if the Bricklink link is displayed in template tags, shortcode and oembed set data
115 |
116 | ### Version 1.2 ###
117 | * Removed anonymous function from class-widgets.php
118 |
119 | ### Version 1.1 ###
120 | * Add ability to update wanted and owned sets
121 | * Add ability to update the quantity owned of a set
122 | * Add ability to search a user's minifig collections
123 | * Add ability to update wanted and owned minifigs
124 | * Updated class name - BricksetAPIFunctions became BricksetAPISearch
125 |
126 | ### Version 1.0 ###
127 | * Enter your Brickset API from the settings submenu.
128 | * Allow users to authenticate with Brickset from their profile page.
129 | * Refactor code base
130 | * Add localization and translation .po
131 | * Create webservice-definition.json to display details about the availble calls
132 | * Brickset oembed support for set and theme URLs
133 |
134 | ### Version 0.3 ###
135 | * Added get_owned function and shortcode.
136 |
137 | ### Version 0.2 ###
138 | * Get_set and my_wanted shortcodes added.
139 | * BricksetAPIFunctions updated to use wp_remote_get.
140 | * Added template tags for use in themes.
141 |
142 | ### Version 0.1 ###
143 | * Initial plugin.
144 |
145 | License [GPLv2 or later]((http://www.gnu.org/licenses/gpl-2.0.html)
146 |
--------------------------------------------------------------------------------
/readme.txt:
--------------------------------------------------------------------------------
1 | === Brickset API ===
2 |
3 | Contributors: NateJacobs
4 | Tags: brickset, lego, brick
5 | Requires at least: 3.5
6 | Tested up to: 4.1
7 | Stable tag: 1.4.1
8 | License: GPLv2 or later
9 | License URI: http://www.gnu.org/licenses/gpl-2.0.html
10 |
11 | Display your favorite LEGO® set information on your website using the Brickset API.
12 |
13 | == Description ==
14 |
15 | This plugin is an implementation of the Brickset Webservice. It includes methods to get LEGO® set and theme data from Brickset as well as pre-formated methods to display set data. The set data requested is cached daily to reduce HTTP requests and page load time. Please visit [Brickset](http://brickset.com/) for more information on the [webservice](http://www.brickset.com/webservices). You can obtain an API key from [Brickset](http://brickset.com/contact/).
16 |
17 | The main development is all happening on [GitHub](https://github.com/NateJacobs/Brickset-API).
18 |
19 | This is not an official Brickset.com plugin. LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this plugin.
20 |
21 | = Oembed =
22 | You can paste a Brickset set or theme url into your post or page. Once you publish the post or page information about the set or theme will be displayed. Two example URLs are below.
23 |
24 | * Set URL: http://brickset.com/detail/?Set=79003-1
25 | * Theme URL: http://brickset.com/browse/themes/?theme=The%20Hobbit
26 |
27 | = Template Tags =
28 | The plugin has numerous template tags you are able to use in your theme. They are listed below with a short description.
29 |
30 | * `brickset_themes();` outputs a list of all themes.
31 | * `brickset_subthemes( $theme );` outputs a table of all subthemes of the theme specified, the number of sets, and years available.
32 | * `brickset_theme_years( $theme );` outputs a table of all the years the specified theme was available and the number of sets each year.
33 | * `brickset_popular_searches();` outputs a list of the most popular search terms on Brickset.com.
34 | * `brickset_updated_since( $date );` outputs a table of the sets updated since the date specified. The table includes thumbnail, set name and set number.
35 | * `brickset_set_number( $set );` outputs a list of details about the sets specified. More than one set can be requested by separating the set numbers with a comma, e.g. '1380,10240'.
36 |
37 | = Shortcode =
38 | The plugin has a shortcode you may use in your posts and pages to display information about a set or sets.
39 |
40 | * `[bs_set number='XXX']` outputs information about a specific set. Thumbnail, set name, set number, pieces, theme, subtheme and year. You can display multiple sets by seperating the set numbers with a comma.
41 |
42 | = Widgets =
43 | The plugin has four widgets you can activate in your theme. The first displays a list of all themes on Brickset with a link to browse each theme on Brickset.com and the second to display the details about a specific set. The third allows you to show off the total count of your minifigs. The last widget displays a count of sets produced in each year for a given theme.
44 |
45 | = Advanced Use =
46 | This example shows how to get the data about a specific set. You can find the developer docs [here](https://github.com/NateJacobs/Brickset-API/wiki).
47 |
48 | 1. Instantiate the class.
49 | `
50 | $brickset = new BricksetAPISearch();
51 | `
52 |
53 | 2. Pass a set number to the get_by_number method.
54 | `
55 | $set_data = $brickset->get_by_number( '8014' );
56 | `
57 | 3. Test for an error
58 | `
59 | if( is_wp_error( $set_data ) {
60 | echo $set_data->get_error_message;
61 | }
62 | `
63 |
64 | 4. Display the results how you like. This will display the set's theme.
65 | `
66 | else {
67 | echo $set_data->theme;
68 | }
69 | `
70 | == Road Map ==
71 | 1. Template tags to display sets specific to a user.
72 | 2. Caching of images
73 |
74 | You can follow all the open feature requests and enhancements on [GitHub](https://github.com/NateJacobs/Brickset-API/issues?milestone=&page=1&state=open).
75 |
76 | == Installation ==
77 |
78 | 1. Upload the entire `brickset-api` folder to the `wp-content/plugins/` directory of your WordPress installation or download from the Plugin Repository
79 | 2. Activate the plugin through the Plugins menu in WordPress
80 | 3. Add your Brickset.com API key to the Brickset settings page which can be found as a submenu under the Settings menu
81 | 3. Either add a Brickset link (url) to a set or theme in a post or page, or add a template tag to a theme file, or for advanced use instantiate the class and create your own display method.
82 |
83 | == Frequently Asked Questions ==
84 |
85 | = Can I add sets to my set list on Brickset with this plugin? =
86 | Yes you can, but it requires writing custom code using the API functions of the plugin.
87 |
88 | = Does this plugin require an API Key from Brickset =
89 | To display more than twenty sets from a search query an API key is required. You can obtain one by contacting Brickset on this [page](http://brickset.com/contact/).
90 |
91 | == Screenshots ==
92 | 1. Individual Set Display
93 | 2. Years theme is available
94 | 3. Sets in space theme
95 |
96 | == Changelog ==
97 |
98 | = Version 1.4.0 =
99 | * New owned minifig widget - display how many minifigs you own
100 | * New theme years widget - display how many sets were produced for a given theme in a given year
101 | * Introduce filters to enable overwriting the default cache time of 24 hours for Brickset data
102 | * Add third parameter to shortcode functions
103 |
104 | = Version 1.3 =
105 | * Add a new widget to display set details
106 | * Add current_user_can check to user profile settings
107 | * Administrators can now select which currency (US dollar, CA dollar, UK pound) is displayed when using the built in template tags, shortcode and oembed set data
108 | * Administrators can choose if the Bricklink link is displayed in template tags, shortcode and oembed set data
109 |
110 | = Version 1.2 =
111 | * Removed anonymous function from class-widgets.php
112 |
113 | = Version 1.1 =
114 | * Add ability to update wanted and owned sets
115 | * Add ability to update the quantity owned of a set
116 | * Add ability to search a user's minifig collections
117 | * Add ability to update wanted and owned minifigs
118 | * Updated class name - BricksetAPIFunctions became BricksetAPISearch
119 |
120 | = Version 1.0 =
121 | * Enter your Brickset API from the settings submenu.
122 | * Allow users to authenticate with Brickset from their profile page.
123 | * Refactor code base
124 | * Add localization and translation .po
125 | * Create webservice-definition.json to display details about the availble calls
126 | * Brickset oembed support for set and theme URLs
127 |
128 | = Version 0.3 =
129 | * Added get_owned function and shortcode.
130 |
131 | = Version 0.2 =
132 | * Get_set and my_wanted shortcodes added.
133 | * BricksetAPIFunctions updated to use wp_remote_get.
134 | * Added template tags for use in themes.
135 |
136 | = Version 0.1 =
137 | * Initial plugin.
--------------------------------------------------------------------------------
/screenshot-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NateJacobs/Brickset-API/ae7ecc4053c13c9fb7c8109386767dace08f4055/screenshot-1.png
--------------------------------------------------------------------------------
/screenshot-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NateJacobs/Brickset-API/ae7ecc4053c13c9fb7c8109386767dace08f4055/screenshot-2.png
--------------------------------------------------------------------------------
/screenshot-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NateJacobs/Brickset-API/ae7ecc4053c13c9fb7c8109386767dace08f4055/screenshot-3.png
--------------------------------------------------------------------------------
/webservice-definition.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Brickset Web Services",
3 | "apiVersion": "2013-01-27",
4 | "baseUrl": "http://www.brickset.com/webservices/brickset.asmx",
5 | "xmlNamespace": "http://www.brickset.com/webServices/",
6 | "description": "Brickset Web Services allow you to create applications that use the Brickset set database.",
7 | "operations": {
8 | "search": {
9 | "httpMethod": "GET",
10 | "uri": "/search",
11 | "summary": "Search the database.",
12 | "responseClass": "setData",
13 | "parameters": {
14 | "apiKey": {
15 | "location": "query",
16 | "type": "string",
17 | "description": "Without providing a valid key a maximum of 20 results will be returned.",
18 | "required": true,
19 | "default": null
20 | },
21 | "userHash": {
22 | "location": "query",
23 | "type": "string",
24 | "description": "If this is provided, the returned data will contain flags indicating whether the specified user owns and/or wants the set.",
25 | "required": true,
26 | "default": null
27 | },
28 | "query": {
29 | "location": "query",
30 | "type": "string",
31 | "description": "A search string.",
32 | "required": true,
33 | "default": null
34 | },
35 | "theme": {
36 | "location": "query",
37 | "type": "string",
38 | "description": "Valid name of a theme.",
39 | "required": true,
40 | "default": null
41 | },
42 | "subtheme": {
43 | "location": "query",
44 | "type": "string",
45 | "description": "Valid name of a subtheme.",
46 | "required": true,
47 | "default": null
48 | },
49 | "setNumber": {
50 | "location": "query",
51 | "type": "string",
52 | "description": "A set number. It must include a '-#' after the number. e.g. 8683-1",
53 | "required": true,
54 | "default": ""
55 | },
56 | "year": {
57 | "location": "query",
58 | "type": "string",
59 | "description": "Release year of a set(s).",
60 | "required": true,
61 | "default": null
62 | },
63 | "Owned": {
64 | "location": "query",
65 | "type": "string",
66 | "description": "Pass a '1' to get a list of set(s) the specified user owns.",
67 | "required": true,
68 | "default": null
69 | },
70 | "Wanted": {
71 | "location": "query",
72 | "type": "string",
73 | "description": "Pass a '1' to get a list of set(s) the specified user wants.",
74 | "required": true,
75 | "default": null
76 | }
77 | }
78 | },
79 | "searchBySetID": {
80 | "httpMethod": "GET",
81 | "uri": "/searchBySetID",
82 | "summary": "Search the database for a specific set using the Brickset interal set ID.",
83 | "responseClass": "setData",
84 | "parameters": {
85 | "SetID": {
86 | "location": "query",
87 | "type": "string",
88 | "description": "The internal Brickset setID",
89 | "required": true
90 | }
91 | }
92 | },
93 | "updatedSince": {
94 | "httpMethod": "GET",
95 | "uri": "/updatedSince",
96 | "summary": "Lists all set records changed since the date you specify (in mm/dd/yy format). This is useful if you are planning on caching the database for offline use. The data set returned will contain user ownership fields, but they will not be populated (since userHash is not passed as a parameter).",
97 | "responseClass": "setData",
98 | "parameters": {
99 | "apiKey": {
100 | "location": "query",
101 | "type": "string",
102 | "description": "Without providing a valid key a maximum of 20 results will be returned.",
103 | "required": true,
104 | "default": null
105 | },
106 | "sinceDate": {
107 | "location": "query",
108 | "type": "string",
109 | "description": "A date in the format of mm/dd/yy."
110 | }
111 | }
112 | },
113 | "login": {
114 | "httpMethod": "GET",
115 | "uri": "/login",
116 | "summary": "Provides a means of authenticating a user by username and password. If the credentials match a valid user a userHash is returned.",
117 | "responseClass": "loginResponse",
118 | "parameters": {
119 | "u": {
120 | "location": "query",
121 | "type": "string",
122 | "description": "Username",
123 | "required": true
124 | },
125 | "p": {
126 | "location": "query",
127 | "type": "string",
128 | "description": "Password",
129 | "required": true
130 | }
131 | }
132 | },
133 | "updateOwn": {
134 | "httpMethod": "POST",
135 | "uri": "/updateOwn",
136 | "summary": "Add or delete a set from a users collection.",
137 | "responseClass": "updateOwnResponse",
138 | "parameters": {
139 | "userHash": {
140 | "location": "body",
141 | "type": "string",
142 | "description": "The userHash of the user that wants to add or delete a set.",
143 | "required": true
144 | },
145 | "setID": {
146 | "location": "body",
147 | "type": "int",
148 | "description": "Brickset internal setID. ",
149 | "required": true
150 | },
151 | "own": {
152 | "location": "body",
153 | "type": "int",
154 | "description": "Pass a 1 to add the set or a 0 to remove the set.",
155 | "required": true
156 | }
157 | }
158 | },
159 | "updateWant": {
160 | "httpMethod": "POST",
161 | "uri": "/updateWant",
162 | "summary": "Add or delete a set from the users wanted list.",
163 | "responseClass": "updateWantResponse",
164 | "parameters": {
165 | "userHash": {
166 | "location": "body",
167 | "type": "string",
168 | "description": "The userHash of the user that wants to add or remove a wanted set.",
169 | "required": true
170 | },
171 | "setID": {
172 | "location": "body",
173 | "type": "int",
174 | "description": "Brickset internal setID",
175 | "required": true
176 | },
177 | "want": {
178 | "location": "body",
179 | "type": "int",
180 | "description": "Pass a 1 to add the set or a 0 to remove the set.",
181 | "required": true
182 | }
183 | }
184 | },
185 | "updateUserNotes": {
186 | "httpMethod": "POST",
187 | "uri": "/updateUserNotes",
188 | "summary": "Add text which will replace the user's notes for the specified set.",
189 | "responseClass": "updateUserNotesResponse",
190 | "parameters": {
191 | "userHash": {
192 | "location": "body",
193 | "type": "string",
194 | "description": "The userHash of the user that wants to add or replace a note on a set.",
195 | "required": true
196 | },
197 | "setID": {
198 | "location": "body",
199 | "type": "int",
200 | "description": "Brickset internal setID",
201 | "required": true
202 | },
203 | "notes": {
204 | "location": "body",
205 | "type": "string",
206 | "description": "String which will replace the user's notes for the set.",
207 | "required": true
208 | }
209 | }
210 | },
211 | "updateQtyOwned": {
212 | "httpMethod": "POST",
213 | "uri": "/updateQtyOwned",
214 | "summary": "Updates the quantity of a set the user owns.",
215 | "responseClass": "updateQtyOwnedResponse",
216 | "parameters": {
217 | "userHash": {
218 | "location": "body",
219 | "type": "string",
220 | "description": "The userHash of the user that wants to update the quantity owned of a set.",
221 | "required": true
222 | },
223 | "setID": {
224 | "location": "body",
225 | "type": "int",
226 | "description": "Brickset internal setID. ",
227 | "required": true
228 | },
229 | "qty": {
230 | "location": "body",
231 | "type": "int",
232 | "description": "An integer to specify how many of the set the user owns.",
233 | "required": true
234 | }
235 | }
236 | },
237 | "listThemes": {
238 | "httpMethod": "GET",
239 | "uri": "/listThemes",
240 | "summary": "Return a list of themes and the number of sets in each.",
241 | "responseClass": "themeData"
242 | },
243 | "listSubthemes": {
244 | "httpMethod": "GET",
245 | "uri": "/listSubthemes",
246 | "summary": "Return a list of subthemes for a given theme and the number of sets in each.",
247 | "responseClass": "subThemedata",
248 | "parameters": {
249 | "theme": {
250 | "location": "query",
251 | "type": "string",
252 | "description": "Theme name",
253 | "required": true
254 | }
255 | }
256 | },
257 | "listYears": {
258 | "httpMethod": "GET",
259 | "uri": "/listYears",
260 | "summary": "Return a list of years a given theme was available in and the number of sets released that year.",
261 | "responseClass": "yearData",
262 | "parameters": {
263 | "theme": {
264 | "location": "query",
265 | "type": "string",
266 | "description": "Theme name.",
267 | "required": true
268 | }
269 | }
270 | },
271 | "popularSearches": {
272 | "httpMethod": "GET",
273 | "uri": "/popularSearches",
274 | "summary": "Return a list of the most searched for terms as shown on the Brickset homepage.",
275 | "responseClass": "setData"
276 | },
277 | "searchMinifigCollection": {
278 | "httpMethod": "GET",
279 | "uri": "/searchMinifigCollection",
280 | "summary": "Return a list of all minifigs owned or wanted by a user that optionally match a query. Leave owned and wanted blank to retrieve those owned and wanted, or set one of them to '1' to get just owned or just wanted. query can be a complete minifig number (e.g. 'hp001'), or just a prefix (e.g. 'hp'). Leave blank to retrieve all.",
281 | "responseClass": "minifigCollectionData",
282 | "parameters": {
283 | "userHash": {
284 | "location": "query",
285 | "type": "string",
286 | "description": "The userHash of the user whose minifig collection is to be searched.",
287 | "required": true
288 | },
289 | "query": {
290 | "location": "query",
291 | "type": "string",
292 | "description": "A complete minifig number or a prefix, e.g. 'hp001' or just a prefix 'hp'.",
293 | "required": true,
294 | "default": null
295 | },
296 | "owned": {
297 | "location": "query",
298 | "type": "string",
299 | "description": "Enter a 1 to retrieve all minifigs owned by the user that are returned from the query. Leave blank if want both owned and wanted.",
300 | "required": true,
301 | "default": null
302 | },
303 | "wanted": {
304 | "location": "query",
305 | "type": "string",
306 | "description": "Enter a 1 to retrieve all minifigs wanted by the user that are returned from the query. Leave blank if want both owned and wanted.",
307 | "required": true,
308 | "default": null
309 | }
310 | }
311 | },
312 | "updateMinifigQtyOwned": {
313 | "httpMethod": "POST",
314 | "uri": "/updateMinifigQtyOwned",
315 | "summary": "Update the quantity of loose minifigs a user has.",
316 | "responseClass": "updateMinifigQtyOwnedResponse",
317 | "parameters": {
318 | "userHash": {
319 | "location": "body",
320 | "type": "string",
321 | "description": "The userHash of the user to update the loose minifig count for.",
322 | "required": true
323 | },
324 | "minifigNumber": {
325 | "location": "body",
326 | "type": "string",
327 | "description": "The Brickset internal minifig number.",
328 | "required": true
329 | },
330 | "qty": {
331 | "location": "body",
332 | "type": "int",
333 | "description": "An integer specifiying how many loose minifigs of this type the user owns.",
334 | "required": true
335 | }
336 | }
337 | },
338 | "updateMinifigWanted": {
339 | "httpMethod": "POST",
340 | "uri": "/updateMinifigWanted",
341 | "summary": "Set the wanted status of a minifig for a user. Currently users can't simultaneously own and want the same minifig. Setting a minifig as wanted will clear the quantity owned.",
342 | "responseClass": "updateMinifigWantedResponse",
343 | "parameters": {
344 | "userHash": {
345 | "location": "body",
346 | "type": "string",
347 | "description": "The userHash of the user to update the wanted status.",
348 | "required": true
349 | },
350 | "minifigNumber": {
351 | "location": "body",
352 | "type": "string",
353 | "description": "The Brickset internal minifig number.",
354 | "required": true
355 | },
356 | "want": {
357 | "location": "body",
358 | "type": "int",
359 | "description": "Pass the integer 1 to add a minifig to a users wanted list.",
360 | "required": true
361 | }
362 | }
363 | },
364 | "listInstructions": {
365 | "httpMethod": "GET",
366 | "uri": "/listInstructions",
367 | "summary": "Returns the URL of the instructions available at LEGO Customer Services.",
368 | "responseClass": "instructionsData",
369 | "parameters": {
370 | "setID": {
371 | "location": "query",
372 | "type": "int",
373 | "description": "Brickset setID.",
374 | "required": true
375 | }
376 | }
377 | }
378 | },
379 | "models": {
380 | "setData": {
381 | "type": "object",
382 | "properties": {
383 | "setID": {
384 | "location": "xml",
385 | "type": "int",
386 | "description": "Brickset internal set ID."
387 | },
388 | "number": {
389 | "location": "xml",
390 | "type": "string",
391 | "description": "Set number."
392 | },
393 | "numberVariant": {
394 | "location": "xml",
395 | "type": "int",
396 | "description": "Set number variant."
397 | },
398 | "setName": {
399 | "location": "xml",
400 | "type": "string",
401 | "description": "Set name."
402 | },
403 | "year": {
404 | "location": "xml",
405 | "type": "string",
406 | "description": "Release year."
407 | },
408 | "theme": {
409 | "location": "xml",
410 | "type": "string",
411 | "description": "Set theme."
412 | },
413 | "subtheme": {
414 | "location": "xml",
415 | "type": "string",
416 | "description": "Set subtheme."
417 | },
418 | "pieces": {
419 | "location": "xml",
420 | "type": "string",
421 | "description": "Number of pieces in the set."
422 | },
423 | "minifigs": {
424 | "location": "xml",
425 | "type": "string",
426 | "description": "Number of minifigs in the set."
427 | },
428 | "image": {
429 | "location": "xml",
430 | "type": "boolean",
431 | "description": "Is an there an image?"
432 | },
433 | "imageFilename": {
434 | "location": "xml",
435 | "type": "string",
436 | "description": "Filename of image."
437 | },
438 | "thumbnailURL": {
439 | "location": "xml",
440 | "type": "string",
441 | "description": "URL of the thumbnail image."
442 | },
443 | "imageURL": {
444 | "location": "xml",
445 | "type": "string",
446 | "description": "URL of the image."
447 | },
448 | "bricksetURL": {
449 | "location": "xml",
450 | "type": "string",
451 | "description": "URL of the set on Brickset"
452 | },
453 | "own": {
454 | "location": "xml",
455 | "type": "boolean",
456 | "description": "Is the set owned by the user specified in userHash?"
457 | },
458 | "want": {
459 | "location": "xml",
460 | "type": "boolean",
461 | "description": "Is the set wanted by the user specified in userHash?"
462 | },
463 | "qtyOwned": {
464 | "location": "xml",
465 | "type": "int",
466 | "description": "Quantity of this set owned by the user specified in userHash."
467 | },
468 | "userNotes": {
469 | "location": "xml",
470 | "type": "string",
471 | "description": "Notes about the set entered by the user specified in userHash."
472 | },
473 | "UKRetailPrice": {
474 | "location": "xml",
475 | "type": "string",
476 | "description": "Retail price in the United Kingdom."
477 | },
478 | "USRetailPrice": {
479 | "location": "xml",
480 | "type": "string",
481 | "description": "Retail price in the United States."
482 | },
483 | "CARetailPrice": {
484 | "location": "xml",
485 | "type": "string",
486 | "description": "Retail price in Canada."
487 | },
488 | "instructionsAvailable": {
489 | "location": "xml",
490 | "type": "boolean",
491 | "description": "Are instructions available?"
492 | },
493 | "EAN": {
494 | "location": "xml",
495 | "type": "string",
496 | "description": "International Article Number."
497 | },
498 | "UPC": {
499 | "location": "xml",
500 | "type": "string",
501 | "description": "Universal Product Code."
502 | },
503 | "lastUpdated": {
504 | "location": "xml",
505 | "type": "string",
506 | "description": "Last updated, dateTime string."
507 | }
508 | }
509 | },
510 | "themeData": {
511 | "type": "object",
512 | "properties": {
513 | "theme": {
514 | "location": "xml",
515 | "type": "string",
516 | "description": "Theme name."
517 | },
518 | "setCount": {
519 | "location": "xml",
520 | "type": "int",
521 | "description": "Number of sets in theme."
522 | }
523 | }
524 | },
525 | "subthemeData": {
526 | "type": "object",
527 | "properties": {
528 | "theme": {
529 | "location": "xml",
530 | "type": "string",
531 | "description": "Parent theme."
532 | },
533 | "subtheme": {
534 | "location": "xml",
535 | "type": "string",
536 | "description": "Subtheme name."
537 | },
538 | "setCount": {
539 | "location": "xml",
540 | "type": "int",
541 | "description": "Number of sets in subtheme."
542 | },
543 | "yearFrom": {
544 | "location": "xml",
545 | "type": "int",
546 | "description": "First year the subtheme was released."
547 | },
548 | "yearTo": {
549 | "location": "xml",
550 | "type": "int",
551 | "description": "Last year the subtheme was released."
552 | }
553 | }
554 | },
555 | "yearData": {
556 | "type": "object",
557 | "properties": {
558 | "theme": {
559 | "location": "xml",
560 | "type": "string",
561 | "description": "Theme name."
562 | },
563 | "year": {
564 | "location": "xml",
565 | "type": "string",
566 | "description": "Release year."
567 | },
568 | "setCount": {
569 | "location": "xml",
570 | "type": "int",
571 | "description": "Number of sets released that year."
572 | }
573 | }
574 | },
575 | "searchData": {
576 | "type": "object",
577 | "properties": {
578 | "searchTerm": {
579 | "location": "xml",
580 | "type": "string",
581 | "description": "The search query."
582 | },
583 | "count": {
584 | "location": "xml",
585 | "type": "int",
586 | "description": "Relative weightings of the search query."
587 | }
588 | }
589 | },
590 | "minifigCollectionData": {
591 | "type": "object",
592 | "properties": {
593 | "minifigNumber": {
594 | "location": "xml",
595 | "type": "string",
596 | "description": "Brickset minifigID"
597 | },
598 | "ownedInSets": {
599 | "location": "xml",
600 | "type": "int",
601 | "description": "Quantity of this minifig owned by the specified user as part of a set."
602 | },
603 | "ownedLoose": {
604 | "location": "xml",
605 | "type": "int",
606 | "description": "Quantity of this minifig owned by the specified user not part of a set."
607 | },
608 | "ownedTotal": {
609 | "location": "xml",
610 | "type": "int",
611 | "description": "Total quantity of this minifig owned by the specified user."
612 | },
613 | "wanted": {
614 | "location": "xml",
615 | "type": "boolean",
616 | "description": "Is this minifig wanted by the specified user?"
617 | }
618 | }
619 | },
620 | "instructionsData": {
621 | "type": "object",
622 | "properties": {
623 | "URL": {
624 | "location": "xml",
625 | "type": "string",
626 | "description": "URL of the pdf of the instructions."
627 | },
628 | "description": {
629 | "location": "xml",
630 | "type": "string",
631 | "description": "Description returned with the instructions."
632 | }
633 | }
634 | },
635 | "loginResponse": {
636 | "location": "xml",
637 | "type": "string",
638 | "description": "If valid user credentials are passed the response will be the userHash. If the response string is empty the credentials were invalid or no user was found."
639 | },
640 | "updateOwnResponse": {
641 | "location": "xml",
642 | "type": "int",
643 | "description": "If the update is successful a 1 is returned."
644 | },
645 | "updateWantResponse": {
646 | "location": "xml",
647 | "type": "int",
648 | "description": "If the update is successful a 1 is returned."
649 | },
650 | "updateUserNotesResponse": {
651 | "location": "xml",
652 | "type": "int",
653 | "description": "If the update is successful a 1 is returned."
654 | },
655 | "updateQtyOwnedResponse": {
656 | "location": "xml",
657 | "type": "int",
658 | "description": "If the update is successful a 1 is returned."
659 | },
660 | "updateMinifigQtyOwnedResponse": {
661 | "location": "xml",
662 | "type": "int",
663 | "description": "If the update is successful a 1 is returned."
664 | },
665 | "updateMinifigWantedResponse": {
666 | "location": "xml",
667 | "type": "int",
668 | "description": "If the update is successful a 1 is returned."
669 | }
670 | }
671 | }
--------------------------------------------------------------------------------