NOT STABLE, NOT EVEN WORKING

This commit is contained in:
Peter Molnar 2016-01-10 20:29:41 +00:00
commit c1479fd5c1
422 changed files with 11556 additions and 0 deletions

675
LICENSE Normal file
View file

@ -0,0 +1,675 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

16
composer.json Normal file
View file

@ -0,0 +1,16 @@
{
"name": "petermolnar/wp-webmention-again",
"description": "",
"require": {
"php": ">=5.3.0",
"mf2/mf2": "0.2.*"
},
"license": "GPLv3",
"authors": [
{
"name": "Peter Molnar",
"email": "hello@petermolnar.eu",
"homepage": "https://petermolnar.eu"
}
]
}

74
composer.lock generated Normal file
View file

@ -0,0 +1,74 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "0eb0473bfbeea8c0729e77c3e7687bb8",
"content-hash": "46f4a82eac34d91e4caceddae7feba9e",
"packages": [
{
"name": "mf2/mf2",
"version": "v0.2.12",
"source": {
"type": "git",
"url": "https://github.com/indieweb/php-mf2.git",
"reference": "6701504876d6c9242eb310b35f41d40d9785ab4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/indieweb/php-mf2/zipball/6701504876d6c9242eb310b35f41d40d9785ab4e",
"reference": "6701504876d6c9242eb310b35f41d40d9785ab4e",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"suggest": {
"barnabywalters/mf-cleaner": "To more easily handle the canonical data php-mf2 gives you"
},
"bin": [
"bin/fetch-mf2",
"bin/parse-mf2"
],
"type": "library",
"autoload": {
"files": [
"Mf2/Parser.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barnaby Walters",
"homepage": "http://waterpigs.co.uk"
}
],
"description": "A pure, generic microformats2 parser — makes HTML as easy to consume as a JSON API",
"keywords": [
"html",
"microformats",
"microformats 2",
"parser",
"semantic"
],
"time": "2015-07-12 14:10:01"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.0"
},
"platform-dev": []
}

31
readme.txt Normal file
View file

@ -0,0 +1,31 @@
=== wp-webmention-again ===
Contributors: cadeyrn
Donate link: https://paypal.me/petermolnar/3
Tags: webmention, pingback, indieweb
Requires at least: 3.0
Tested up to: 4.4.1
Stable tag: 0.1
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Required minimum PHP version: 5.3
Alternative Webmentions plugin
== Description ==
== Installation ==
== Frequently Asked Questions ==
== Changelog ==
Version numbering logic:
* every A. indicates BIG changes.
* every .B version indicates new features.
* every ..C indicates bugfixes for A.B version.
= 0.1 =
*2016*
* initial public release

7
vendor/autoload.php vendored Normal file
View file

@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit577d2c76a8c0ae29d709c110dd8ca221::getLoader();

1
vendor/bin/fetch-mf2 vendored Symbolic link
View file

@ -0,0 +1 @@
../mf2/mf2/bin/fetch-mf2

1
vendor/bin/parse-mf2 vendored Symbolic link
View file

@ -0,0 +1 @@
../mf2/mf2/bin/parse-mf2

413
vendor/composer/ClassLoader.php vendored Normal file
View file

@ -0,0 +1,413 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-0 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative) {
return false;
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if ($file === null && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if ($file === null) {
// Remember that this class does not exist.
return $this->classMap[$class] = false;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
if (0 === strpos($class, $prefix)) {
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

21
vendor/composer/LICENSE vendored Normal file
View file

@ -0,0 +1,21 @@
Copyright (c) 2015 Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

9
vendor/composer/autoload_classmap.php vendored Normal file
View file

@ -0,0 +1,9 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

10
vendor/composer/autoload_files.php vendored Normal file
View file

@ -0,0 +1,10 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'757772e28a0943a9afe83def8db95bdf' => $vendorDir . '/mf2/mf2/Mf2/Parser.php',
);

View file

@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

9
vendor/composer/autoload_psr4.php vendored Normal file
View file

@ -0,0 +1,9 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

59
vendor/composer/autoload_real.php vendored Normal file
View file

@ -0,0 +1,59 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit577d2c76a8c0ae29d709c110dd8ca221
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit577d2c76a8c0ae29d709c110dd8ca221', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit577d2c76a8c0ae29d709c110dd8ca221', 'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire577d2c76a8c0ae29d709c110dd8ca221($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire577d2c76a8c0ae29d709c110dd8ca221($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

57
vendor/composer/installed.json vendored Normal file
View file

@ -0,0 +1,57 @@
[
{
"name": "mf2/mf2",
"version": "v0.2.12",
"version_normalized": "0.2.12.0",
"source": {
"type": "git",
"url": "https://github.com/indieweb/php-mf2.git",
"reference": "6701504876d6c9242eb310b35f41d40d9785ab4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/indieweb/php-mf2/zipball/6701504876d6c9242eb310b35f41d40d9785ab4e",
"reference": "6701504876d6c9242eb310b35f41d40d9785ab4e",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"suggest": {
"barnabywalters/mf-cleaner": "To more easily handle the canonical data php-mf2 gives you"
},
"time": "2015-07-12 14:10:01",
"bin": [
"bin/fetch-mf2",
"bin/parse-mf2"
],
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"Mf2/Parser.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barnaby Walters",
"homepage": "http://waterpigs.co.uk"
}
],
"description": "A pure, generic microformats2 parser — makes HTML as easy to consume as a JSON API",
"keywords": [
"html",
"microformats",
"microformats 2",
"parser",
"semantic"
]
}
]

7
vendor/mf2/mf2/.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
.DS_Store
/nbproject
composer.phar
/vendor/
/tmp
.idea/
/bin/test

1441
vendor/mf2/mf2/Mf2/Parser.php vendored Normal file

File diff suppressed because it is too large Load diff

401
vendor/mf2/mf2/README.md vendored Normal file
View file

@ -0,0 +1,401 @@
php-mf2
=======
php-mf2 is a pure, generic [microformats-2](http://microformats.org/wiki/microformats-2) parser. It makes HTML as easy to consume as JSON.
Instead of having a hard-coded list of all the different microformats, it follows a set of procedures to handle different property types (e.g. `p-` for plaintext, `u-` for URL, etc). This allows for a very small and maintainable parser.
## Installation
There are two ways of installing php-mf2. I **highly recommend** installing php-mf2 using [Composer](http://getcomposer.org). The rest of the documentation assumes that you have done so.
To install using Composer, run `./composer.phar require mf2/mf2:~0.2`
If you cant or dont want to use Composer, then php-mf2 can be installed the old way by downloading [`/Mf2/Parser.php`](https://raw.githubusercontent.com/indieweb/php-mf2/master/Mf2/Parser.php), adding it to your project and requiring it from files you want to call its functions from, like this:
```php
<?php
require_once 'Mf2/Parser.php';
// Now all the functions documented below are available, for example:
$mf = Mf2\fetch('https://waterpigs.co.uk');
```
### Signed Code Verification
From v0.2.9, php-mf2s version tags are signed using GPG by barnaby@waterpigs.co.uk. This allows you to cryptographically verify that youre using the right code. To do so you will need my key — you dont have it, get it like this:
```bash
gpg --recv-keys 7D49834B0416CFA3
```
Then verify the installed files like this:
```bash
# in your project root
cd vendor/mf2/mf2
git tag -v v0.2.9
```
If nothing went wrong, you should see the tag commit message, ending something like this:
```
gpg: Signature made Wed 6 Aug 10:04:20 2014 GMT using RSA key ID 2B2BBB65
gpg: Good signature from "Barnaby Walters <barnaby@waterpigs.co.uk>"
gpg: aka "[jpeg image of size 12805]"
```
Possible issues:
* **Git complains that theres no such tag**: check for a .git file in the source folder; odds are you have the prefer-dist setting enabled and composer is just extracting a zip rather than checking out from git.
* **Git complains the gpg command doesnt exist**: If you successfully imported my key then you obviously do have gpg installed, but you might have gpg2, whereas git looks for gpg. Solution: tell git which binary to use: `git config --global gpg.program 'gpg2'`
## Usage
php-mf2 is PSR-0 autoloadable, so simply include Composers auto-generated autoload file (`/vendor/autoload.php`) and you can start using it. These two functions cover most situations:
* To fetch microformats from a URL, call `Mf2\fetch($url)`
* To parse microformats from HTML, call `Mf2\parse($html, $url)`, where `$url` is the URL from which `$html` was loaded, if any. This parameter is required for correct relative URL parsing and must not be left out unless parsing HTML which is not loaded from the web.
## Examples
### Fetching microformats from a page
```php
<?php
namespace YourApp;
require '/vendor/autoload.php';
use Mf2;
// (Above code (or equivalent) assumed in future examples)
$mf = Mf2\fetch('http://microformats.org');
foreach ($mf['items'] as $microformat) {
echo "A {$microformat['type'][0]} called {$microformat['properties']['name'][0]}\n";
}
```
### Parsing microformats from a HTML string
Here we demonstrate parsing of microformats2 implied property parsing, where an entire h-card with name and URL properties is created using a single `h-card` class.
```php
<?php
$output = Mf2\parse('<a class="h-card" href="https://waterpigs.co.uk/">Barnaby Walters</a>');
```
`$output` is a canonical microformats2 array structure like:
```json
{
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Barnaby Walters"],
"url": ["https://waterpigs.co.uk/"]
}
}],
"rels": {}
}
```
If no microformats are found, `items` will be an empty array.
Note that, whilst the property prefixes are stripped, the prefix of the `h-*` classname(s) in the "type" array are retained.
### Parsing a document with relative URLs
Most of the time youll be getting your input HTML from a URL. You should pass that URL as the second parameter to `Mf2\parse()` so that any relative URLs in the document can be resolved. For example, say you got the following HTML from `http://example.org`:
```html
<div class="h-card">
<h1 class="p-name">Mr. Example</h1>
<img class="u-photo" alt="" src="photo.png" />
</div>
```
Parsing like this:
```php
$output = Mf2\parse($html, 'http://example.org');
```
will result in the following output, with relative URLs made absolute:
```json
{
"items": [{
"type": ["h-card"],
"properties": {
"photo": ["http://example.org/photo.png"]
}
}],
"rels": {}
}
```
php-mf2 correctly handles relative URL resolution according to the URI and HTML specs, including correct use of the `<base>` element.
### Parsing `rel` and `rel=alternate` values
php-mf2 also parses any link relations in the document, placing them into two top-level arrays — one for `rel=alternate` and another for all other rel values, e.g. when parsing:
```html
<a rel="me" href="https://twitter.com/barnabywalters">Me on twitter</a>
<link rel="alternate etc" href="http://example.com/notes.atom" />
```
parsing will result in the following keys:
```json
{
"items": [],
"rels": {
"me": ["https://twitter.com/barnabywalters"]
},
"alternates": [{
"url": "http://example.com/notes.atom",
"rel": "etc"
}]
}
```
Protip: if youre not bothered about the microformats2 data and just want rels and alternates, you can improve performance by creating a `Mf2\Parser` object (see below) and calling `->parseRelsAndAlternates()` instead of `->parse()`, e.g.
```php
<?php
$parser = new Mf2\Parser('<link rel="…');
$relsAndAlternates = $parser->parseRelsAndAlternates();
```
### Debugging Mf2\fetch
`Mf2\fetch()` will attempt to parse any response served with “HTML” in the content-type, regardless of what the status code is. If it receives a non-HTML response it will return null.
To learn what the HTTP status code for any request was, or learn more about the request, pass a variable name as the third parameter to `Mf2\fetch()` — this will be filled with the contents of `curl_getinfo()`, e.g:
```php
<?php
$mf = Mf2\fetch('http://waterpigs.co.uk/this-page-doesnt-exist', true, $curlInfo);
if ($curlInfo['http_code'] == '404') {
// This page doesnt exist.
}
```
If it was HTML then it is still parsed, as there are cases where error pages contain microformats — for example a deleted h-entry resulting in a 410 Gone response containing a stub h-entry with amn explanation for the deletion.
### Getting more control by creating a Parser object
The `Mf2\parse()` function covers the most common usage patterns by internally creating an instance of `Mf2\Parser` and returning the output all in one step. For some advanced usage you can also create an instance of `Mf2\Parser` yourself.
The constructor takes two arguments, the input HTML (or a DOMDocument) and the URL to use as a base URL. Once you have a parser, there are a few other things you can do:
### Selectively parsing a document
There are several ways to selectively parse microformats from a document. If you wish to only parse microformats from an element with a particular ID, `Parser::parseFromId($id) ` is the easiest way.
If your needs are more complex, `Parser::parse` accepts an optional context DOMNode as its second parameter. Typically youd use `Parser::query` to run XPath queries on the document to get the element you want to parse from under, then pass it to `Parser::parse`. Example usage:
```php
$doc = 'More microformats, more microformats <div id="parse-from-here"><span class="h-card">This shows up</span></div> yet more ignored content';
$parser = new Mf2\Parser($doc);
$parser->parseFromId('parse-from-here'); // returns a document with only the h-card descended from div#parse-from-here
$elementIWant = $parser->query('an xpath query')[0];
$parser->parse(true, $elementIWant); // returns a document with only mfs under the selected element
```
### Generating output for JSON serialization with JSON-mode
Due to a quirk with the way PHP arrays work, there is an edge case ([reported](https://github.com/indieweb/php-mf2/issues/29) by Tom Morris) in which a document with no rel values, when serialised as JSON, results in an empty object as the rels value rather than an empty array. Replacing this in code with a stdClass breaks PHP iteration over the values.
As of version 0.2.6, the default behaviour is back to being PHP-friendly, so if you want to produce results specifically for serialisation as JSON (for example if you run a HTML -> JSON service, or want to run tests against JSON fixtures), enable JSON mode:
```php
// …by passing true as the third constructor:
$jsonParser = new Mf2\Parser($html, $url, true);
```
### Classic Microformats Markup
php-mf2 has some support for parsing classic microformats markup. Its enabled by default, but can be turned off by calling `Mf2\parse($html, $url, false);` or `$parser->parse(false);` if youre instanciating a parser yourself.
In previous versions of php-mf2 you could also add your own class mappings — officially this is no longer supported.
* If the built in mappings dont successfully parse some classic microformats markup then raise an issue and well fix it.
* If you want to screen-scrape websites which dont use mf2 into mf2 data structures, consider contributing to [php-mf2-shim](https://github.com/indieweb/php-mf2-shim)
* If you *really* need to make one-off changes to the default mappings… It is possible. But you have to figure it out for yourself ;)
## Security
**No filtering of content takes place in mf2\Parser, so treat its output as you would any untrusted data from the source of the parsed document.**
Some tips:
* All content apart from the 'html' key in dictionaries produced by parsing an `e-*` property is not HTML-escaped. For example, `<span class="p-name">&lt;code&gt;</span>` will result in `"name": ["<code>"]`. At the very least, HTML-escape all properties before echoing them out in HTML
* If youre using the raw HTML content under the 'html' key of dictionaries produced by parsing `e-*` properties, you SHOULD purify the HTML before displaying it to prevent injection of arbitrary code. For PHP I recommend using [HTML Purifier](http://htmlpurifier.org)
TODO: move this section to a security/consumption best practises page on the wiki
## Contributing
Issues and bug reports are very welcome. If you know how to write tests then please do so as code always expresses problems and intent much better than English, and gives me a way of measuring whether or not fixes have actually solved your problem. If you dont know how to write tests, dont worry :) Just include as much useful information in the issue as you can.
Pull requests very welcome, please try to maintain stylistic, structural and naming consistency with the existing codebase, and dont be too upset if I make naming changes :)
### How to make a Pull Request
1. Fork the repo to your github account
2. Clone a copy to your computer (simply installing php-mf2 using composer only works for using it, not developing it)
3. Install the dev dependencies with `./composer.phar install`
4. Run PHPUnit with `./vendor/bin/phpunit`
5. Make your changes
6. Add PHPUnit tests for your changes, either in an existing test file if suitable, or a new one
7. Make sure your tests pass (`./vendor/bin/phpunit`), preferably using both PHP 5.3 and 5.4
8. Go to your fork of the repo on github.com and make a pull request, preferably with a short summary, detailed description and references to issues/parsing specs as appropriate
9. Bask in the warm feeling of having contributed to a piece of free software
### Testing
There are currently two separate test suites: one, in `tests/Mf2`, is written in phpunit, containing many microformats parsing examples as well as internal parser tests and regression tests for specific issues over php-mf2s history. Run it with `./vendor/bin/phpunit`.
The other, in `tests/test-suite`, is a custom test harness which hooks up php-mf2 to the cross-platform microformats test suite. Each test consists of a HTML file and a corresponding JSON file, and the suite can be run with `php ./tests/test-suite/test-suite.php`.
Currently php-mf2 passes the majority of its own test case, and a good percentage of the cross-platform tests. Contributors should ALWAYS test against the PHPUnit suite to ensure any changes dont negatively impact php-mf2, and SHOULD run the cross-platform suite, especially if youre changing parsing behaviour.
### Changelog
#### v0.2.10
2015-04-29
* Merged #58, fixing some parsing bugs and adding support for area element parsing. Thanks so much for your hard work and patience, <a class="h-card" href="http://ben.thatmustbe.me/">Ben</a>!
#### v0.2.9
2014-08-06
* Added backcompat classmap for hProduct, associated tests
* Started GPG signing version tags as barnaby@waterpigs.co.uk, fingerprint CBC7 7876 BF7C 9637 B6AE 77BA 7D49 834B 0416 CFA3
#### v0.2.8
2014-07-17
* Fixed issue #51 causing php-mf2 to not work with PHP 5.3
* Fixed issue #52 correctly handling the `<template>` element by ignoring it
* Fixed issue #53 improving the plaintext parsing of `<img>` elements
#### v0.2.7
2014-06-18
* Added `Mf2\fetch()` which fetches content from a URL and returns parsed microformats
* Added implied `dt-end` discovery (thanks for all your hard work, @gRegorLove!)
* Fixed issue causing classnames like `blah e- blah` to produce properties with numeric keys (thanks @aaronpk and @gRegorLove)
* Fixed issue causing resolved URLs to not include port numbers (thanks @aaronpk)
#### v0.2.6
* Added JSON mode as long-term fix for #29
* Fixed bug causing microformats nested under multiple property names to be parsed only once
#### v0.2.5
* Removed conditional replacing empty rel list with stdclass. Original purpose was to make JSON-encoding the output from the parser correct but it also caused Fatal Errors due to trying to treat stdclass as array.
#### v0.2.4
#### v0.2.3
* Made p-* parsing consistent with implied name parsing
* Stopped collapsing whitespace in p-* properties
* Implemented unicodeTrim which removes &nbsp; characters as well as regex \s
* Added support for implied name via abbr[title]
* Prevented excessively nested value-class elements from being parsed incorrectly, removed incorrect separator which was getting added in some cases
* Updated u-* parsing to be spec-compliant, matching [href] before value-class and only attempting URL resolution for URL attributes
* Added support for input[value] parsing
* Tests for all the above
#### v0.2.2
* Made resolveUrl method public, allowing advanced parsers and subclasses to make use of it
* Fixed bug causing multiple duplicate property values to appear
#### v0.2.1
* Fixed bug causing classic microformats property classnames to not be parsed correctly
#### v0.2.0 (BREAKING CHANGES)
* Namespace change from mf2 to Mf2, for PSR-0 compatibility
* `Mf2\parse()` function added to simplify the most common case of just parsing some HTML
* Updated e-* property parsing rules to match mf2 parsing spec — instead of producing inconsistent HTML content, it now produces dictionaries like <pre><code>
{
"html": "<b>The Content</b>",
"value: "The Content"
}
</code></pre>
* Removed `htmlSafe` options as new e-* parsing rules make them redundant
* Moved a whole load of static functions out of the class and into standalone functions
* Changed autoloading to always include Parser.php instead of using classmap
#### v0.1.23
* Made some changes to the way back-compatibility with classic microformats are handled, ignoring classic property classnames inside mf2 roots and outside classic roots
* Deprecated ability to add new classmaps, removed twitter classmap. Use [php-mf2-shim](http://github.com/indieweb/php-mf2-shim) instead, its better
#### v0.1.22
* Converts classic microformats by default
#### v0.1.21
* Removed webignition dependency, also removing ext-intl dependency. php-mf2 is now a standalone, single file library again
* Replaced webignition URL resolving with custom code passing almost all tests, courtesy of <a class="h-card" href="http://aaronparecki.com">Aaron Parecki</a>
#### v0.1.20
* Added in almost-perfect custom URL resolving code
#### v0.1.19 (2013-06-11)
* Required stable version of webigniton/absolute-url-resolver, hopefully resolving versioning problems
#### v0.1.18 (2013-06-05)
* Fixed problems with isElementParsed, causing elements to be incorrectly parsed
* Cleaned up some test files
#### v0.1.17
* Rewrote some PHP 5.4 array syntax which crept into 0.1.16 so php-mf2 still works on PHP 5.3
* Fixed a bug causing weird partial microformats to be added to parent microformats if they had doubly property-nested children
* Finally actually licensed this project under a real license (MIT, in composer.json)
* Suggested barnabywalters/mf-cleaner in composer.json
#### v0.1.16
* Ability to parse from only an ID
* Context DOMElement can be passed to $parse
* Parser::query runs XPath queries on the current document
* When parsing e-* properties, elements with @src, @data or @href have relative URLs resolved in the output
#### v0.1.15
* Added html-safe options
* Added rel+rel-alternate parsing

42
vendor/mf2/mf2/bin/fetch-mf2 vendored Executable file
View file

@ -0,0 +1,42 @@
#!/usr/bin/env php
<?php
$files = array(
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../../autoload.php',
__DIR__ . '/../Mf2/Parser.php'
);
foreach ($files as $file) {
if (file_exists($file)) {
require $file;
define('COMPOSER_INSTALL_LOCATION', $file);
break;
}
}
if (!defined('COMPOSER_INSTALL_LOCATION')) {
die('A composer /vendor/autoload.php file could not be found. You need to install composer: https://getcomposer.org/download');
}
$url = $argv[1];
if (empty($url)) {
die("Please provide a URL to fetch+parse, e.g. bin/fetch-mf2 waterpigs.co.uk/notes");
}
if (!file_exists($url)) {
if (!preg_match('|https?://|', $url)) {
$url = 'http://' . $url;
}
}
$html = file_get_contents($url);
$result = Mf2\parse($html, $url);
if (defined('JSON_PRETTY_PRINT')) {
echo json_encode($result, JSON_PRETTY_PRINT);
} else {
echo json_encode($result);
}

37
vendor/mf2/mf2/bin/parse-mf2 vendored Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env php
<?php
$files = array(
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../../autoload.php',
__DIR__ . '/../Mf2/Parser.php'
);
foreach ($files as $file) {
if (file_exists($file)) {
require $file;
define('COMPOSER_INSTALL_LOCATION', $file);
break;
}
}
if (!defined('COMPOSER_INSTALL_LOCATION')) {
die('A composer /vendor/autoload.php file could not be found. You need to install composer: https://getcomposer.org/download');
}
if (!empty($argv[1])) {
$url = $argv[1];
if (!preg_match('|https?://|', $url)) {
$url = 'http://' . $url;
}
} else {
$url = null;
}
$result = Mf2\parse(fgets(STDIN), $url);
if (defined('JSON_PRETTY_PRINT')) {
echo json_encode($result, JSON_PRETTY_PRINT);
} else {
echo json_encode($result);
}

26
vendor/mf2/mf2/composer.json vendored Normal file
View file

@ -0,0 +1,26 @@
{
"name": "mf2/mf2",
"type": "library",
"description": "A pure, generic microformats2 parser — makes HTML as easy to consume as a JSON API",
"keywords": ["microformats", "microformats 2", "parser", "semantic", "html"],
"authors" : [
{
"name": "Barnaby Walters",
"homepage": "http://waterpigs.co.uk"
}
],
"bin": ["bin/fetch-mf2", "bin/parse-mf2"],
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"autoload": {
"files": ["Mf2/Parser.php"]
},
"license": "MIT",
"suggest": {
"barnabywalters/mf-cleaner": "To more easily handle the canonical data php-mf2 gives you"
}
}

438
vendor/mf2/mf2/composer.lock generated vendored Normal file
View file

@ -0,0 +1,438 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "4ddb858a7bdae5163307bd104589bd95",
"packages": [],
"packages-dev": [
{
"name": "phpunit/php-code-coverage",
"version": "1.2.18",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b",
"reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": ">=1.3.0@stable",
"phpunit/php-text-template": ">=1.2.0@stable",
"phpunit/php-token-stream": ">=1.1.3,<1.3.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*@dev"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.0.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2014-09-02 10:13:14"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "a923bb15680d0089e2316f7a4af8f437046e96bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb",
"reference": "a923bb15680d0089e2316f7a4af8f437046e96bb",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2015-04-02 05:19:05"
},
{
"name": "phpunit/php-text-template",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"Text/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2014-01-30 17:20:04"
},
{
"name": "phpunit/php-timer",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2013-08-02 07:42:54"
},
{
"name": "phpunit/php-token-stream",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ad4e1e23ae01b483c16f600ff1bebec184588e32",
"reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2014-03-03 05:10:30"
},
{
"name": "phpunit/phpunit",
"version": "3.7.38",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/38709dc22d519a3d1be46849868aa2ddf822bcf6",
"reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpunit/php-code-coverage": "~1.2",
"phpunit/php-file-iterator": "~1.3",
"phpunit/php-text-template": "~1.1",
"phpunit/php-timer": "~1.0",
"phpunit/phpunit-mock-objects": "~1.2",
"symfony/yaml": "~2.0"
},
"require-dev": {
"pear-pear.php.net/pear": "1.9.4"
},
"suggest": {
"phpunit/php-invoker": "~1.1"
},
"bin": [
"composer/bin/phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.7.x-dev"
}
},
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"",
"../../symfony/yaml/"
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "http://www.phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2014-10-17 09:04:17"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "1.2.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875",
"reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-text-template": ">=1.1.1@stable"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2013-01-13 10:24:48"
},
{
"name": "symfony/yaml",
"version": "v2.6.6",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "174f009ed36379a801109955fc5a71a49fe62dd4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/174f009ed36379a801109955fc5a71a49fe62dd4",
"reference": "174f009ed36379a801109955fc5a71a49fe62dd4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2015-03-30 15:54:10"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.0"
},
"platform-dev": []
}

8
vendor/mf2/mf2/phpunit.xml vendored Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<phpunit bootstrap="tests/Mf2/bootstrap.php">
<testsuites>
<testsuite name="php-mf2">
<directory suffix="Test.php">tests/Mf2</directory>
</testsuite>
</testsuites>
</phpunit>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,252 @@
<?php
namespace Mf2\Parser\Test;
use Mf2\Parser;
use Mf2;
use PHPUnit_Framework_TestCase;
/**
* Combined Microformats Test
*
* Tests the ability of Parser::parse() to handle nested microformats correctly.
* More info at http://microformats.org/wiki/microformats-2#combining_microformats
*
* @todo implement
*/
class CombinedMicroformatsTest extends PHPUnit_Framework_TestCase {
public function setUp() {
date_default_timezone_set('Europe/London');
}
/**
* From http://microformats.org/wiki/microformats2#combining_microformats
*/
public function testHEventLocationHCard() {
$input = '<div class="h-event">
<a class="p-name u-url" href="http://indiewebcamp.com/2012">
IndieWebCamp 2012
</a>
from <time class="dt-start">2012-06-30</time>
to <time class="dt-end">2012-07-01</time> at
<span class="p-location h-card">
<a class="p-name p-org u-url" href="http://geoloqi.com/">
Geoloqi</a>, <span class="p-street-address">920 SW 3rd Ave. Suite 400</span>, <span class="p-locality">Portland</span>, <abbr class="p-region" title="Oregon">OR</abbr>
</span>
</div>';
$expected = '{
"rels": {},
"items": [{
"type": ["h-event"],
"properties": {
"name": ["IndieWebCamp 2012"],
"url": ["http://indiewebcamp.com/2012"],
"start": ["2012-06-30"],
"end": ["2012-07-01"],
"location": [{
"value": "Geoloqi",
"type": ["h-card"],
"properties": {
"name": ["Geoloqi"],
"org": ["Geoloqi"],
"url": ["http://geoloqi.com/"],
"street-address": ["920 SW 3rd Ave. Suite 400"],
"locality": ["Portland"],
"region": ["Oregon"]
}
}]
}
}]
}';
$parser = new Parser($input, '', true);
$parser->stringDateTimes = true;
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
/**
* From http://microformats.org/wiki/microformats2#combining_microformats
*/
public function testHCardOrgPOrg() {
$input = '<div class="h-card">
<a class="p-name u-url"
href="http://blog.lizardwrangler.com/"
>Mitchell Baker</a>
(<span class="p-org">Mozilla Foundation</span>)
</div>';
$expected = '{
"rels": {},
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Mitchell Baker"],
"url": ["http://blog.lizardwrangler.com/"],
"org": ["Mozilla Foundation"]
}
}]
}';
$parser = new Parser($input, '', true);
$parser->stringDateTimes = true;
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
/**
* From http://microformats.org/wiki/microformats2#combining_microformats
*/
public function testHCardOrgHCard() {
$input = '<div class="h-card">
<a class="p-name u-url"
href="http://blog.lizardwrangler.com/"
>Mitchell Baker</a>
(<a class="p-org h-card"
href="http://mozilla.org/"
>Mozilla Foundation</a>)
</div>';
$expected = '{
"rels": {},
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Mitchell Baker"],
"url": ["http://blog.lizardwrangler.com/"],
"org": [{
"value": "Mozilla Foundation",
"type": ["h-card"],
"properties": {
"name": ["Mozilla Foundation"],
"url": ["http://mozilla.org/"]
}
}]
}
}]
}';
$parser = new Parser($input, '', true);
$parser->stringDateTimes = true;
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
/**
* From http://microformats.org/wiki/microformats2#combining_microformats
*/
public function testHCardPOrgHCardHOrg() {
$input = '<div class="h-card">
<a class="p-name u-url"
href="http://blog.lizardwrangler.com/"
>Mitchell Baker</a>
(<a class="p-org h-card h-org"
href="http://mozilla.org/"
>Mozilla Foundation</a>)
</div>';
$expected = '{
"rels": {},
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Mitchell Baker"],
"url": ["http://blog.lizardwrangler.com/"],
"org": [{
"value": "Mozilla Foundation",
"type": ["h-card", "h-org"],
"properties": {
"name": ["Mozilla Foundation"],
"url": ["http://mozilla.org/"]
}
}]
}
}]
}';
$parser = new Parser($input, '', true);
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
/**
* From http://microformats.org/wiki/microformats2#combining_microformats
*/
public function testHCardChildHCard() {
$input = '<div class="h-card">
<a class="p-name u-url"
href="http://blog.lizardwrangler.com/">
Mitchell Baker</a>
(<a class="h-card h-org" href="http://mozilla.org/">
Mozilla Foundation</a>)
</div>';
$expected = '{
"rels": {},
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Mitchell Baker"],
"url": ["http://blog.lizardwrangler.com/"]
},
"children": [{
"type": ["h-card","h-org"],
"properties": {
"name": ["Mozilla Foundation"],
"url": ["http://mozilla.org/"]
},
"value": "Mozilla Foundation"
}]
}]
}';
$parser = new Parser($input, '', true);
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
/**
* Regression test for https://github.com/indieweb/php-mf2/issues/42
*
* This was occurring because mfPropertyNamesFromClass was only ever returning the first property name
* rather than all of them.
*/
public function testNestedMicroformatUnderMultipleProperties() {
$input = '<article class="h-entry"><div class="p-like-of p-in-reply-to h-cite"></div></article>';
$mf = Mf2\parse($input);
$this->assertCount(1, $mf['items'][0]['properties']['like-of']);
$this->assertCount(1, $mf['items'][0]['properties']['in-reply-to']);
}
/**
* Test microformats nested under e-* property classnames retain html: key in structure
*
* @see https://github.com/indieweb/php-mf2/issues/64
*/
public function testMicroformatsNestedUnderEPropertyClassnamesRetainHtmlKey() {
$input = '<div class="h-entry"><div class="h-card e-content"><p>Hello</p></div></div>';
$mf = Mf2\parse($input);
$this->assertEquals($mf['items'][0]['properties']['content'][0]['html'], '<p>Hello</p>');
}
/**
* Test microformats nested under u-* property classnames derive value: key from parsing as u-*
*/
public function testMicroformatsNestedUnderUPropertyClassnamesDeriveValueCorrectly() {
$input = '<div class="h-entry"><img class="u-url h-card" alt="This should not be the value" src="This should be the value" /></div>';
$mf = Mf2\parse($input);
$this->assertEquals($mf['items'][0]['properties']['url'][0]['value'], 'This should be the value');
}
public function testMicroformatsNestedUnderPPropertyClassnamesDeriveValueFromFirstPName() {
$input = '<div class="h-entry"><div class="p-author h-card">This post was written by <span class="p-name">Zoe</span>.</div></div>';
$mf = Mf2\parse($input);
$this->assertEquals($mf['items'][0]['properties']['author'][0]['value'], 'Zoe');
}
}

View file

@ -0,0 +1,188 @@
<?php
/**
* Tests of the parsing methods within mf2\Parser
*/
namespace Mf2\Parser\Test;
use Mf2\Parser;
use PHPUnit_Framework_TestCase;
/**
* Microformats Wiki Examples
*
* Contains tests built directly from examples given on the microformats wiki pages about µf2.
*
* These tend to compare the JSON-encoded output of Parser::parse() with the JSON strings given on the wiki.
* If the given JSON is not within an `items` key of the root object, I add it and mark as so.
*
* @author Barnaby Walters waterpigs.co.uk <barnaby@waterpigs.co.uk>
*/
class MicroformatsWikiExamplesTest extends PHPUnit_Framework_TestCase {
public function setUp() {
date_default_timezone_set('Europe/London');
}
public function testHandlesEmptyStringsCorrectly() {
$input = '';
$expected = '{
"rels": {},
"items": []
}';
$parser = new Parser($input, '', true);
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
public function testHandlesNullCorrectly() {
$input = Null;
$expected = '{
"rels": {},
"items": []
}';
$parser = new Parser($input, '', true);
$parser->jsonMode = true;
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
/**
* From http://microformats.org/wiki/microformats-2
*/
public function testSimplePersonReference() {
$input = '<span class="h-card">Frances Berriman</span>';
$expected = '{
"rels": {},
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Frances Berriman"]
}
}]
}';
$parser = new Parser($input, '', true);
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
/**
* From http://microformats.org/wiki/microformats-2
*/
public function testSimpleHyperlinkedPersonReference() {
$input = '<a class="h-card" href="http://benward.me">Ben Ward</a>';
$expected = '{
"rels": {},
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Ben Ward"],
"url": ["http://benward.me"]
}
}]
}';
$parser = new Parser($input, '', true);
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
/**
* From http://microformats.org/wiki/microformats-2-implied-properties
*/
public function testSimplePersonImage() {
$input = '<img class="h-card" src="http://example.org/pic.jpg" alt="Chris Messina" />';
// Added root items key
$expected = '{
"rels": {},
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Chris Messina"],
"photo": ["http://example.org/pic.jpg"]
}
}]}';
$parser = new Parser($input, '', true);
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
/**
* From http://microformats.org/wiki/microformats-2-implied-properties
*/
public function testHyperlinkedImageNameAndPhotoProperties() {
$input = '<a class="h-card" href="http://rohit.khare.org/">
<img alt="Rohit Khare"
src="https://s3.amazonaws.com/twitter_production/profile_images/53307499/180px-Rohit-sq_bigger.jpg" />
</a>';
// Added root items key
$expected = '{
"rels": {},
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Rohit Khare"],
"url": ["http://rohit.khare.org/"],
"photo": ["https://s3.amazonaws.com/twitter_production/profile_images/53307499/180px-Rohit-sq_bigger.jpg"]
}
}]}';
$parser = new Parser($input, '', true);
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
/**
* From http://microformats.org/wiki/microformats-2
*/
public function testMoreDetailedPerson() {
$input = '<div class="h-card">
<img class="u-photo" alt="photo of Mitchell"
src="https://webfwd.org/content/about-experts/300.mitchellbaker/mentor_mbaker.jpg"/>
<a class="p-name u-url"
href="http://blog.lizardwrangler.com/"
>Mitchell Baker</a>
(<a class="u-url"
href="https://twitter.com/MitchellBaker"
>@MitchellBaker</a>)
<span class="p-org">Mozilla Foundation</span>
<p class="p-note">
Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities.
</p>
<span class="p-category">Strategy</span>
<span class="p-category">Leadership</span>
</div>';
$expected = '{
"rels": {},
"items": [{
"type": ["h-card"],
"properties": {
"photo": ["https://webfwd.org/content/about-experts/300.mitchellbaker/mentor_mbaker.jpg"],
"name": ["Mitchell Baker"],
"url": [
"http://blog.lizardwrangler.com/",
"https://twitter.com/MitchellBaker"
],
"org": ["Mozilla Foundation"],
"note": ["Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities."],
"category": [
"Strategy",
"Leadership"
]
}
}]
}';
$parser = new Parser($input, '', true);
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
}

261
vendor/mf2/mf2/tests/Mf2/ParseDTTest.php vendored Normal file
View file

@ -0,0 +1,261 @@
<?php
/**
* Tests of the parsing methods within mf2\Parser
*/
namespace Mf2\Parser\Test;
use Mf2\Parser;
use PHPUnit_Framework_TestCase;
class ParseDTTest extends PHPUnit_Framework_TestCase {
public function setUp() {
date_default_timezone_set('Europe/London');
}
// Note that value-class tests for dt-* attributes are stored elsewhere, as there are so many of the bloody things
/**
* @group parseDT
*/
public function testParseDTHandlesImg() {
$input = '<div class="h-card"><img class="dt-start" alt="2012-08-05T14:50"></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
*/
public function testParseDTHandlesDataValueAttr() {
$input = '<div class="h-card"><data class="dt-start" value="2012-08-05T14:50"></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
*/
public function testParseDTHandlesDataInnerHTML() {
$input = '<div class="h-card"><data class="dt-start">2012-08-05T14:50</data></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
*/
public function testParseDTHandlesAbbrValueAttr() {
$input = '<div class="h-card"><abbr class="dt-start" title="2012-08-05T14:50"></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
*/
public function testParseDTHandlesAbbrInnerHTML() {
$input = '<div class="h-card"><abbr class="dt-start">2012-08-05T14:50</abbr></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
*/
public function testParseDTHandlesTimeDatetimeAttr() {
$input = '<div class="h-card"><time class="dt-start" datetime="2012-08-05T14:50"></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
*/
public function testParseDTHandlesTimeInnerHTML() {
$input = '<div class="h-card"><time class="dt-start">2012-08-05T14:50</time></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
*/
public function testParseDTHandlesInsDelDatetime() {
$input = '<div class="h-card"><ins class="dt-start" datetime="2012-08-05T14:50"></ins><del class="dt-end" datetime="2012-08-05T18:00"></del></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertArrayHasKey('end', $output['items'][0]['properties']);
$this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]);
$this->assertEquals('2012-08-05T18:00', $output['items'][0]['properties']['end'][0]);
}
/**
* @group parseDT
* @group valueClass
*/
public function testYYYY_MM_DD__HH_MM() {
$input = '<div class="h-event"><span class="dt-start"><span class="value">2012-10-07</span> at <span class="value">21:18</span></span></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-10-07T21:18', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
* @group valueClass
*/
public function testAbbrYYYY_MM_DD__HH_MM() {
$input = '<div class="h-event"><span class="dt-start"><abbr class="value" title="2012-10-07">some day</abbr> at <span class="value">21:18</span></span></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-10-07T21:18', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
* @group valueClass
*/
public function testYYYY_MM_DD__HHpm() {
$input = '<div class="h-event"><span class="dt-start"><span class="value">2012-10-07</span> at <span class="value">9pm</span></span></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-10-07T21:00', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
* @group valueClass
*/
public function testYYYY_MM_DD__HH_MMpm() {
$input = '<div class="h-event"><span class="dt-start"><span class="value">2012-10-07</span> at <span class="value">9:00pm</span></span></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-10-07T21:00', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
* @group valueClass
*/
public function testYYYY_MM_DD__HH_MM_SSpm() {
$input = '<div class="h-event"><span class="dt-start"><span class="value">2012-10-07</span> at <span class="value">9:00:00pm</span></span></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2012-10-07T21:00:00', $output['items'][0]['properties']['start'][0]);
}
/**
* This test name refers to the value-class used within the dt-end.
* @group parseDT
* @group valueClass
*/
public function testImpliedDTEndWithValueClass() {
$input = '<div class="h-event"> <span class="dt-start"><span class="value">2014-06-04</span> at <span class="value">18:30</span> <span class="dt-end"><span class="value">19:30</span></span></span> </div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertArrayHasKey('end', $output['items'][0]['properties']);
$this->assertEquals('2014-06-04T18:30', $output['items'][0]['properties']['start'][0]);
$this->assertEquals('2014-06-04T19:30', $output['items'][0]['properties']['end'][0]);
}
/**
* This test name refers to the lack of value-class within the dt-end.
* @group parseDT
* @group valueClass
*/
public function testImpliedDTEndWithoutValueClass() {
$input = '<div class="h-event"> <span class="dt-start"><span class="value">2014-06-05</span> at <span class="value">18:31</span> <span class="dt-end">19:31</span></span> </div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertArrayHasKey('end', $output['items'][0]['properties']);
$this->assertEquals('2014-06-05T18:31', $output['items'][0]['properties']['start'][0]);
$this->assertEquals('2014-06-05T19:31', $output['items'][0]['properties']['end'][0]);
}
/**
* @see https://github.com/indieweb/php-mf2/pull/46
* @group parseDT
* @group valueClass
*/
public function testImpliedDTEndUsingNonValueClassDTStart() {
$input = '<div class="h-event"> <time class="dt-start">2014-06-05T18:31</time> until <span class="dt-end">19:31</span></span> </div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertArrayHasKey('end', $output['items'][0]['properties']);
$this->assertEquals('2014-06-05T18:31', $output['items'][0]['properties']['start'][0]);
$this->assertEquals('2014-06-05T19:31', $output['items'][0]['properties']['end'][0]);
}
/**
* @group parseDT
* @group valueClass
*/
public function testDTStartOnly() {
$input = '<div class="h-event"> <span class="dt-start"><span class="value">2014-06-06</span> at <span class="value">18:32</span> </span> </div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2014-06-06T18:32', $output['items'][0]['properties']['start'][0]);
}
/**
* @group parseDT
* @group valueClass
*/
public function testDTStartDateOnly() {
$input = '<div class="h-event"> <span class="dt-start"><span class="value">2014-06-07</span> </span> </div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('start', $output['items'][0]['properties']);
$this->assertEquals('2014-06-07', $output['items'][0]['properties']['start'][0]);
}
}

View file

@ -0,0 +1,185 @@
<?php
/**
* Tests of the parsing methods within mf2\Parser
*/
namespace Mf2\Parser\Test;
use Mf2;
use Mf2\Parser;
use PHPUnit_Framework_TestCase;
/**
* @todo some of these can be made into single tests with dataProviders
*/
class ParseImpliedTest extends PHPUnit_Framework_TestCase {
public function setUp() {
date_default_timezone_set('Europe/London');
}
public function testParsesImpliedPNameFromNodeValue() {
$input = '<span class="h-card">The Name</span>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('The Name', $output['items'][0]['properties']['name'][0]);
}
public function testParsesImpliedPNameFromImgAlt() {
$input = '<img class="h-card" src="" alt="The Name" />';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('The Name', $output['items'][0]['properties']['name'][0]);
}
public function testParsesImpliedPNameFromNestedImgAlt() {
$input = '<div class="h-card"><img src="" alt="The Name" /></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('The Name', $output['items'][0]['properties']['name'][0]);
}
public function testParsesImpliedPNameFromDoublyNestedImgAlt() {
$input = '<div class="h-card"><span><img src="" alt="The Name" /></span></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('The Name', $output['items'][0]['properties']['name'][0]);
}
public function testParsesImpliedUPhotoFromImgSrc() {
$input = '<img class="h-card" src="http://example.com/img.png" alt="" />';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('photo', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/img.png', $output['items'][0]['properties']['photo'][0]);
}
public function testParsesImpliedUPhotoFromNestedImgSrc() {
$input = '<div class="h-card"><img src="http://example.com/img.png" alt="" /></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('photo', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/img.png', $output['items'][0]['properties']['photo'][0]);
}
public function testParsesImpliedUPhotoFromDoublyNestedImgSrc() {
$input = '<div class="h-card"><span><img src="http://example.com/img.png" alt="" /></span></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('photo', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/img.png', $output['items'][0]['properties']['photo'][0]);
}
public function testIgnoresImgIfNotOnlyChild() {
$input = '<div class="h-card"><img src="http://example.com/img.png" /> <p>Moar text</p></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayNotHasKey('photo', $output['items'][0]['properties']);
}
public function testIgnoresDoublyNestedImgIfNotOnlyDoublyNestedChild() {
$input = '<div class="h-card"><span><img src="http://example.com/img.png" /> <p>Moar text</p></span></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayNotHasKey('photo', $output['items'][0]['properties']);
}
public function testParsesImpliedUUrlFromAHref() {
$input = '<a class="h-card" href="http://example.com/">Some Name</a>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('url', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/', $output['items'][0]['properties']['url'][0]);
}
public function testParsesImpliedUUrlFromNestedAHref() {
$input = '<span class="h-card"><a href="http://example.com/">Some Name</a></span>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('url', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/', $output['items'][0]['properties']['url'][0]);
}
public function testMultipleImpliedHCards() {
$input = '<span class="h-card">Frances Berriman</span>
<a class="h-card" href="http://benward.me">Ben Ward</a>
<img class="h-card" alt="Sally Ride"
src="http://upload.wikimedia.org/wikipedia/commons/a/a4/Ride-s.jpg"/>
<a class="h-card" href="http://tantek.com">
<img alt="Tantek Çelik" src="http://ttk.me/logo.jpg"/>
</a>';
$expected = '{
"rels": {},
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Frances Berriman"]
}
},
{
"type": ["h-card"],
"properties": {
"name": ["Ben Ward"],
"url": ["http://benward.me"]
}
},
{
"type": ["h-card"],
"properties": {
"name": ["Sally Ride"],
"photo": ["http://upload.wikimedia.org/wikipedia/commons/a/a4/Ride-s.jpg"]
}
},
{
"type": ["h-card"],
"properties": {
"name": ["Tantek Çelik"],
"url": ["http://tantek.com"],
"photo": ["http://ttk.me/logo.jpg"]
}
}]
}';
$parser = new Parser($input, '', true);
$output = $parser->parse();
$this->assertJsonStringEqualsJsonString(json_encode($output), $expected);
}
/** as per https://github.com/indieweb/php-mf2/issues/37 */
public function testParsesImpliedNameConsistentWithPName() {
$inner = "Name \nand more";
$test = '<span class="h-card"> ' . $inner .' </span><span class="h-card"><span class="p-name"> ' . $inner . ' </span></span>';
$result = Mf2\parse($test);
$this->assertEquals($inner, $result['items'][0]['properties']['name'][0]);
$this->assertEquals($inner, $result['items'][1]['properties']['name'][0]);
}
/** @see https://github.com/indieweb/php-mf2/issues/6 */
public function testParsesImpliedNameFromAbbrTitle() {
$input = '<abbr class="h-card" title="Barnaby Walters">BJW</abbr>';
$result = Mf2\parse($input);
$this->assertEquals('Barnaby Walters', $result['items'][0]['properties']['name'][0]);
}
}

105
vendor/mf2/mf2/tests/Mf2/ParsePTest.php vendored Normal file
View file

@ -0,0 +1,105 @@
<?php
/**
* Tests of the parsing methods within mf2\Parser
*/
namespace Mf2\Parser\Test;
use Mf2;
use Mf2\Parser;
use PHPUnit_Framework_TestCase;
class ParsePTest extends PHPUnit_Framework_TestCase {
public function setUp() {
date_default_timezone_set('Europe/London');
}
/**
* @group parseP
*/
public function testParsePHandlesInnerText() {
$input = '<div class="h-card"><p class="p-name">Example User</p></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('Example User', $output['items'][0]['properties']['name'][0]);
}
/**
* @group parseP
*/
public function testParsePHandlesImg() {
$input = '<div class="h-card"><img class="p-name" alt="Example User"></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('Example User', $output['items'][0]['properties']['name'][0]);
}
/**
* @group parseP
*/
public function testParsePHandlesAbbr() {
$input = '<div class="h-card h-person"><abbr class="p-name" title="Example User">@example</abbr></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('Example User', $output['items'][0]['properties']['name'][0]);
}
/**
* @group parseP
*/
public function testParsePHandlesData() {
$input = '<div class="h-card"><data class="p-name" value="Example User"></data></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('Example User', $output['items'][0]['properties']['name'][0]);
}
/**
* @group parseP
*/
public function testParsePReturnsEmptyStringForBrHr() {
$input = '<div class="h-card"><br class="p-name"/></div><div class="h-card"><hr class="p-name"/></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('', $output['items'][0]['properties']['name'][0]);
$this->assertEquals('', $output['items'][0]['properties']['name'][0]);
}
public function testParsesInputValue() {
$input = '<span class="h-card"><input class="u-url" value="http://example.com" /></span>';
$result = Mf2\parse($input);
$this->assertEquals('http://example.com', $result['items'][0]['properties']['url'][0]);
}
/**
* @see https://github.com/indieweb/php-mf2/issues/53
* @see http://microformats.org/wiki/microformats2-parsing#parsing_an_e-_property
*/
public function testConvertsNestedImgElementToAltOrSrc() {
$input = <<<EOT
<div class="h-entry">
<p class="p-name">The day I saw a <img alt="five legged elephant" src="/photos/five-legged-elephant.jpg" /></p>
<p class="p-summary">Blah blah <img src="/photos/five-legged-elephant.jpg" /></p>
</div>
EOT;
$result = Mf2\parse($input, 'http://waterpigs.co.uk/articles/five-legged-elephant');
$this->assertEquals('The day I saw a five legged elephant', $result['items'][0]['properties']['name'][0]);
$this->assertEquals('Blah blah http://waterpigs.co.uk/photos/five-legged-elephant.jpg', $result['items'][0]['properties']['summary'][0]);
}
}

178
vendor/mf2/mf2/tests/Mf2/ParseUTest.php vendored Normal file
View file

@ -0,0 +1,178 @@
<?php
/**
* Tests of the parsing methods within mf2\Parser
*/
namespace Mf2\Parser\Test;
use Mf2;
use Mf2\Parser;
use PHPUnit_Framework_TestCase;
class ParseUTest extends PHPUnit_Framework_TestCase {
public function setUp() {
date_default_timezone_set('Europe/London');
}
/**
* @group parseU
*/
public function testParseUHandlesA() {
$input = '<div class="h-card"><a class="u-url" href="http://example.com">Awesome example website</a></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('url', $output['items'][0]['properties']);
$this->assertEquals('http://example.com', $output['items'][0]['properties']['url'][0]);
}
/**
* @group parseU
*/
public function testParseUHandlesImg() {
$input = '<div class="h-card"><img class="u-photo" src="http://example.com/someimage.png"></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('photo', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/someimage.png', $output['items'][0]['properties']['photo'][0]);
}
/**
* @group parseU
*/
public function testParseUHandlesArea() {
$input = '<div class="h-card"><area class="u-photo" href="http://example.com/someimage.png"></area></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('photo', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/someimage.png', $output['items'][0]['properties']['photo'][0]);
}
/**
* @group parseU
*/
public function testParseUHandlesObject() {
$input = '<div class="h-card"><object class="u-photo" data="http://example.com/someimage.png"></object></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('photo', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/someimage.png', $output['items'][0]['properties']['photo'][0]);
}
/**
* @group parseU
*/
public function testParseUHandlesAbbr() {
$input = '<div class="h-card"><abbr class="u-photo" title="http://example.com/someimage.png"></abbr></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('photo', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/someimage.png', $output['items'][0]['properties']['photo'][0]);
}
/**
* @group parseU
*/
public function testParseUHandlesData() {
$input = '<div class="h-card"><data class="u-photo" value="http://example.com/someimage.png"></data></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('photo', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/someimage.png', $output['items'][0]['properties']['photo'][0]);
}
/**
* @group baseUrl
*/
public function testResolvesRelativeUrlsFromDocumentUrl() {
$input = '<div class="h-card"><img class="u-photo" src="../image.png" /></div>';
$parser = new Parser($input, 'http://example.com/things/more/more.html');
$output = $parser->parse();
$this->assertEquals('http://example.com/things/image.png', $output['items'][0]['properties']['photo'][0]);
}
/**
* @group baseUrl
*/
public function testResolvesRelativeUrlsFromBaseUrl() {
$input = '<head><base href="http://example.com/things/more/andmore/" /></head><body><div class="h-card"><img class="u-photo" src="../image.png" /></div></body>';
$parser = new Parser($input, 'http://example.com/things/more.html');
$output = $parser->parse();
$this->assertEquals('http://example.com/things/more/image.png', $output['items'][0]['properties']['photo'][0]);
}
/**
* @group baseUrl
*/
public function testResolvesRelativeUrlsInImpliedMicroformats() {
$input = '<a class="h-card"><img src="image.png" /></a>';
$parser = new Parser($input, 'http://example.com/things/more.html');
$output = $parser->parse();
$this->assertEquals('http://example.com/things/image.png', $output['items'][0]['properties']['photo'][0]);
}
/**
* @group baseUrl
*/
public function testResolvesRelativeBaseRelativeUrlsInImpliedMicroformats() {
$input = '<base href="things/"/><a class="h-card"><img src="image.png" /></a>';
$parser = new Parser($input, 'http://example.com/');
$output = $parser->parse();
$this->assertEquals('http://example.com/things/image.png', $output['items'][0]['properties']['photo'][0]);
}
/** @see https://github.com/indieweb/php-mf2/issues/33 */
public function testParsesHrefBeforeValueClass() {
$input = '<span class="h-card"><a class="u-url" href="http://example.com/right"><span class="value">WRONG</span></a></span>';
$result = Mf2\parse($input);
$this->assertEquals('http://example.com/right', $result['items'][0]['properties']['url'][0]);
}
/**
* @group parseU
*/
public function testParseUHandlesAudio() {
$input = '<div class="h-entry"><audio class="u-audio" src="http://example.com/audio.mp3"></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('audio', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/audio.mp3', $output['items'][0]['properties']['audio'][0]);
}
/**
* @group parseU
*/
public function testParseUHandlesVideo() {
$input = '<div class="h-entry"><video class="u-video" src="http://example.com/video.mp4"></video></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('video', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/video.mp4', $output['items'][0]['properties']['video'][0]);
}
/**
* @group parseU
*/
public function testParseUHandlesSource() {
$input = '<div class="h-entry"><video><source class="u-video" src="http://example.com/video.mp4" type="video/mp4"><source class="u-video" src="http://example.com/video.ogg" type="video/ogg"></video></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('video', $output['items'][0]['properties']);
$this->assertEquals('http://example.com/video.mp4', $output['items'][0]['properties']['video'][0]);
$this->assertEquals('http://example.com/video.ogg', $output['items'][0]['properties']['video'][1]);
}
}

View file

@ -0,0 +1,108 @@
<?php
/**
* Tests of the parsing methods within mf2\Parser
*/
namespace Mf2\Parser\Test;
use Mf2;
use Mf2\Parser;
use PHPUnit_Framework_TestCase;
class ParseValueClassTitleTest extends PHPUnit_Framework_TestCase {
public function setUp() {
date_default_timezone_set('Europe/London');
}
public function testValueClassTitleHandlesSingleValueClass() {
$input = '<div class="h-card"><p class="p-name"><span class="value">Name</span> (this should not be included)</p></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('Name', $output['items'][0]['properties']['name'][0]);
}
public function testValueClassTitleHandlesMultipleValueClass() {
$input = '<div class="h-card"><p class="p-name"><span class="value">Name</span> (this should not be included) <span class="value">Endname</span></p></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('NameEndname', $output['items'][0]['properties']['name'][0]);
}
public function testValueClassTitleHandlesSingleValueTitle() {
$input = '<div class="h-card"><p class="p-name"><span class="value-title" title="Real Name">Wrong Name</span> (this should not be included)</p></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('Real Name', $output['items'][0]['properties']['name'][0]);
}
public function testValueClassTitleHandlesMultipleValueTitle() {
$input = '<div class="h-card"><p class="p-name"><span class="value-title" title="Real ">Wrong Name</span> <span class="value-title" title="Name">(this should not be included)</span></p></div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('name', $output['items'][0]['properties']);
$this->assertEquals('Real Name', $output['items'][0]['properties']['name'][0]);
}
/**
* @see https://github.com/indieweb/php-mf2/issues/25
*/
public function testValueClassDatetimeWorksWithUrlProperties() {
$input = <<<EOT
<div class="h-entry">
<a href="2013/178/t1/surreal-meeting-dpdpdp-trondisc"
rel="bookmark"
class="dt-published published dt-updated updated u-url u-uid">
<time class="value">10:17</time>
on <time class="value">2013-06-27</time>
</a>
</div>
EOT;
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('published', $output['items'][0]['properties']);
$this->assertEquals('2013-06-27T10:17', $output['items'][0]['properties']['published'][0]);
}
/**
* @see https://github.com/indieweb/php-mf2/issues/27
*/
public function testParsesValueTitleDatetimes() {
$input = <<<EOT
<div class="h-entry">
<h1 class="p-name">test</h1>
<span class="dt-published"><span class="value-title" title="2012-02-16T16:14:47+00:00"> </span>16.02.2012</span>
</div>
EOT;
$parser = new Parser($input);
$output = $parser->parse();
$this->assertEquals('2012-02-16T16:14:47+00:00', $output['items'][0]['properties']['published'][0]);
}
/** @see https://github.com/indieweb/php-mf2/issues/34 */
public function testIgnoresValueClassNestedFurtherThanChild() {
$test = '<div class="h-card"><span class="p-tel"><span class="value">1234</span><span class="h-card"><span class="p-tel"><span class="value">5678</span>';
$result = Mf2\parse($test);
$this->assertEquals('1234', $result['items'][0]['properties']['tel'][0]);
$this->assertEquals('5678', $result['items'][0]['children'][0]['properties']['tel'][0]);
}
/** @see https://github.com/indieweb/php-mf2/issues/38 */
public function testValueClassDtMatchesSingleDigitTimeComponent() {
$test = '<div class="h-entry"><span class="dt-published"><time class="value">6:01</time>, <time class="value">2013-02-01</time></span></div>';
$result = Mf2\parse($test);
$this->assertEquals('2013-02-01T6:01', $result['items'][0]['properties']['published'][0]);
}
}

317
vendor/mf2/mf2/tests/Mf2/ParserTest.php vendored Normal file
View file

@ -0,0 +1,317 @@
<?php
namespace Mf2\Parser\Test;
use Mf2\Parser;
use Mf2;
use PHPUnit_Framework_TestCase;
/**
* Parser Test
*
* Contains tests for internal parsing functions and stuff which doesnt go anywhere else, i.e.
* isnt related to a particular property as such.
*
* Stuff for parsing E goes in here until there is enough of it to go elsewhere (like, never?)
*/
class ParserTest extends PHPUnit_Framework_TestCase {
public function setUp() {
date_default_timezone_set('Europe/London');
}
public function testUnicodeTrim() {
$this->assertEquals('thing', Mf2\unicodeTrim(' thing '));
$this->assertEquals('thing', Mf2\unicodeTrim(' thing '));
$this->assertEquals('thing', Mf2\unicodeTrim(mb_convert_encoding(' &nbsp; thing &nbsp; ', 'UTF-8', 'HTML-ENTITIES') ));
}
public function testMicroformatNameFromClassReturnsFullRootName() {
$expected = array('h-card');
$actual = Mf2\mfNamesFromClass('someclass h-card someotherclass', 'h-');
$this->assertEquals($expected, $actual);
}
public function testMicroformatNameFromClassHandlesMultipleHNames() {
$expected = array('h-card', 'h-person');
$actual = Mf2\mfNamesFromClass('someclass h-card someotherclass h-person yetanotherclass', 'h-');
$this->assertEquals($expected, $actual);
}
public function testMicroformatStripsPrefixFromPropertyClassname() {
$expected = array('name');
$actual = Mf2\mfNamesFromClass('someclass p-name someotherclass', 'p-');
$this->assertEquals($expected, $actual);
}
public function testNestedMicroformatPropertyNameWorks() {
$expected = array('location' => array('p-'), 'author' => array('u-', 'p-'));
$test = 'someclass p-location someotherclass u-author p-author';
$actual = Mf2\nestedMfPropertyNamesFromClass($test);
$this->assertEquals($expected, $actual);
}
public function testMicroformatNamesFromClassIgnoresPrefixesWithoutNames() {
$expected = array();
$actual = Mf2\mfNamesFromClass('someclass h- someotherclass', 'h-');
$this->assertEquals($expected, $actual);
}
public function testMicroformatNamesFromClassHandlesExcessiveWhitespace() {
$expected = array('h-card');
$actual = Mf2\mfNamesFromClass(' someclass
h-card someotherclass ', 'h-');
$this->assertEquals($expected, $actual);
}
public function testMicroformatNamesFromClassIgnoresUppercaseClassnames() {
$expected = array();
$actual = Mf2\mfNamesFromClass('H-ENTRY', 'h-');
$this->assertEquals($expected, $actual);
}
public function testParseE() {
$input = '<div class="h-entry"><div class="e-content">Here is a load of <strong>embedded markup</strong></div></div>';
//$parser = new Parser($input);
$output = Mf2\parse($input);
$this->assertArrayHasKey('content', $output['items'][0]['properties']);
$this->assertEquals('Here is a load of <strong>embedded markup</strong>', $output['items'][0]['properties']['content'][0]['html']);
$this->assertEquals('Here is a load of embedded markup', $output['items'][0]['properties']['content'][0]['value']);
}
public function testParseEResolvesRelativeLinks() {
$input = '<div class="h-entry"><p class="e-content">Blah blah <a href="/a-url">thing</a>. <object data="/object"></object> <img src="/img" /></p></div>';
$parser = new Parser($input, 'http://example.com');
$output = $parser->parse();
$this->assertEquals('Blah blah <a href="http://example.com/a-url">thing</a>. <object data="http://example.com/object"></object> <img src="http://example.com/img"></img>', $output['items'][0]['properties']['content'][0]['html']);
$this->assertEquals('Blah blah thing. http://example.com/img', $output['items'][0]['properties']['content'][0]['value']);
}
/**
* @group parseH
*/
public function testInvalidClassnamesContainingHAreIgnored() {
$input = '<div class="asdfgh-jkl"></div>';
$parser = new Parser($input);
$output = $parser->parse();
// Look through $output for an item which indicate failure
foreach ($output['items'] as $item) {
if (in_array('asdfgh-jkl', $item['type']))
$this->fail();
}
}
public function testHtmlSpecialCharactersWorks() {
$this->assertEquals('&lt;&gt;', htmlspecialchars('<>'));
}
public function testHtmlEncodesNonEProperties() {
$input = '<div class="h-card">
<span class="p-name">&lt;p&gt;</span>
<span class="dt-published">&lt;dt&gt;</span>
<span class="u-url">&lt;u&gt;</span>
</div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertEquals('<p>', $output['items'][0]['properties']['name'][0]);
$this->assertEquals('<dt>', $output['items'][0]['properties']['published'][0]);
$this->assertEquals('<u>', $output['items'][0]['properties']['url'][0]);
}
public function testHtmlEncodesImpliedProperties() {
$input = '<a class="h-card" href="&lt;url&gt;"><img src="&lt;img&gt;" />&lt;name&gt;</a>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertEquals('<name>', $output['items'][0]['properties']['name'][0]);
$this->assertEquals('<url>', $output['items'][0]['properties']['url'][0]);
$this->assertEquals('<img>', $output['items'][0]['properties']['photo'][0]);
}
public function testParsesRelValues() {
$input = '<a rel="author" href="http://example.com">Mr. Author</a>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('rels', $output);
$this->assertEquals('http://example.com', $output['rels']['author'][0]);
}
public function testParsesRelAlternateValues() {
$input = '<a rel="alternate home" href="http://example.org" hreflang="de", media="screen" type="text/html" title="German Homepage Link">German Homepage</a>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayHasKey('alternates', $output);
$this->assertEquals('http://example.org', $output['alternates'][0]['url']);
$this->assertEquals('home', $output['alternates'][0]['rel']);
$this->assertEquals('de', $output['alternates'][0]['hreflang']);
$this->assertEquals('screen', $output['alternates'][0]['media']);
$this->assertEquals('text/html', $output['alternates'][0]['type']);
$this->assertEquals('German Homepage Link', $output['alternates'][0]['title']);
$this->assertEquals('German Homepage', $output['alternates'][0]['text']);
}
public function testParseFromIdOnlyReturnsMicroformatsWithinThatId() {
$input = <<<EOT
<div class="h-entry"><span class="p-name">Not Included</span></div>
<div id="parse-here">
<span class="h-card">Included</span>
</div>
<div class="h-entry"><span class="p-name">Not Included</span></div>
EOT;
$parser = new Parser($input);
$output = $parser->parseFromId('parse-here');
$this->assertCount(1, $output['items']);
$this->assertEquals('Included', $output['items'][0]['properties']['name'][0]);
}
/**
* Issue #21 github.com/indieweb/php-mf2/issues/21
*/
public function testDoesntAddArraysWithOnlyValueForAlreadyParsedNestedMicroformats() {
$input = <<<EOT
<div class="h-entry">
<div class="p-in-reply-to h-entry">
<span class="p-author h-card">Nested Author</span>
</div>
<span class="p-author h-card">Real Author</span>
</div>
EOT;
$parser = new Parser($input);
$output = $parser->parse();
$this->assertCount(1, $output['items'][0]['properties']['author']);
}
public function testParsesNestedMicroformatsWithClassnamesInAnyOrder() {
$input = <<<EOT
<div class="h-entry">
<div class="note- p-in-reply-to h-entry">Name</div>
</div>
EOT;
$parser = new Parser($input);
$output = $parser->parse();
$this->assertCount(1, $output['items'][0]['properties']['in-reply-to']);
$this->assertEquals('Name', $output['items'][0]['properties']['in-reply-to'][0]['properties']['name'][0]);
}
/**
* @group network
*/
public function testFetchMicroformats() {
$mf = Mf2\fetch('http://waterpigs.co.uk/');
$this->assertArrayHasKey('items', $mf);
$mf = Mf2\fetch('http://waterpigs.co.uk/photo.jpg', null, $curlInfo);
$this->assertNull($mf);
$this->assertContains('jpeg', $curlInfo['content_type']);
}
/**
* @see https://github.com/indieweb/php-mf2/issues/48
*/
public function testIgnoreClassesEndingInHyphen() {
$input = '<span class="h-entry"> <span class="e-">foo</span> </span>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayNotHasKey('0', $output['items'][0]['properties']);
}
/**
* @see https://github.com/indieweb/php-mf2/issues/52
* @see https://github.com/tommorris/mf2py/commit/92740deb7e19b8f1e7fbf6bec001cf52f2b07e99
*/
public function testIgnoresTemplateElements() {
$result = Mf2\parse('<template class="h-card"><span class="p-name">Tom Morris</span></template>');
$this->assertCount(0, $result['items']);
}
/**
* @see https://github.com/indieweb/php-mf2/issues/53
* @see http://microformats.org/wiki/microformats2-parsing#parsing_an_e-_property
*/
public function testConvertsNestedImgElementToAltOrSrc() {
$input = <<<EOT
<div class="h-entry">
<p class="e-content">It is a strange thing to see a <img alt="five legged elephant" src="/photos/five-legged-elephant.jpg" /></p>
</div>
EOT;
$result = Mf2\parse($input, 'http://waterpigs.co.uk/articles/five-legged-elephant');
$this->assertEquals('It is a strange thing to see a five legged elephant', $result['items'][0]['properties']['content'][0]['value']);
}
// parser not respecting not[h-*] in rule "else if .h-x>a[href]:only-of-type:not[.h-*] then use that [href] for url"
public function testNotImpliedUrlFromHCard() {
$input = <<<EOT
<span class="h-entry">
<a class="h-card" href="http://test.com">John Q</a>
</span>
EOT;
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayNotHasKey('url', $output['items'][0]['properties']);
}
public function testAreaTag() {
$input = <<<EOT
<div class="h-entry">
<area class="p-category h-card" href="http://personB.example.com" alt="Person Bee" shape="rect" coords="100,100,120,120">
</div>
EOT;
$parser = new Parser($input);
$output = $parser->parse();
$this->assertEquals('', $output['items'][0]['properties']['name'][0]);
$this->assertEquals('rect', $output['items'][0]['properties']['category'][0]['shape']);
$this->assertEquals('100,100,120,120', $output['items'][0]['properties']['category'][0]['coords']);
$this->assertEquals('Person Bee', $output['items'][0]['properties']['category'][0]['value']);
}
public function testParseHcardInCategory() {
$input = <<<EOT
<span class="h-entry">
<a class="p-author h-card" href="http://a.example.com/">Alice</a> tagged
<a href="http://b.example.com/" class="u-category h-card">Bob Smith</a> in
<a class="u-tag-of u-in-reply-to" href="http://s.example.com/permalink47">
<img src="http://s.example.com/photo47.png" alt="a photo of Bob and Cole" />
</a>
</span>
EOT;
$parser = new Parser($input);
$output = $parser->parse();
$this->assertContains('h-entry', $output['items'][0]['type']);
$this->assertArrayHasKey('category', $output['items'][0]['properties']);
$this->assertContains('h-card', $output['items'][0]['properties']['category'][0]['type']);
$this->assertArrayHasKey('name', $output['items'][0]['properties']['category'][0]['properties']);
$this->assertEquals('Bob Smith', $output['items'][0]['properties']['category'][0]['properties']['name'][0]);
$this->assertArrayHasKey('url', $output['items'][0]['properties']['category'][0]['properties']);
$this->assertEquals('http://b.example.com/', $output['items'][0]['properties']['category'][0]['properties']['url'][0]);
}
}

296
vendor/mf2/mf2/tests/Mf2/URLTest.php vendored Normal file
View file

@ -0,0 +1,296 @@
<?php
/**
* Tests of the URL resolver within mf2\Parser
*/
namespace Mf2\Parser\Test;
use Mf2;
use PHPUnit_Framework_TestCase;
class UrlTest extends PHPUnit_Framework_TestCase {
public function setUp() {
date_default_timezone_set('Europe/London');
}
public function testRemoveLeadingDotSlash() {
$input = '../one/two';
mf2\removeLeadingDotSlash($input);
$this->assertEquals('one/two', $input);
$input = './one/two';
mf2\removeLeadingDotSlash($input);
$this->assertEquals('one/two', $input);
}
public function testRemoveLeadingSlashDot() {
$input = '/./one/two';
mf2\removeLeadingSlashDot($input);
$this->assertEquals('/one/two', $input);
$input = '/.';
mf2\removeLeadingSlashDot($input);
$this->assertEquals('/', $input);
$input = '/./../';
mf2\removeLeadingSlashDot($input);
$this->assertEquals('/../', $input);
$input = '/./../../g';
mf2\removeLeadingSlashDot($input);
$this->assertEquals('/../../g', $input);
}
public function testRemoveOneDirLevel() {
$input = '/../../g';
$output = '/a/b/c';
mf2\removeOneDirLevel($input, $output);
$this->assertEquals('/../g', $input);
$this->assertEquals('/a/b', $output);
$input = '/..';
$output = '/a/b/c';
mf2\removeOneDirLevel($input, $output);
$this->assertEquals('/', $input);
$this->assertEquals('/a/b', $output);
}
public function testRemoveLoneDotDot() {
$input = '.';
mf2\removeLoneDotDot($input);
$this->assertEquals('', $input);
$input = '..';
mf2\removeLoneDotDot($input);
$this->assertEquals('', $input);
}
public function testMoveOneSegmentFromInput() {
$input = '/a/b/c/./../../g';
$output = '';
mf2\moveOneSegmentFromInput($input, $output);
$this->assertEquals('/b/c/./../../g', $input);
$this->assertEquals('/a', $output);
$input = '/b/c/./../../g';
$output = '/a';
mf2\moveOneSegmentFromInput($input, $output);
$this->assertEquals('/c/./../../g', $input);
$this->assertEquals('/a/b', $output);
$input = '/c/./../../g';
$output = '/a/b';
mf2\moveOneSegmentFromInput($input, $output);
$this->assertEquals('/./../../g', $input);
$this->assertEquals('/a/b/c', $output);
$input = '/g';
$output = '/a';
mf2\moveOneSegmentFromInput($input, $output);
$this->assertEquals('', $input);
$this->assertEquals('/a/g', $output);
}
/**
* @dataProvider removeDotSegmentsData
*/
public function testRemoveDotSegments($assert, $path, $expected) {
$actual = mf2\removeDotSegments($path);
$this->assertEquals($expected, $actual, $assert);
}
public function removeDotSegmentsData() {
return array(
array('Should remove .. and .',
'/a/b/c/./../../g', '/a/g'),
array('Should remove ../..',
'/a/b/c/d/../../../g', '/a/g'),
array('Should not add leading slash',
'a/b/c', 'a/b/c'),
);
}
public function testNoPathOnBase() {
$actual = mf2\resolveUrl('http://example.com', '');
$this->assertEquals('http://example.com/', $actual);
$actual = mf2\resolveUrl('http://example.com', '#');
$this->assertEquals('http://example.com/#', $actual);
$actual = mf2\resolveUrl('http://example.com', '#thing');
$this->assertEquals('http://example.com/#thing', $actual);
}
public function testMisc() {
$expected = 'http://a/b/c/g';
$actual = mf2\resolveUrl('http://a/b/c/d;p?q', './g');
$this->assertEquals($expected, $actual);
$expected = 'http://a/b/c/g/';
$actual = mf2\resolveUrl('http://a/b/c/d;p?q', './g/');
$this->assertEquals($expected, $actual);
$expected = 'http://a/b/';
$actual = mf2\resolveUrl('http://a/b/c/d;p?q', '..');
$this->assertEquals($expected, $actual);
}
/** as per https://github.com/indieweb/php-mf2/issues/35 */
public function testResolvesProtocolRelativeUrlsCorrectly() {
$expected = 'http://cdn.example.org/thing/asset.css';
$actual = Mf2\resolveUrl('http://example.com', '//cdn.example.org/thing/asset.css');
$this->assertEquals($expected, $actual);
$expected = 'https://cdn.example.org/thing/asset.css';
$actual = Mf2\resolveUrl('https://example.com', '//cdn.example.org/thing/asset.css');
$this->assertEquals($expected, $actual);
}
/**
* @dataProvider testData
*/
public function testReturnsUrlIfAbsolute($assert, $base, $url, $expected) {
$actual = mf2\resolveUrl($base, $url);
$this->assertEquals($expected, $actual, $assert);
}
public function testData() {
// seriously, please update to PHP 5.4 so I can use nice array syntax ;)
// fail message, base, url, expected
$cases = array(
array('Should return absolute URL unchanged',
'http://example.com', 'http://example.com', 'http://example.com'),
array('Should return root given blank path',
'http://example.com', '', 'http://example.com/'),
array('Should return input unchanged given full URL and blank path',
'http://example.com/something', '', 'http://example.com/something'),
array('Should handle blank base URL',
'', 'http://example.com', 'http://example.com'),
array('Should resolve fragment ID',
'http://example.com', '#thing', 'http://example.com/#thing'),
array('Should resolve blank fragment ID',
'http://example.com', '#', 'http://example.com/#'),
array('Should resolve same level URL',
'http://example.com', 'thing', 'http://example.com/thing'),
array('Should resolve directory level URL',
'http://example.com', './thing', 'http://example.com/thing'),
array('Should resolve parent level URL at root level',
'http://example.com', '../thing', 'http://example.com/thing'),
array('Should resolve nested URL',
'http://example.com/something', 'another', 'http://example.com/another'),
array('Should ignore query strings in base url',
'http://example.com/index.php?url=http://example.org', '/thing', 'http://example.com/thing'),
array('Should resolve query strings',
'http://example.com/thing', '?stuff=yes', 'http://example.com/thing?stuff=yes'),
array('Should resolve dir level query strings',
'http://example.com', './?thing=yes', 'http://example.com/?thing=yes'),
array('Should resolve up one level from root domain',
'http://example.com', 'path/to/the/../file', 'http://example.com/path/to/file'),
array('Should resolve up one level from base with path',
'http://example.com/path/the', 'to/the/../file', 'http://example.com/path/to/file'),
// Tests from webignition library
array('relative add host from base',
'http://www.example.com', 'server.php', 'http://www.example.com/server.php'),
array('relative add scheme host user from base',
'http://user:@www.example.com', 'server.php', 'http://user:@www.example.com/server.php'),
array('relative add scheme host pass from base',
'http://:pass@www.example.com', 'server.php', 'http://:pass@www.example.com/server.php'),
array('relative add scheme host user pass from base',
'http://user:pass@www.example.com', 'server.php', 'http://user:pass@www.example.com/server.php'),
array('relative base has file path',
'http://example.com/index.html', 'example.html', 'http://example.com/example.html'),
array('input has absolute path',
'http://www.example.com/pathOne/pathTwo/pathThree', '/server.php?param1=value1', 'http://www.example.com/server.php?param1=value1'),
array('test absolute url with path',
'http://www.example.com/', 'http://www.example.com/pathOne', 'http://www.example.com/pathOne'),
array('testRelativePathIsTransformedIntoCorrectAbsoluteUrl',
'http://www.example.com/pathOne/pathTwo/pathThree', 'server.php?param1=value1', 'http://www.example.com/pathOne/pathTwo/server.php?param1=value1'),
array('testAbsolutePathHasDotDotDirecoryAndSourceHasFileName',
'http://www.example.com/pathOne/index.php', '../jquery.js', 'http://www.example.com/jquery.js'),
array('testAbsolutePathHasDotDotDirecoryAndSourceHasDirectoryWithTrailingSlash',
'http://www.example.com/pathOne/', '../jquery.js', 'http://www.example.com/jquery.js'),
array('testAbsolutePathHasDotDotDirecoryAndSourceHasDirectoryWithoutTrailingSlash',
'http://www.example.com/pathOne', '../jquery.js', 'http://www.example.com/jquery.js'),
array('testAbsolutePathHasDotDirecoryAndSourceHasFilename',
'http://www.example.com/pathOne/index.php', './jquery.js', 'http://www.example.com/pathOne/jquery.js'),
array('testAbsolutePathHasDotDirecoryAndSourceHasDirectoryWithTrailingSlash',
'http://www.example.com/pathOne/', './jquery.js', 'http://www.example.com/pathOne/jquery.js'),
array('testAbsolutePathHasDotDirecoryAndSourceHasDirectoryWithoutTrailingSlash',
'http://www.example.com/pathOne', './jquery.js', 'http://www.example.com/jquery.js'),
array('testAbsolutePathIncludesPortNumber',
'http://example.com:8080/index.html', '/photo.jpg', 'http://example.com:8080/photo.jpg')
);
// Test cases from RFC
// http://tools.ietf.org/html/rfc3986#section-5.4
$rfcTests = array(
array("g:h", "g:h"),
array("g", "http://a/b/c/g"),
array("./g", "http://a/b/c/g"),
array("g/", "http://a/b/c/g/"),
array("/g", "http://a/g"),
array("//g", "http://g"),
array("?y", "http://a/b/c/d;p?y"),
array("g?y", "http://a/b/c/g?y"),
array("#s", "http://a/b/c/d;p?q#s"),
array("g#s", "http://a/b/c/g#s"),
array("g?y#s", "http://a/b/c/g?y#s"),
array(";x", "http://a/b/c/;x"),
array("g;x", "http://a/b/c/g;x"),
array("g;x?y#s", "http://a/b/c/g;x?y#s"),
array("", "http://a/b/c/d;p?q"),
array(".", "http://a/b/c/"),
array("./", "http://a/b/c/"),
array("..", "http://a/b/"),
array("../", "http://a/b/"),
array("../g", "http://a/b/g"),
array("../..", "http://a/"),
array("../../", "http://a/"),
array("../../g", "http://a/g")
);
foreach($rfcTests as $i=>$test) {
$cases[] = array(
'test rfc ' . $i, 'http://a/b/c/d;p?q', $test[0], $test[1]
);
}
return $cases;
}
}

View file

@ -0,0 +1,3 @@
<?php
require dirname(__DIR__) . '/../vendor/autoload.php';

View file

@ -0,0 +1,286 @@
<!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" lang="en-US">
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" lang="en-US">
<![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!-->
<html lang="en-US">
<!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>fberriman | a blog for frances</title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="http://fberriman.com/xmlrpc.php">
<!--[if lt IE 9]>
<script src="http://fberriman.com/wp-content/themes/twentythirteen/js/html5.js"></script>
<![endif]-->
<link rel="alternate" type="application/rss+xml" title="fberriman &raquo; Feed" href="http://fberriman.com/feed/" />
<link rel="alternate" type="application/rss+xml" title="fberriman &raquo; Comments Feed" href="http://fberriman.com/comments/feed/" />
<link rel='stylesheet' id='twentythirteen-fonts-css' href='//fonts.googleapis.com/css?family=Source+Sans+Pro%3A300%2C400%2C700%2C300italic%2C400italic%2C700italic%7CBitter%3A400%2C700&#038;subset=latin%2Clatin-ext' type='text/css' media='all' />
<link rel='stylesheet' id='genericons-css' href='http://fberriman.com/wp-content/themes/twentythirteen/fonts/genericons.css?ver=2.09' type='text/css' media='all' />
<link rel='stylesheet' id='twentythirteen-style-css' href='http://fberriman.com/wp-content/themes/twentythirteen/style.css?ver=2013-07-18' type='text/css' media='all' />
<!--[if lt IE 9]>
<link rel='stylesheet' id='twentythirteen-ie-css' href='http://fberriman.com/wp-content/themes/twentythirteen/css/ie.css?ver=2013-07-18' type='text/css' media='all' />
<![endif]-->
<script type='text/javascript' src='http://fberriman.com/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>
<script type='text/javascript' src='http://fberriman.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://fberriman.com/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://fberriman.com/wp-includes/wlwmanifest.xml" />
<meta name="generator" content="WordPress 3.6" />
<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
<style type="text/css" id="twentythirteen-header-css">
.site-header {
background: url(http://fberriman.com/wp-content/themes/twentythirteen/images/headers/star.png) no-repeat scroll top;
background-size: 1600px auto;
}
.site-title,
.site-description {
color: #000000;
}
</style>
</head>
<body class="home blog single-author sidebar">
<div id="page" class="hfeed site">
<header id="masthead" class="site-header" role="banner">
<a class="home-link" href="http://fberriman.com/" title="fberriman" rel="home">
<h1 class="site-title">fberriman</h1>
<h2 class="site-description">a blog for frances</h2>
</a>
<div id="navbar" class="navbar">
<nav id="site-navigation" class="navigation main-navigation" role="navigation">
<h3 class="menu-toggle">Menu</h3>
<a class="screen-reader-text skip-link" href="#content" title="Skip to content">Skip to content</a>
<div class="nav-menu"><ul><li class="page_item page-item-11"><a href="http://fberriman.com/about-me/">About me</a></li><li class="page_item page-item-151"><a href="http://fberriman.com/portfolio/">Hire me</a></li></ul></div>
<form role="search" method="get" class="search-form" action="http://fberriman.com/">
<label>
<span class="screen-reader-text">Search for:</span>
<input type="search" class="search-field" placeholder="Search &hellip;" value="" name="s" title="Search for:" />
</label>
<input type="submit" class="search-submit" value="Search" />
</form> </nav><!-- #site-navigation -->
</div><!-- #navbar -->
</header><!-- #masthead -->
<div id="main" class="site-main">
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<article id="post-976" class="post-976 post type-post status-publish format-standard hentry category-speaking category-web-dev tag-conferences tag-front-trends tag-fronttrends tag-speaking tag-txjs">
<header class="entry-header">
<h1 class="entry-title">
<a href="http://fberriman.com/2013/05/14/april-recap-txjs-front-trends/" rel="bookmark">April recap &#8211; TXJS &#038; Front-Trends</a>
</h1>
<div class="entry-meta">
<span class="date"><a href="http://fberriman.com/2013/05/14/april-recap-txjs-front-trends/" title="Permalink to April recap &#8211; TXJS &amp; Front-Trends" rel="bookmark"><time class="entry-date" datetime="2013-05-14T11:54:06+00:00">May 14, 2013</time></a></span><span class="categories-links"><a href="http://fberriman.com/category/speaking/" title="View all posts in Speaking" rel="category tag">Speaking</a>, <a href="http://fberriman.com/category/web-dev/" title="View all posts in Web Dev" rel="category tag">Web Dev</a></span><span class="tags-links"><a href="http://fberriman.com/tag/conferences/" rel="tag">conferences</a>, <a href="http://fberriman.com/tag/front-trends/" rel="tag">front-trends</a>, <a href="http://fberriman.com/tag/fronttrends/" rel="tag">fronttrends</a>, <a href="http://fberriman.com/tag/speaking/" rel="tag">Speaking</a>, <a href="http://fberriman.com/tag/txjs/" rel="tag">txjs</a></span><span class="author vcard"><a class="url fn n" href="http://fberriman.com/author/admin/" title="View all posts by Frances" rel="author">Frances</a></span> </div><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="entry-content">
<p>April was pretty decent. I got to attend two very good conferences <strong>and</strong> I got to speak at them. </p>
<h2><a href="http://2013.texasjavascript.com/">TXJS</a>, Austin, USA</h2>
<p>Austin! One of my favourite cities (mostly because <a href="http://www.flickr.com/photos/phae_/8649913228/in/photostream">I love tacos</a>). Was very pleased to be asked to return to this conference after I spoke there <a href="http://fberriman.com/2012/06/14/designing-better-user-experiences-txjs-2012/">last year</a>. The day was remarkable, if only because it&#8217;s one of the first conferences in a very long time where I actually watched all of the talks (although <a href="http://rmurphey.com/">Rebecca</a>, being on before me, may have only had half of my attention). Really a very well curated day, and I felt very lucky to be in the line-up.</p>
<p><a href="http://alexsexton.com/">Alex</a> was not overly prescriptive in what I should talk about, but suggested he liked the content of last year and would like a little more on that. So, I decided to pick an aspect about that that I felt was important to us at <a href="http://digital.cabinetoffice.gov.uk">GDS</a> and fundamental to the success of our <a href="https://www.gov.uk/designprinciples">Design Principles</a>.</p>
<p>For me, it&#8217;s been our honesty and simple language. The words that we&#8217;ve used to talk about user needs, technical aspects of the site and the ethos have been plain and no-nonsense. I think this is hugely down to the strength of a team that has the confidence to cut through bullshit and say what it really means &#8211; <a href="http://russelldavies.typepad.com">Russell</a> and <a href="http://twitter.com/escmum">Sarah</a> are particularly brilliant at this, and have had huge parts to play in getting this cult of simple down in writing.</p>
<p>The tech scene is sort of rife with nonsense words. Buzzwords and clichés and the new name for the next big thing, which is actually the new name for the same old sensible thing &#8211; but with better marketing and a twitter hashtag. Ugh. I want a lot less of that in our world.</p>
<p>So, I picked on a few of these and showed a few examples from how we&#8217;re dealing with them at GDS. I believe the video for that talk is out now, but <a href="https://speakerdeck.com/phae/culture-change-for-creating-better-user-experiences">the slides are here</a>.</p>
<h2><a href="2013.front-trends.com">Front-Trends</a>, Warsaw, Poland</h2>
<p>I attended this conference last year &#8211; definitely a favourite for its surprisingly sunny weather and for being one of the most friendly events I had been to in 2012. So, I was really glad to get to come back and share our Design Principles with the crowd. </p>
<p>It was very similar to the talk I gave at TXJS last year, except we&#8217;ve done a whole lot more at GDS since June of last year &#8211; we released v1.0 of <a href="http://www.gov.uk">gov.uk</a>, and a bunch of other stuff like the <a href="http://www.gov.uk/performance">performance platform</a>, <a href="http://www.gov.uk/government">Inside Government</a> (and the <a href="http://digital.cabinetoffice.gov.uk/2013/04/30/24-departments-later/">24 departments</a>) and <a href="http://digital.cabinetoffice.gov.uk/2013/03/25/fco-travel-services-check-in/">foreign travel advice</a>, to name a few. I showcased some of these things, and then went through the design principles with the lovely, receptive, Polish audience and it seemed to go over rather well. The slides for this <a href="https://speakerdeck.com/phae/culture-change-how-to-make-better-user-experiences-a-priority-in-your-organisation">version of the talk are here</a>.</p>
<p>Three days are a lot for a conference, but it was really high quality through-out and the breadth of subjects was really great. I wouldn&#8217;t recommend putting the party on the second night again, however &#8211; that last morning was something of a challenge. :)</p>
</div><!-- .entry-content -->
<footer class="entry-meta">
<div class="comments-link">
<a href="http://fberriman.com/2013/05/14/april-recap-txjs-front-trends/#respond" title="Comment on April recap &#8211; TXJS &amp; Front-Trends"><span class="leave-reply">Leave a comment</span></a> </div><!-- .comments-link -->
</footer><!-- .entry-meta -->
</article><!-- #post -->
<article id="post-959" class="post-959 post type-post status-publish format-standard hentry category-life tag-data-tracking tag-jawbone tag-review tag-up">
<header class="entry-header">
<h1 class="entry-title">
<a href="http://fberriman.com/2013/05/08/jawbone-up-review/" rel="bookmark">Jawbone Up Review</a>
</h1>
<div class="entry-meta">
<span class="date"><a href="http://fberriman.com/2013/05/08/jawbone-up-review/" title="Permalink to Jawbone Up Review" rel="bookmark"><time class="entry-date" datetime="2013-05-08T13:34:21+00:00">May 8, 2013</time></a></span><span class="categories-links"><a href="http://fberriman.com/category/life/" title="View all posts in Life" rel="category tag">Life</a></span><span class="tags-links"><a href="http://fberriman.com/tag/data-tracking/" rel="tag">data tracking</a>, <a href="http://fberriman.com/tag/jawbone/" rel="tag">jawbone</a>, <a href="http://fberriman.com/tag/review/" rel="tag">review</a>, <a href="http://fberriman.com/tag/up/" rel="tag">up</a></span><span class="author vcard"><a class="url fn n" href="http://fberriman.com/author/admin/" title="View all posts by Frances" rel="author">Frances</a></span> </div><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="entry-content">
<p>I&#8217;ve had a fair few people ask about the <a href="https://jawbone.com/up">Jawbone Up</a> I&#8217;ve been wearing since November (the second version, not the recalled first one &#8211; although, as you&#8217;ll read, perhaps this one should have been too). Here&#8217;s how I&#8217;ve found it.</p>
<h3>The good</h3>
<p>The reason I waited on the Up, over say the <a href="http://www.nike.com/us/en_us/c/nikeplus-fuelband">Nike Fuelband</a>, was because I wanted a wrist-wearable tracker <em>plus</em> sleep data. The <a href="http://www.fitbit.com/uk/one">FitBit One</a> has a wearable night-time band, but it looks rather large and cumbersome and I didn&#8217;t want a clothes-clip tracker in the day time (where do dress wearers clip them?).</p>
<p><a href="http://www.flickr.com/photos/phae_/8241147038/"><img class="alignleft" alt="Jawbone Up" src="http://farm9.staticflickr.com/8479/8241147038_46f04ae51b_m.jpg" width="240" height="240" /></a></p>
<p>The Up band&#8217;s size is really good and it&#8217;s comfy and it doesn&#8217;t look ridiculous.</p>
<p>I like the sleep tracking, although I feel like it&#8217;s not terribly accurate &#8211; if I wake and don&#8217;t move around much, it doesn&#8217;t record it as a waking period &#8211; but it&#8217;s accurate enough to collect the information I&#8217;m interested in.</p>
<p>I have been a bad sleeper for a long time, but having actual data about the length of time I&#8217;ve been asleep and awake has helped reduce my anxiety about a bad night&#8217;s sleep (it always feels like a lifetime when you&#8217;re awake in the middle of the night and don&#8217;t want to be &#8211; but turns out it isn&#8217;t), which in turn has helped improve how well I go to sleep generally, I think.</p>
<p>I also like the smart-alarm &#8211; before I&#8217;d put off looking at the clock to see the time, but the gentle nudge that, yes, it is about time I got up is really useful, and again, anxiety reducing.</p>
<p>The steps tracking seems fine. I&#8217;ve never bothered to calibrate it, since I don&#8217;t do much exercise except walking &#8211; but it seems to match the distances I do regularly around the city. It&#8217;s fun &#8211; I&#8217;m not competing, so it&#8217;s mostly just interesting. I hear from others that it basically can&#8217;t cope with running or cycling, though.</p>
<h3>The bad</h3>
<p>It broke. <em>Twice</em>. The first time, it broke after about 6 weeks &#8211; the vibration feature (needed for the smart-alarm and idle alert) just stopped working for no apparent reason. At the time, the Up band wasn&#8217;t out in the UK, so Jawbone were not willing to replace it (ugh) but when I said I&#8217;d be in New York for a week, they agreed to courier me a replacement to the Google office there while I was in town &#8211; which I think was really just a nice act on the part of one very good customer service rep I&#8217;d met on the support forums. Had I not been on the forum or nagged on twitter, I suspect I&#8217;d have been left out of pocket.</p>
<p>Unfortunately, the second band stopped working a couple of months later. The smart-alarm feature became temperamental and often wouldn&#8217;t go off at all, and the button on the end of the band had become dislodged and no longer clicked. This time, the band was out in the UK, and they sent me another one immediately.</p>
<p>I&#8217;ve been wearing the third one for about a week and I honestly expect it&#8217;ll break soon, too, sadly. <a href="http://e26.co.uk/" rel="friend met colleague">Edd</a>, who originally picked up my first band for me while he was in New York, had his first and second bands break too (the second after only 2 weeks) &#8211; so the statistical data I have available to me is not very favourable and a quick look through the forums will find most people in similar situations.</p>
<h3>The other stuff</h3>
<p>They just released third-party app integration, but sadly on iOS devices only (I use a Nexus 4 day to day, so syncing with an iOS device is an extra annoyance if I want to use those features). I expect that&#8217;ll help make the data the band is recording more interesting.</p>
<p>Otherwise, these are things I wish it had:</p>
<ul>
<li>A visible metre or <strong>something</strong> on the band. I have to sync it with my phone to find out how I&#8217;m doing. It doesn&#8217;t even tell me the time. I feel like it&#8217;s not providing me with much in return for the space it&#8217;s taking up on my wrist.</li>
<li>There&#8217;s no web view &#8211; the only way to share the data is through facebook (meh) or if your friend is also an Up user (which is basically no one). I&#8217;d like to be able to let my <a href="http://infrequently.org" rel="spouse met">husband</a> see my sleep data &#8211; then he&#8217;ll know that I&#8217;m just grumpy because I&#8217;m tired. He can sneak a look at it on my phone, I guess, but it would just be nice to have a public view somewhere on the web.</li>
<li>The food and mood logging is boring and pointless. It may be that the new app integration gives this value, but it was onerous and I gave up after a week. The insights offered to you only ever related to steps and sleep, so no matter how much food and mood you logged, it was for your own entertainment only. These features appear to be rather tacked-on.</li>
<li>Some people complain about the lack of wireless sync as a deal-breaker (you sync it via the mic jack). This personally doesn&#8217;t greatly bother me (longer battery life is a reasonable trade), but given that I have to take it off my arm to find out <strong>anything</strong> about it, as mentioned above, then I think it would have been preferential in this case to sync wirelessly.</li>
</ul>
<p>But, these are all minor gripes &#8211; I&#8217;d recommend but for the fact that they clearly have not managed to make a band that doesn&#8217;t expire every 2 months.</p>
<p>I&#8217;m mostly just hoping this band will hold out long enough for the delivery of the <a href="http://www.fitbit.com/uk/flex">Fitbit Flex</a> I just pre-ordered.</p>
<p>Update: My 3rd band has the same smart alarm fault. Sigh.</p>
</div><!-- .entry-content -->
<footer class="entry-meta">
<div class="comments-link">
<a href="http://fberriman.com/2013/05/08/jawbone-up-review/#comments" title="Comment on Jawbone Up Review">One comment so far</a> </div><!-- .comments-link -->
</footer><!-- .entry-meta -->
</article><!-- #post -->
<article id="post-932" class="post-932 post type-post status-publish format-standard hentry category-books category-web-dev category-writing-2 tag-books tag-charity tag-published tag-the-pastry-box-project">
<header class="entry-header">
<h1 class="entry-title">
<a href="http://fberriman.com/2013/01/14/back-the-pastry-box-book/" rel="bookmark">Back the Pastry Box Book</a>
</h1>
<div class="entry-meta">
<span class="date"><a href="http://fberriman.com/2013/01/14/back-the-pastry-box-book/" title="Permalink to Back the Pastry Box Book" rel="bookmark"><time class="entry-date" datetime="2013-01-14T17:58:08+00:00">January 14, 2013</time></a></span><span class="categories-links"><a href="http://fberriman.com/category/books/" title="View all posts in Books" rel="category tag">Books</a>, <a href="http://fberriman.com/category/web-dev/" title="View all posts in Web Dev" rel="category tag">Web Dev</a>, <a href="http://fberriman.com/category/writing-2/" title="View all posts in Writing" rel="category tag">Writing</a></span><span class="tags-links"><a href="http://fberriman.com/tag/books/" rel="tag">Books</a>, <a href="http://fberriman.com/tag/charity/" rel="tag">charity</a>, <a href="http://fberriman.com/tag/published/" rel="tag">published</a>, <a href="http://fberriman.com/tag/the-pastry-box-project/" rel="tag">the pastry box project</a></span><span class="author vcard"><a class="url fn n" href="http://fberriman.com/author/admin/" title="View all posts by Frances" rel="author">Frances</a></span> </div><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="entry-content">
<p><a href="/2012/12/28/baked-posts/">As I mentioned</a>, I wrote for the Pastry Box Project for all of 2012.</p>
<p>Now, it&#8217;s hopefully going to be printed in dead tree form with the royalties going to the <a href="http://www.icrc.org/eng/">Red Cross</a>. That&#8217;s kind of nice, as are many of the fancier offerings at the higher tiers (hand press? illustrations? all sorts!).</p>
<p>So, if you&#8217;re a fan of paper and of the folks that wrote last year, <a href="https://backified.com/pastry-box-2012/project/">the details are all available here</a>. </p>
<p>It&#8217;s being crowd sourced, so it&#8217;ll only be as successful as your interest allows. That&#8217;s how the internet works now, or something.</p>
</div><!-- .entry-content -->
<footer class="entry-meta">
<div class="comments-link">
<a href="http://fberriman.com/2013/01/14/back-the-pastry-box-book/#respond" title="Comment on Back the Pastry Box Book"><span class="leave-reply">Leave a comment</span></a> </div><!-- .comments-link -->
</footer><!-- .entry-meta -->
</article><!-- #post -->
<nav class="navigation paging-navigation" role="navigation">
<h1 class="screen-reader-text">Posts navigation</h1>
<div class="nav-links">
<div class="nav-previous"><a href="http://fberriman.com/page/2/" ><span class="meta-nav">&larr;</span> Older posts</a></div>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
</div><!-- #content -->
</div><!-- #primary -->
<div id="tertiary" class="sidebar-container" role="complementary">
<div class="sidebar-inner">
<div class="widget-area">
<aside id="linkcat-71" class="widget widget_links"><h3 class="widget-title">Me Elsewhere</h3>
<ul class='xoxo blogroll'>
<li><a href="http://www.dopplr.com/traveller/fberriman/public" rel="me" title="My travel plans">Dopplr</a></li>
<li><a href="http://flickr.com/photos/phae_/" rel="me">Flickr</a></li>
<li><a href="https://github.com/phae" rel="me">Github</a></li>
<li><a href="http://thisismyjam.com/phae" rel="me">Jam</a></li>
<li><a href="http://lanyrd.com/people/phae/" rel="me">Lanyrd</a></li>
<li><a href="http://www.last.fm/user/Phae/" rel="me">Last.fm</a></li>
<li><a href="http://www.linkedin.com/in/fberriman" rel="me">LinkedIn</a></li>
<li><a href="https://pictures.lytro.com/phae">Lytro</a></li>
<li><a href="http://oo5.whatiminto.com/peeps/phae" rel="me">oo5</a></li>
<li><a href="http://journal.fberriman.com/">Tumblr</a></li>
<li><a href="http://twitter.com/phae" rel="me">Twitter</a></li>
</ul>
</aside>
<aside id="recent-comments-3" class="widget widget_recent_comments"><h3 class="widget-title">Recent Comments</h3><ul id="recentcomments"><li class="recentcomments"><a href='http://www.siiimplified.com/jawbone-up-second-generation-same-problems/' rel='external nofollow' class='url'>Jawbone Up: Second Generation, Same Problems | Technology : Siiimplified</a> on <a href="http://fberriman.com/2013/05/08/jawbone-up-review/#comment-136683">Jawbone Up Review</a></li><li class="recentcomments"><a href='http://fberriman.com/2013/05/14/april-recap-txjs-front-trends/' rel='external nofollow' class='url'>April recap &#8211; TXJS &amp; Front-Trends | fberriman</a> on <a href="http://fberriman.com/2012/06/14/designing-better-user-experiences-txjs-2012/#comment-97919">Designing better user experiences &#8211; TXJS 2012</a></li><li class="recentcomments"><a href='http://www.nczonline.net/blog/2013/01/21/what-the-nfl-can-teach-us-about-diversity-in-technology/' rel='external nofollow' class='url'>What the NFL can teach us about diversity in technology | NCZOnline</a> on <a href="http://fberriman.com/2013/01/06/conferences-arent-the-problem/#comment-76572">Conferences aren&#8217;t the problem</a></li><li class="recentcomments"><a href='http://fberriman.com/2013/01/14/back-the-pastry-box-book/' rel='external nofollow' class='url'>fberriman &raquo; Back the Pastry Box Book</a> on <a href="http://fberriman.com/2012/12/28/baked-posts/#comment-75476">Baked posts</a></li><li class="recentcomments"><a href='http://www.brucelawson.co.uk/2013/reading-list-36/' rel='external nofollow' class='url'>Bruce Lawson&#8217;s personal site&nbsp; : Reading List</a> on <a href="http://fberriman.com/2013/01/06/conferences-arent-the-problem/#comment-74877">Conferences aren&#8217;t the problem</a></li></ul></aside> </div><!-- .widget-area -->
</div><!-- .sidebar-inner -->
</div><!-- #tertiary -->
</div><!-- #main -->
<footer id="colophon" class="site-footer" role="contentinfo">
<div id="secondary" class="sidebar-container" role="complementary">
<div class="widget-area">
<aside id="linkcat-71" class="widget widget_links"><h3 class="widget-title">Me Elsewhere</h3>
<ul class='xoxo blogroll'>
<li><a href="http://www.dopplr.com/traveller/fberriman/public" rel="me" title="My travel plans">Dopplr</a></li>
<li><a href="http://flickr.com/photos/phae_/" rel="me">Flickr</a></li>
<li><a href="https://github.com/phae" rel="me">Github</a></li>
<li><a href="http://thisismyjam.com/phae" rel="me">Jam</a></li>
<li><a href="http://lanyrd.com/people/phae/" rel="me">Lanyrd</a></li>
<li><a href="http://www.last.fm/user/Phae/" rel="me">Last.fm</a></li>
<li><a href="http://www.linkedin.com/in/fberriman" rel="me">LinkedIn</a></li>
<li><a href="https://pictures.lytro.com/phae">Lytro</a></li>
<li><a href="http://oo5.whatiminto.com/peeps/phae" rel="me">oo5</a></li>
<li><a href="http://journal.fberriman.com/">Tumblr</a></li>
<li><a href="http://twitter.com/phae" rel="me">Twitter</a></li>
</ul>
</aside>
<aside id="categories-4" class="widget widget_categories"><h3 class="widget-title">Categories</h3> <ul>
<li class="cat-item cat-item-114"><a href="http://fberriman.com/category/books/" title="View all posts filed under Books">Books</a>
</li>
<li class="cat-item cat-item-179"><a href="http://fberriman.com/category/craft/" title="View all posts filed under Craft">Craft</a>
</li>
<li class="cat-item cat-item-4"><a href="http://fberriman.com/category/design/" title="View all posts filed under Design">Design</a>
</li>
<li class="cat-item cat-item-150"><a href="http://fberriman.com/category/external-posts/" title="View all posts filed under external posts">external posts</a>
</li>
<li class="cat-item cat-item-115"><a href="http://fberriman.com/category/film/" title="View all posts filed under Film">Film</a>
</li>
<li class="cat-item cat-item-5"><a href="http://fberriman.com/category/games/" title="View all posts filed under Games">Games</a>
</li>
<li class="cat-item cat-item-178"><a href="http://fberriman.com/category/illustration/" title="View all posts filed under Illustration">Illustration</a>
</li>
<li class="cat-item cat-item-6"><a href="http://fberriman.com/category/life/" title="View all posts filed under Life">Life</a>
</li>
<li class="cat-item cat-item-7"><a href="http://fberriman.com/category/microformats/" title="View all posts filed under Microformats">Microformats</a>
</li>
<li class="cat-item cat-item-9"><a href="http://fberriman.com/category/music/" title="View all posts filed under Music">Music</a>
</li>
<li class="cat-item cat-item-10"><a href="http://fberriman.com/category/site/" title="View all posts filed under Site">Site</a>
</li>
<li class="cat-item cat-item-11"><a href="http://fberriman.com/category/speaking/" title="View all posts filed under Speaking">Speaking</a>
</li>
<li class="cat-item cat-item-12"><a href="http://fberriman.com/category/travel/" title="View all posts filed under Travel">Travel</a>
</li>
<li class="cat-item cat-item-13"><a href="http://fberriman.com/category/web-dev/" title="View all posts filed under Web Dev">Web Dev</a>
</li>
<li class="cat-item cat-item-15"><a href="http://fberriman.com/category/website/" title="View all posts filed under Website">Website</a>
</li>
<li class="cat-item cat-item-230"><a href="http://fberriman.com/category/writing-2/" title="View all posts filed under Writing">Writing</a>
</li>
</ul>
</aside><aside id="meta-3" class="widget widget_meta"><h3 class="widget-title">Meta</h3> <ul>
<li><a href="http://fberriman.com/wp-login.php">Log in</a></li>
<li><a href="http://fberriman.com/feed/" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li>
<li><a href="http://fberriman.com/comments/feed/" title="The latest comments to all posts in RSS">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li>
<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress.org</a></li> </ul>
</aside> </div><!-- .widget-area -->
</div><!-- #secondary -->
<div class="site-info">
<a href="http://wordpress.org/" title="Semantic Personal Publishing Platform">Proudly powered by WordPress</a>
</div><!-- .site-info -->
</footer><!-- #colophon -->
</div><!-- #page -->
<script type='text/javascript' src='http://fberriman.com/wp-includes/js/jquery/jquery.masonry.min.js?ver=2.1.05'></script>
<script type='text/javascript' src='http://fberriman.com/wp-content/themes/twentythirteen/js/functions.js?ver=2013-07-18'></script>
</body>
</html>

View file

@ -0,0 +1,335 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>oauth-dropins | snarfed.org</title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="http://snarfed.org/w/xmlrpc.php" />
<!--[if lt IE 9]>
<script src="http://snarfed.org/w/wp-content/themes/ryu/js/html5.js" type="text/javascript"></script>
<![endif]-->
<link rel="alternate" type="application/rss+xml" title="snarfed.org &raquo; Feed" href="http://snarfed.org/feed" />
<link rel="alternate" type="application/rss+xml" title="snarfed.org &raquo; Comments Feed" href="http://snarfed.org/comments/feed" />
<link rel="alternate" type="application/rss+xml" title="snarfed.org &raquo; oauth-dropins Comments Feed" href="http://snarfed.org/2013-10-23_oauth-dropins/feed" />
<link rel='stylesheet' id='nextgen_gallery_related_images-css' href='http://snarfed.org/w/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/static/nextgen_gallery_related_images.css?ver=3.7' type='text/css' media='all' />
<link rel='stylesheet' id='jetpack-widgets-css' href='http://snarfed.org/w/wp-content/plugins/jetpack/modules/widgets/widgets.css?ver=20121003' type='text/css' media='all' />
<link rel='stylesheet' id='ryu-style-css' href='http://snarfed.org/w/wp-content/themes/snarfed-ryu/style.css?ver=3.7' type='text/css' media='all' />
<link rel='stylesheet' id='ryu-lato-css' href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' type='text/css' media='all' />
<link rel='stylesheet' id='ryu-playfair-display-css' href='http://fonts.googleapis.com/css?family=Playfair+Display:400,700,900,400italic,700italic,900italic&#038;subset=latin,latin-ext' type='text/css' media='all' />
<script type='text/javascript' src='http://snarfed.org/w/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>
<script type='text/javascript' src='http://snarfed.org/w/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var photocrati_ajax = {"url":"http:\/\/snarfed.org\/photocrati_ajax","wp_site_url":"http:\/\/snarfed.org","wp_site_static_url":"http:\/\/snarfed.org\/w"};
/* ]]> */
</script>
<script type='text/javascript' src='http://snarfed.org/w/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ajax/static/ajax.js?ver=3.7'></script>
<link rel='prev' title='RSVP: #Indieweb catchup' href='http://snarfed.org/2013-10-22_rsvp-indieweb-catchup' />
<link rel='canonical' href='http://snarfed.org/2013-10-23_oauth-dropins' />
<link rel='shortlink' href='http://wp.me/p3EDAq-1XE' />
<link rel="openid2.provider" href="https://www.google.com/accounts/o8/ud?source=profiles">
<link rel="openid2.local_id" href="http://www.google.com/profiles/heaven">
<link href="https://plus.google.com/103651231634018158746" rel="publisher" />
<meta property="fb:admins" content="212038" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-11785301-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- <meta name="NextGEN" version="2.0.33" /> -->
<link rel="http://webmention.org/" href="http://snarfed.org/w/?webmention=endpoint" />
<style type='text/css'>img#wpstats{display:none}</style>
<!-- Jetpack Open Graph Tags -->
<meta property="og:type" content="article" />
<meta property="og:title" content="oauth-dropins" />
<meta property="og:url" content="http://snarfed.org/2013-10-23_oauth-dropins" />
<meta property="og:description" content="Need to use an [OAuth](http://oauth.net/)-protected API in a Python webapp? [oauth-dropins](https://github.com/snarfed/oauth-dropins) is for you! It&#039;s a collection of drop-in OAuth client flows for..." />
<meta property="og:site_name" content="snarfed.org" />
<meta property="og:image" content="/oauth_shiny.png" />
<meta name="twitter:site" content="@snarfed_org" />
<meta name="twitter:image" content="/oauth_shiny.png" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:description" content="Need to use an [OAuth](http://oauth.net/)-protected API in a Python webapp? [oauth-dropins](https://github.com/snarfed/oauth-dropins) is for you! It&#039;s a collection of drop-in OAuth client flows for..." />
<style type="text/css">
.site-title,
.site-description {
position: absolute;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
}
.header-image {
margin-bottom: 0;
}
</style>
<link rel="stylesheet" id="custom-css-css" type="text/css" href="http://snarfed.org/?custom-css=1&#038;csblog=1&#038;cscache=6&#038;csrev=45" />
</head>
<body class="single single-post postid-7542 single-format-standard h-entry hentry h-as-article">
<div id="page" class="site">
<div id="widgets-wrapper" class="toppanel hide">
<div id="secondary" role="complementary" class="wrap clear one">
<div id="top-sidebar-one" class="widget-area" role="complementary">
<aside id="text-2" class="widget widget_text"> <div class="textwidget"><div class="h-card vcard">
<div id="my-header">
I'm <a id="my-name" href="/about" class="p-name fn">Ryan Barrett</a>.<br />
I <a href="/house">live</a>, <a href="/resume">work</a>, and <a href="/pictures">play</a> in San Francisco.<br />
I <a href="/software">code</a>, <a href="/tag/essay">write</a>, and post <a href="/pictures">pictures</a> here.
</div>
<img class="u-photo photo" src="http://snarfed.org/ryan_profile_square_thumb.jpg" style="display: none" />
<ul id="my-icons">
<li class="home-link">
<a href="http://snarfed.org/" class="genericon url u-url" title="Home">
<span class="screen-reader-text">Home</span>
</a>
</li>
<li class="search-trigger">
<a href="#" class="genericon" title="Search">
<span class="screen-reader-text">Search</span>
</a>
</li>
<li class="archives-link">
<a href="/archive" class="genericon" title="Archives">
<span class="screen-reader-text">Archives</span>
</a>
</li>
<li class="twitter-link">
<a rel="me" href="https://twitter.com/snarfed_org" class="genericon" title="Twitter" target="_blank">
<span class="screen-reader-text">Twitter</span>
</a>
</li>
<li class="facebook-link">
<a rel="me" href="https://www.facebook.com/snarfed.org" class="genericon" title="Facebook" target="_blank">
<span class="screen-reader-text">Facebook</span>
</a>
</li>
<li class="google-link">
<a rel="me" href="https://plus.google.com/103651231634018158746" class="genericon" title="Google+" target="_blank">
<span class="screen-reader-text">Google+</span>
</a>
</li>
<li class="github-link">
<a rel="me" href="https://github.com/snarfed" class="genericon" title="GitHub" target="_blank">
<span class="screen-reader-text">GitHub</span>
</a>
</li>
<li class="feed-link">
<a href="/feed" class="genericon" title="RSS Feed">
<span class="screen-reader-text">RSS Feed</span>
</a>
</li>
</ul>
</div></div>
</aside> </div><!-- #first .widget-area -->
</div><!-- #secondary --> </div>
<div id="search-wrapper" class="toppanel hide">
<form method="get" id="searchform" class="searchform" action="http://snarfed.org/" role="search">
<label for="s" class="screen-reader-text">Search</label>
<input type="search" class="field" name="s" value="" id="s" placeholder="Search &hellip;" />
<input type="submit" class="submit" id="searchsubmit" value="Search" />
</form> </div>
<div id="triggers-wrapper">
<ul class="triggers clear">
<li class="widgets-trigger">
<a href="#" class="genericon" title="Widgets">
<span class="screen-reader-text">Widgets</span>
</a>
</li>
<li class="search-trigger">
<a href="#" class="genericon" title="Search">
<span class="screen-reader-text">Search</span>
</a>
</li>
</ul>
</div>
<header id="masthead" class="site-header" role="banner">
<div class="wrap">
<a class="site-logo" href="http://snarfed.org/" title="snarfed.org" rel="home">
<img src="http://snarfed.org/w/wp-content/uploads/2013/06/copy-cropped-iraq_bar.jpg" width="1500" height="213" alt="" class="no-grav header-image" />
</a>
<hgroup>
<h1 class="site-title"><a href="http://snarfed.org/" title="snarfed.org" rel="home">snarfed.org</a></h1>
<h2 class="site-description">Ryan Barrett&#039;s blog</h2>
</hgroup>
</div><!-- .wrap -->
</header><!-- #masthead -->
<div id="main" class="site-main">
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<article id="post-7542" class="post-7542 post type-post status-publish format-standard category-uncategorized clear">
<div class="entry-wrap wrap clear">
<header class="entry-header">
<span class="categories-links"><a href="http://snarfed.org/category/uncategorized" title="View all posts in Uncategorized" rel="category tag">Uncategorized</a></span><h1 class="entry-title"><span class='p-name'>oauth-dropins</span></h1> </header><!-- .entry-header -->
<footer class="entry-meta">
<span class="entry-date"><a href="http://snarfed.org/2013-10-23_oauth-dropins" title="10:32am" rel="bookmark"><time class="dt-published" datetime="2013-10-23T10:32:06+00:00">10/23/2013</time></a></span><span class="author h-card vcard"> <img alt='' src='http://1.gravatar.com/avatar/947b5f3f323da0ef785b6f02d9c265d6?s=96&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&amp;r=G' class='u-photo avatar avatar-96 photo' height='96' width='96' /><a class="u-url url fn n p-name" href="http://snarfed.org/" title="Ryan Barrett" rel="author">Ryan Barrett</a></span>
<span class="comments-link"><a href="http://snarfed.org/2013-10-23_oauth-dropins#comments" title="Comment on oauth-dropins">1 Comment</a></span>
</footer><!-- .entry-meta -->
<div class="entry-content clear">
<div class='e-content'><p class="third right">
<a href="https://oauth-dropins.appspot.com/"><img src="/oauth_shiny.png" /></a>
</p>
<p>Need to use an <a href="http://oauth.net/">OAuth</a>-protected API in a Python webapp?
<a href="https://github.com/snarfed/oauth-dropins">oauth-dropins</a> is for you! It&#8217;s a
collection of drop-in OAuth client flows for many popular sites. It supports
Facebook, Twitter, Google+, Instagram, Dropbox, Blogger, Tumblr, and
WordPress.com, with more on the way. It also currently requires
<a href="https://appengine.google.com/">Google App Engine</a>, but should support other
platforms in the future.</p>
<p><a href="https://oauth-dropins.appspot.com/">Try the demo!</a><span id="more-7542"></span><span /></p>
<p>You can use oauth-dropins in your project with just a bit of code. For example,
to use it for Facebook, just add these two lines to your WSGI application:</p>
<pre>
from oauth_dropins import facebook
application = webapp2.WSGIApplication([
...
<b>('/facebook/start_oauth', facebook.StartHandler.to('/facebook/oauth_callback')),</b>
<b>('/facebook/oauth_callback', facebook.CallbackHandler.to('/next'))</b>,
]
</pre>
<p>Then map those URLs in your
<a href="https://developers.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Script_handlers">app.yaml</a>
and put your <a href="https://developers.facebook.com/apps">Facebook app</a>&#8216;s key and
secret in <code>facebook_app_id</code> and <code>facebook_app_secret</code> files in your app&#8217;s root
directory, and you&#8217;re good to go!</p>
<p>See the <a href="https://github.com/snarfed/oauth-dropins">GitHub repo</a> for more
details. Happy hacking!</p>
</div> </div><!-- .entry-content -->
<span class="entry-format-badge genericon"><span class="screen-reader-text">Standard</span></span>
</div><!-- .entry-wrap -->
</article><!-- #post-## -->
<div id="comments" class="comments-area">
<div class="comments-wrap wrap">
<h2 class="comments-title">
One thought on &ldquo;<span>oauth-dropins</span>&rdquo; </h2>
<ol class="comment-list">
<li class="comment even thread-even depth-1 p-comment h-entry" id="li-comment-783020">
<article id="comment-783020" class="comment">
<footer>
<div class="comment-author vcard">
<span class="comment-author-avatar"><img alt='' src='http://0.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=48' class='u-photo avatar avatar-48 photo avatar-default' height='48' width='48' /></span>
<cite class="fn genericon"><a href='http://twitter.com/snarfed_org' rel='external nofollow' class='u-url url'>Ryan Barrett</a></cite> <span class="says">says:</span> </div><!-- .comment-author .vcard -->
</footer>
<div class="comment-content">
<div class='e-content p-name p-summary'><p>Need to use an OAuth-ed API in a Python webapp? oauth-dropins is for you! <a href="http://t.co/DHqkNf0OBX" rel="nofollow">http://t.co/DHqkNf0OBX</a> Try the demo: <a href="http://t.co/8Cg0GFAdDb" rel="nofollow">http://t.co/8Cg0GFAdDb</a> <cite><a href="http://twitter.com/snarfed_org/status/393075859000549376" rel="nofollow">via Twitter</a></cite></p>
</div> </div>
<div class="comment-meta commentmetadata">
<a href="http://snarfed.org/2013-10-23_oauth-dropins#comment-783020"><time datetime="2013-10-23T11:20:24+00:00">
10/23/2013 at 11:20am </time></a>
</div><!-- .comment-meta .commentmetadata -->
</article><!-- #comment-## -->
</li><!-- #comment-## -->
</ol><!-- .comment-list -->
<div id="respond" class="comment-respond">
<h3 id="reply-title" class="comment-reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="/2013-10-23_oauth-dropins#respond" style="display:none;">Cancel reply</a></small></h3>
<form action="http://snarfed.org/w/wp-comments-post.php" method="post" id="commentform" class="comment-form">
<p class="comment-notes">Your email address will not be published.</p> <p class="comment-form-author"><label for="author">Name</label> <input id="author" name="author" type="text" value="" size="30" /></p>
<p class="comment-form-email"><label for="email">Email</label> <input id="email" name="email" type="text" value="" size="30" /></p>
<p class="comment-form-url"><label for="url">Website</label> <input id="url" name="url" type="text" value="" size="30" /></p>
<p class="comment-form-comment"><label for="comment">Comment</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p> <p class="form-allowed-tags">You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <code>&lt;a href=&quot;&quot; title=&quot;&quot;&gt; &lt;abbr title=&quot;&quot;&gt; &lt;acronym title=&quot;&quot;&gt; &lt;b&gt; &lt;blockquote cite=&quot;&quot;&gt; &lt;cite&gt; &lt;code&gt; &lt;del datetime=&quot;&quot;&gt; &lt;em&gt; &lt;i&gt; &lt;q cite=&quot;&quot;&gt; &lt;strike&gt; &lt;strong&gt; </code></p> <p class="form-submit">
<input name="submit" type="submit" id="submit" value="Post Comment" />
<input type='hidden' name='comment_post_ID' value='7542' id='comment_post_ID' />
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />
</p>
<p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="9e21df4fc3" /></p> </form>
</div><!-- #respond -->
</div><!-- .comments-wrap -->
</div><!-- #comments -->
</div><!-- #content -->
</div><!-- #primary -->
</div><!-- #main -->
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="site-info wrap">
<a href="http://wordpress.org/" title="A Semantic Personal Publishing Platform" rel="generator">Proudly powered by WordPress</a>
<span class="sep"> | </span>
Theme: Ryu by <a href="http://automattic.com/" rel="designer">Automattic</a>. </div><!-- .site-info -->
</footer><!-- #colophon -->
</div><!-- #page -->
<div style="display:none">
<div class="grofile-hash-map-947b5f3f323da0ef785b6f02d9c265d6">
</div>
<div class="grofile-hash-map-d41d8cd98f00b204e9800998ecf8427e">
</div>
</div>
<script src="http://stats.wordpress.com/e-201344.js" type="text/javascript"></script>
<script type="text/javascript">
st_go({v:'ext',j:'1:2.5',blog:'54014302',post:'7542',tz:'-7'});
var load_cmc = function(){linktracker_init(54014302,7542,2);};
if ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc);
else load_cmc();
</script>
<script type='text/javascript' src='http://s0.wp.com/wp-content/js/devicepx-jetpack.js?ver=201344'></script>
<script type='text/javascript' src='http://s.gravatar.com/js/gprofiles.js?ver=2013Octaa'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var WPGroHo = {"my_hash":""};
/* ]]> */
</script>
<script type='text/javascript' src='http://snarfed.org/w/wp-content/plugins/jetpack/modules/wpgroho.js?ver=3.7'></script>
<script type='text/javascript' src='http://snarfed.org/w/wp-content/themes/ryu/js/skip-link-focus-fix.js?ver=20130115'></script>
<script type='text/javascript' src='http://snarfed.org/w/wp-content/themes/ryu/js/ryu.js?ver=20130319'></script>
</body>
</html>
<!-- Dynamic page generated in 0.502 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2013-10-30 08:32:04 -->
<!-- Compression = gzip -->

View file

@ -0,0 +1 @@
<p class="adr">665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.</p>

View file

@ -0,0 +1,8 @@
{
"items": [{
"type": ["h-adr"],
"properties": {
"name": ["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Just a name",
"description": "adr",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,8 @@
<p class="adr">
<span class="street-address">665 3rd St.</span>
<span class="extended-address">Suite 207</span>
<span class="locality">San Francisco</span>,
<span class="region">CA</span>
<span class="postal-code">94107</span>
<span class="country-name">U.S.A.</span>
</p>

View file

@ -0,0 +1,14 @@
{
"items": [{
"type": ["h-adr"],
"properties": {
"street-address": ["665 3rd St."],
"extended-address": ["Suite 207"],
"locality": ["San Francisco"],
"region": ["CA"],
"postal-code": ["94107"],
"country-name": ["U.S.A."],
"name": ["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Broken into properties",
"description": "h-adr",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,4 @@
{
"name": "adr parsing tests",
"description": "This page was design to test the parsing of adr and its output to the newer JSON structure of micorformats 2. These tests are part of the micorformats 2 test suite."
}

View file

@ -0,0 +1,4 @@
<p class="geo">
<abbr class="latitude" title="37.408183">N 37° 24.491</abbr>,
<abbr class="longitude" title="-122.13855">W 122° 08.313</abbr>
</p>

View file

@ -0,0 +1,10 @@
{
"items": [{
"type": ["h-geo"],
"properties": {
"latitude": ["37.408183"],
"longitude": ["-122.13855"],
"name": ["N 37° 24.491, W 122° 08.313"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "The <abbr> tag pattern",
"description": "geo",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,10 @@
<p>
<span class="geo">The Bricklayer's Arms
<span class="latitude">
<span class="value-title" title="51.513458"> </span>
</span>
<span class="longitude">
<span class="value-title" title="-0.14812"> </span>
</span>
</span>
</p>

View file

@ -0,0 +1,10 @@
{
"items": [{
"type": ["h-geo"],
"properties": {
"latitude": ["51.513458"],
"longitude": ["-0.14812"],
"name": ["The Bricklayer's Arms"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Hidden value-title pattern",
"description": "geo",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,3 @@
<p>On my way to The Bricklayer's Arms
(Geo: <span class="geo">51.513458;-0.14812</span>)
</p>

View file

@ -0,0 +1,8 @@
{
"items": [{
"type": ["h-geo"],
"properties": {
"name": ["51.513458;-0.14812"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Just a name",
"description": "geo",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,6 @@
We are meeting at
<span class="geo">
<span>The Bricklayer's Arms</span>
(Geo: <span class="p-latitude">51.513458</span>:
<span class="p-longitude">-0.14812</span>)
</span>

View file

@ -0,0 +1,10 @@
{
"items": [{
"type": ["h-geo"],
"properties": {
"latitude": ["51.513458"],
"longitude": ["-0.14812"],
"name": ["The Bricklayer's Arms (Geo: 51.513458: -0.14812)"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Broken into properties",
"description": "geo",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,4 @@
{
"name": "geo parsing tests",
"description": "This page was design to test the parsing of geo and its output to the newer JSON structure of micorformats 2. These tests are part of the micorformats 2 test suite."
}

View file

@ -0,0 +1,10 @@
<p>
<span class="geo">
<span class="latitude">
<span class="value-title" title="51.513458">N 51° 51.345</span>,
</span>
<span class="longitude">
<span class="value-title" title="-0.14812">W -0° 14.812</span>
</span>
</span>
</p>

View file

@ -0,0 +1,10 @@
{
"items": [{
"type": ["h-geo"],
"properties": {
"latitude": ["51.513458"],
"longitude": ["-0.14812"],
"name": ["N 51° 51.345, W -0° 14.812"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Value-title class pattern",
"description": "geo",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,10 @@
<p class="h-adr">
<span class="p-name">Bricklayer's Arms</span>
<span class="p-label">
<span class="p-street-address">3 Charlotte Road</span>,
<span class="p-locality">City of London</span>,
<span class="p-postal-code">EC2A 3PE</span>,
<span class="p-country-name">UK</span>
</span>
Geo:(<span class="p-geo">51.526421;-0.081067</span>)
</p>

View file

@ -0,0 +1,14 @@
{
"items": [{
"type": ["h-adr"],
"properties": {
"name": ["Bricklayer's Arms"],
"label": ["3 Charlotte Road, City of London, EC2A 3PE, UK"],
"street-address": ["3 Charlotte Road"],
"locality": ["City of London"],
"postal-code": ["EC2A 3PE"],
"country-name": ["UK"],
"geo": ["51.526421;-0.081067"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "With geo data",
"description": "h-adr",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,4 @@
<p class="h-adr">
<a class="p-name u-geo" href="geo:51.526421;-0.081067;crs=wgs84;u=40">Bricklayer's Arms</a>,
<span class="p-locality">London</span>
</p>

View file

@ -0,0 +1,10 @@
{
"items": [{
"type": ["h-adr"],
"properties": {
"name": ["Bricklayer's Arms"],
"geo": ["geo:51.526421;-0.081067;crs=wgs84;u=40"],
"locality": ["London"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "With geo url",
"description": "h-adr",
"author": "Glenn Jones"
}

View file

@ -0,0 +1 @@
<p class="h-adr">665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.</p>

View file

@ -0,0 +1,8 @@
{
"items": [{
"type": ["h-adr"],
"properties": {
"name": ["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Just a name",
"description": "h-adr",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,8 @@
<p class="h-adr">
<span class="p-street-address">665 3rd St.</span>
<span class="p-extended-address">Suite 207</span>
<span class="p-locality">San Francisco</span>,
<span class="p-region">CA</span>
<span class="p-postal-code">94107</span>
<span class="p-country-name">U.S.A.</span>
</p>

View file

@ -0,0 +1,14 @@
{
"items": [{
"type": ["h-adr"],
"properties": {
"street-address": ["665 3rd St."],
"extended-address": ["Suite 207"],
"locality": ["San Francisco"],
"region": ["CA"],
"postal-code": ["94107"],
"country-name": ["U.S.A."],
"name": ["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Broken into properties",
"description": "h-adr",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,4 @@
{
"name": "h-adr parsing tests",
"description": "This page was design to test the parsing of h-adr. These tests are part of the micorformats 2 test suite."
}

View file

@ -0,0 +1,6 @@
<a class="h-card" href="http://people.opera.com/howcome/" title="Håkon Wium Lie, CTO Opera">
<article>
<h2 class="p-name">Håkon Wium Lie</h2>
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/96/H%C3%A5kon-Wium-Lie-2009-03.jpg/215px-H%C3%A5kon-Wium-Lie-2009-03.jpg" />
</article>
</a>

View file

@ -0,0 +1,10 @@
{
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Håkon Wium Lie"],
"photo": ["http://upload.wikimedia.org/wikipedia/commons/thumb/9/96/H%C3%A5kon-Wium-Lie-2009-03.jpg/215px-H%C3%A5kon-Wium-Lie-2009-03.jpg"],
"url": ["http://people.opera.com/howcome/"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Single child implied pattern",
"description": "h-card",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,10 @@
<div class="h-card">
<img class="u-photo" alt="photo of Mitchell" src="http://blog.mozilla.org/press/files/2012/04/mitchell-baker.jpg" />
<p>
<a class="p-name u-url" href="http://blog.lizardwrangler.com/">Mitchell Baker</a>
(<a class="u-url" href="https://twitter.com/MitchellBaker">@MitchellBaker</a>)
<span class="p-org">Mozilla Foundation</span>
</p>
<p class="p-note">Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities.</p>
<p><span class="p-category">Strategy</span> and <span class="p-category">Leadership</span></p>
</div>

View file

@ -0,0 +1,13 @@
{
"items": [{
"type": ["h-card"],
"properties": {
"photo": ["http://blog.mozilla.org/press/files/2012/04/mitchell-baker.jpg"],
"url": ["http://blog.lizardwrangler.com/", "https://twitter.com/MitchellBaker"],
"name": ["Mitchell Baker"],
"org": ["Mozilla Foundation"],
"note": ["Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities."],
"category": ["Strategy", "Leadership"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "An extended description",
"description": "h-card",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,4 @@
<div class="h-card">
<a class="p-name u-url" href="http://blog.lizardwrangler.com/">Mitchell Baker</a>
(<a class="p-org h-card" href="http://mozilla.org/">Mozilla Foundation</a>)
</div>

View file

@ -0,0 +1,23 @@
{
"items": [{
"type": ["h-card"],
"properties": {
"url": ["http://blog.lizardwrangler.com/"],
"name": ["Mitchell Baker"],
"org": [{
"value": "Mozilla Foundation",
"type": ["h-card"],
"properties": {
"name": ["Mozilla Foundation"],
"url": ["http://mozilla.org/"]
}
}]
}
},{
"type": ["h-card"],
"properties": {
"name": ["Mozilla Foundation"],
"url": ["http://mozilla.org/"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Organization marked-up with h-card",
"description": "h-card",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,4 @@
<div class="h-card">
<a class="p-name u-url" href="http://blog.lizardwrangler.com/">Mitchell Baker</a>
(<a class="p-org h-card h-org" href="http://mozilla.org/">Mozilla Foundation</a>)
</div>

View file

@ -0,0 +1,28 @@
{
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Mitchell Baker"],
"url": ["http://blog.lizardwrangler.com/"],
"org": [{
"value": "Mozilla Foundation",
"type": ["h-card", "h-org"],
"properties": {
"name": ["Mozilla Foundation"],
"url": ["http://mozilla.org/"]
}
}]
}
},{
"type": ["h-card"],
"properties": {
"name": ["Mozilla Foundation"],
"url": ["http://mozilla.org/"]
}
},{
"type": ["h-org"],
"properties": {
"name": ["Mozilla Foundation"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Organization marked-up with h-card and h-org",
"description": "h-card",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,3 @@
<a class="h-card" href="http://rohit.khare.org/">
<img alt="Rohit Khare" src="https://twimg0-a.akamaihd.net/profile_images/53307499/180px-Rohit-sq.jpg" />
</a>

View file

@ -0,0 +1,10 @@
{
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Rohit Khare"],
"photo": ["https://twimg0-a.akamaihd.net/profile_images/53307499/180px-Rohit-sq.jpg"],
"url": ["http://rohit.khare.org/"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "A hyperlinked photo",
"description": "h-card",
"author": "Glenn Jones"
}

View file

@ -0,0 +1 @@
<a class="h-card" href="http://benward.me/">Ben Ward</a>

View file

@ -0,0 +1,9 @@
{
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Ben Ward"],
"url": ["http://benward.me/"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Just a hyperlink",
"description": "h-card",
"author": "Glenn Jones"
}

View file

@ -0,0 +1 @@
<p class="h-card">Frances Berriman</p>

View file

@ -0,0 +1,8 @@
{
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Frances Berriman"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Just a name",
"description": "h-card",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,4 @@
<div class="h-card">
<a class="p-name u-url" href="http://blog.lizardwrangler.com/">Mitchell Baker</a>
(<a class="h-org h-card" href="http://mozilla.org/">Mozilla Foundation</a>)
</div>

View file

@ -0,0 +1,27 @@
{
"items": [{
"type": ["h-card"],
"properties": {
"name": ["Mitchell Baker"],
"url": ["http://blog.lizardwrangler.com/"]
},
"children": [{
"type": ["h-card", "h-org"],
"properties": {
"name": ["Mozilla Foundation"],
"url": ["http://mozilla.org/"]
}
}]
},{
"type": ["h-card"],
"properties": {
"name": ["Mozilla Foundation"],
"url": ["http://mozilla.org/"]
}
},{
"type": ["h-org"],
"properties": {
"name": ["Mozilla Foundation"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "Additional nested microformats",
"description": "h-card",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,21 @@
<div class="h-card">
<!-- innerText and value pattern -->
<span class="p-name">
<span class="p-given-name value">John</span>
<abbr class="p-additional-name" title="Peter">P</abbr>
<span class="p-family-name value ">Doe</span>
</span>
<data class="p-honorific-suffix" value="MSc"></data>
<!-- theses should return no value -->
<br class="p-honorific-suffix">BSc</br>
<hr class="p-honorific-suffix">BA</hr>
<!-- image and area tags -->
<img class="p-honorific-suffix" src="images/logo.gif" alt="PHD" />
<img src="images/logo.gif" alt="company logos" usemap="#logomap" />
<map name="logomap">
<area class="p-org" shape="rect" coords="0,0,82,126" href="madgex.htm" alt="Madgex" />
<area class="p-org" shape="circle" coords="90,58,3" href="mozilla.htm" alt="Mozilla" />
</map>
</div>

View file

@ -0,0 +1,13 @@
{
"items": [{
"type": ["h-card"],
"properties": {
"name": ["John Doe"],
"given-name": ["John"],
"additional-name": ["Peter"],
"family-name": ["Doe"],
"honorific-suffix": ["MSc","PHD"],
"org": ["Madgex", "Mozilla"]
}
}]
}

View file

@ -0,0 +1,5 @@
{
"name": "p-property",
"description": "h-card",
"author": "Glenn Jones"
}

View file

@ -0,0 +1,4 @@
{
"name": "h-card parsing tests",
"description": "This page was design to test the parsing of h-card. These tests are part of the micorformats 2 test suite."
}

Some files were not shown because too many files have changed in this diff Show more