Actualización del plugin TubePress

git-svn-id: https://192.168.0.254/svn/Proyectos.OriginalHouse_Web/trunk@66 54e8636e-a86c-764f-903d-b964358a1ae2
This commit is contained in:
David Arranz 2011-10-04 09:12:25 +00:00
parent bab115fd7f
commit 5bbc78c77c
230 changed files with 0 additions and 23129 deletions

View File

@ -1,674 +0,0 @@
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:
<program> Copyright (C) <year> <name of author>
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>.

View File

@ -1 +0,0 @@
This directory holds your custom TubePress themes!

View File

@ -1,3 +0,0 @@
<?php
//This file is here to stop cluttering search engine results for your site with TubePress's internals. Move along, nothing to see here!
?>

View File

@ -1,384 +0,0 @@
=== TubePress ===
Contributors: k2eric
Donate link: http://tubepress.org
Tags: video, youtube, gallery, videos, vimeo
Requires at least: 2.2
Stable tag: trunk
Displays gorgeous YouTube and Vimeo galleries in your posts, pages, and/or sidebar. Please visit http://tubepress.org for more info!
== Installation ==
1. Unzip into your plugins directory at `(wp-content/plugins)`
1. Activate TubePress from Site Admin > Plugins
1. Configure from Site Admin > Settings > TubePress
1. Type `[tubepress]` in a post or a page where you'd like to insert your first gallery
== Changelog ==
= 2.2.0 =
* Interactive searching! (closes issue 138 )
* YouTube iframe embedded player (closes issue 265 and issue 259 )
* Improved inclusion of JS/CSS resources in WordPress environments (closes issue 191 )
* Ability to restrict search-based galleries to videos from a specific YouTube/Vimeo user
* New HTTP subsystem provides faster and more robust feed retrieval
* Added advanced caching options
* Improved visual feedback during Ajax operations (closes issue 142 )
* Better upgrade notice for TubePress Pro users in a WordPress environment (closes issue 252 )
* Graceful handling of single video embedding when video isn't found (closes issue 267 )
* Broken gallery when trying to display Vimeo videos with JW FLV Media Player (closes issue 242 )
* Incorrect detection of multi-gallery mode in some circumstances (closes issue 238 )
* Duplicate videos no longer appear in galleries (closes issue 248 )
* Private Vimeo videos no longer appear in galleries
* Non-functional message service when using TubePress Pro in a PHP environment without built-in gettext support
* Fixed bug that could affect TubePress Pro users in a WordPress environment hosted on Windows-based PHP installations
* Removed option for "mobile" YouTube videos feed as it appears to be completely abandoned
* YouTube now uses the iframe embedded player by default
* Removed "enhanced genie menu" and "border" options from YouTube embedded player
* Version bump for php-gettext to 1.0.11
* Version bump for jQuery to 1.5.1
= 2.1.2 =
* Fixed JavaScript error in Internet Explorer when determining height/width of embedded video player
* Fixed ajax pagination appearance when non-default thumbnail sizes are in use
* Fixed non-functional WordPress widget control
* Updated Italian translation thanks to Gianni Diurno
= 2.1.1 =
* Fixed major JavaScript bug in determining embedded player height/width on jQuery 1.4.2
* Fixed bug with ajax pagination on some PHP installations
= 2.1.0 =
* Ability to create galleries from multiple sources (TubePress Pro only) (closes issue 135)
* Lightweight theming support
* Support for "fluid" thumbnails
* Vimeo universal player (closes issue 215)
* Improved video search capability (closes issue 81)
* Improved mobile user experience
* Single video mode now works in WordPress widget
* Fixed aliased text with Ajax pagination in Internet Explorer 7
* Search engines no longer index TubePress's internal directories (closes issue 221)
* Static player now works with Vimeo (closes issue 217)
* Fixed color support for JW FLV Player
* YouTube "most linked" gallery replaced with YouTube "top favorites" gallery due to change in API
* Version bump for Shadowbox.js to 3.0.3
* Version bump for JW FLV Media Player to 5.2
* Version bump for jQuery to 1.4.2
* Version bump for php-gettext to 1.0.10
* Added Arabic translation thanks to Abdullah Hamed
* Updated Italian translation thanks to Gianni Diurno
* Updated Spanish translation thanks to Luis Fok
= 2.0.0 =
* Vimeo support! Choose from 8 different types of Vimeo galleries. (closes issue 108)
* Brought back ability to play each video from a gallery in a new window by itself (closes issue 94)
* Now detects and parses HTML links found in video descriptions
* Updated Italian translation thanks to Gianni Diurno
* Added Spanish translation thanks to Luis Fok
* Added Hebrew translation thanks to Yaron Ofer
* Ability to blacklist individual videos (closes issue 162)
* Option to use high-quality thumbnails (closes issue 96) (TubePress Pro only)
* HTML popups are now centered on screen (closes issue 160)
* Fixed regression bug for description limit (closes issue 153)
* Incorrect video could load into embedded player after thumbnail click in certain configurations (closes issue 175)
* resultCountCap now works on a single gallery page
* Fixes single video mode in TubePress Pro
* Static player now works with Ajax pagination (closes issue 177)
* Version bump for FancyBox (to 1.3.1)
* FancyBox now operates correctly in all browsers (closes issue 172)
= 1.9.0 =
* Fixed a bug that breaks the WordPress widget administration page in some PHP installations
* Added Portugese translation thanks to Miriam de Pauala
= 1.8.9 =
* Now includes ability to embed individual videos along with all of their meta info (title, author, description, etc)!
* Request cache is now disabled by default
* Updated sorting functionality. Fixes possible "bad request" response from YouTube. Fixes sorting of playlist galleries.
* Fixed blank item on video sort order dropdown of WordPress options page (closes issue 155)
* descLimit shortcode can now be set to zero (closes issue 153)
* Improved compatibility with older versions of PHP (closes issue 163)
* Added Russian translation (thanks to an anonymous supporter)
* ShadowBox version bump to 3.0rc1
* Improved documentation
* (TubePress Pro) Improved i18n support
* (TubePress Pro) FancyBox version bump to 1.2.6
* (TubePress Pro) Fixed bug that prevented FancyBox from operating correctly in IE (closes issue 165)
= 1.8.8 =
* JavaScript initialization is much more robust. Reduces chances of un-clickable video thumbnails.
* Fixed potentially fatal error in cache mechanism
* Improved sidebar's CSS
* Fixed bug in video sort order (closes issue 146)
* Fixed bug that could cause fatal error in templates
* Version bump for JW FLV Media Player (to 5.0)
* Updated Italian translation thanks to Gianni Diurno
= 1.8.7 =
* Improved compatibility with PEAR (closes issue 140)
* Fixed bug that affected determining video ID in some YouTube feeds
* New static player option. Produces page refresh on each thumbnail click.
* Gallery HTML is now semantically correct and more structured (closes issue 125 and issue 117)
* TubePress Pro: New player: TinyBox (closes issue 110)
* TubePress Pro: New player: FancyBox (closes issue 118)
* TubePress Pro: Greatly improved WordPress integration
* TubePress Pro: Fixed bug that produced open_basedir warning message in some installations
* Fixed bug that prevented use of custom templates
* Overhaul and simplification of templating system
* Improved performance of logging system
* Improved iPhone/iPod playback (keeps user on site instead of redirecting to YouTube player) (closes issue 143)
= 1.8.6 =
* WordPress options page now uses jQuery tabs
* Fixed bug that could prevent request cache from working in some PHP installations
* (TubePress Pro only) Ajax pagination (closes issue 45 and issue 111)
* (TubePress Pro only) Version bump for jQuery (1.2.6 -> 1.3.2)
* (TubePress Pro only) Removed potential "Invalid locale category name" warning that shows up on some PHP installations
* Version bump for JW FLV Media Player (to 4.6)
* Fixed bug that prevented display of videos with "limited syndication" restriction
* Shortcode and input validation is much more comprehensive (closes issue 129)
* Fixed bug that prevented videos from playing in high definition upon request (closes issue 137)
* Additional gallery pages are no longer indexed by search engines (closes issue 133)
* Minor refactoring of tubepress.js functions
* Updated WordPress plugins page blurb
* Updated Italian translation thanks to Gianni Diurno
* Various trivial improvements to HTML templates
= 1.8.5 =
* Videos now play correctly on iPhone and iPod Touch (closes issue 101)
* Flexible shortcodes! No need to include commas between attribute/value pairs. Can use single, double, or no quotes around attribute values.
* Greatly improved debugging mode
* Fixed bug that prevents all videos in gallery from playing if first video in gallery is unavailable (closes issue 115)
* Fixed bug that could prevent video playback, and JavaScript error, on Firefox with AdBlock Plus enabled (closes issue 124)
* Added ability to cap the total number of videos in a gallery (closes issue 65)
* Updated Italian translation thanks to Gianni Diurno
* Shadowbox CSS no longer tries to load non-existent images. (closes issue 112)
* WordPress galleries are no longer wrapped with HTML paragraph tags (closes issue 79)
* WordPress.org compliant readme.txt changelog (closes issue 123)
= 1.8.0 =
* Includes all the changes listed in 1.8.0.RC1
* Fixed typo on options page regarding embedded player width/height
* Unavailable videos will now not appear in galleries at all
= 1.8.0 =
* New embedded player option: JW Flv Media Player
* New player location: jqModal
* All classes use dependency injection via Crafty
* jQuery 1.2.6 or higher is now required (built-in for WordPress users)
* Multiple galleries on a single page now behave correctly with "normal" player
* Dynamically load JavaScript libraries as needed (Prototype, Shadowbox, etc) (closes issue 56)
* All JavaScript is now unobtrusive
* Can now use modal players (e.g. Shadowbox) in a TubePress shortcode
* Removed extra HTML comments and whitespace. Galleries now use about 16% less bandwidth.
* CSS will stay valid for multiple galleries on a single page
* CSS classes now have sensible names (renamed some classes)
* Updated Italian translation thanks to Gianni Diurno (closes issue 83)
* Fixed bug that affected some PHP installations with PEAR installed (closes issue 84)
* Fixed bug that blocked WordPress plugin's "database nuke" functionality
* Removed GreyBox as a player location due to its inability to display inline content
* Version bump for ShadowBox (closes issue 77)
* popup.php has been removed and replaced with JavaScript functionality (closes issue 76)
* Better control over pagination visibility for multi-page galleries (closes issue 93)
* Removed GreyBox and LightWindow as players
* Graceful failure for videos that are unavailable
= 1.7.2 =
* Fullscreen playback now available in embedded player (closes issue 64)
* Created "YouTube Feed" options category. Moved some of the advanced options into this category.
* Added ability to exclude non-embeddable videos (closes issue 69)
* Added jscolor HTML color picker for embedded player colors
* Fixed bug where debugging mode threw a fatal error (closes issue 80)
* Fixed bug where random video sort order would throw a fatal error
* Added ability to toggle display of title/rating before video starts playing
* Now using version 2.0 of YouTube gdata API (closes issue 68)
= 1.7.1 =
* Drastically improved class loading mechanism (uses several thousand less system calls)
* Added Italian translation thanks to Gianni Diurno (closes issue 75)
* Minified Shadowbox JS source using YUI Compressor
* Fixed critical bug that broke embedded YouTube player on IE7 (closes issue 73)
* Fixed minor bug in normal player where embedded player would shift by a few pixels after user clicked a thumbnail
= 1.7.0 =
* Option to initialize TubePress options in WordPress (closes issue 52)
* Now works with PHP <= 5.1.0 again (closes issue 59 and issue 67)
* Links to popup.php are drastically shorter, which avoids a 404 on some webservers (closes issue 55)
* Added German translation thanks to Pascal Berger (closes issue 58)
* Option to play videos in HD (closes issue 33)
* Option to show custom video in embedded player on page load while using "normal" player (closes issue 26)
= 1.6.9 =
* TubePress Pro is now available! Use TubePress anywhere that runs PHP
* Default thumbmail URL now uses "default.jpg" (closes issue 47)
* Fixed bug that resulted in inability to paginate past the first page of a multi-page gallery.
* Version bump for Net_URL to Net_URL2
* Version bump for HTTP_Request to HTTP_Request2
* Version bump for Cache_Lite
* Huge amounts of unit/integration tests
* Major refactoring of classes (now using dependency injection)
= 1.6.8 =
* Fixed overly large gap between thumbnail rows
= 1.6.7 =
* Added YouTube connection test to debug output
* Added YouTube API client ID and developer key to aide in debugging
* Fixed bug where TubePress would remove all post/page content if no videos were found for your request
* Toggle request cache on/off (closes issue 43)
* Ampersands in query strings are now properly escaped (closes issue 38)
* Galleries can now sort videos randomly (closes issue 23)
* Toggle "nofollow" attributes to YouTube links (closes issue 35)
= 1.6.6 =
* Widget-enabled! Put TubePress in your sidebar. (closes issue 12)
* Removed pass-by-reference warnings (closes issue 34)
* Ability to limit length of video descriptions
* Option to toggle relative dates/times for video upload timestamps
* Swedish translation. Thanks to Mikael Jorhult
* Improved error handling for PHP installations with suppressed error output
* Removed several small bugs that affected users of PHP < 5.2.1
= 1.6.5 =
* Full internationalization capability (closes issue 21)
* Upgrades, from this version on, will no longer destroy your old TubePress default settings (closes issue 28)
* Multiple galleries on a single post/page now possible (closes issue 20)
* Fixes broken YouTube link (closes issue 30)
* Video playback now functions correctly in IE7
* Cross site scripting vulnerability fixed (thanks Numline1 for reporting)
* Fixed debug output
* Options page now looks good in WordPress 2.5.1
* Various pass-by-reference warnings eliminated
= 1.6.0 =
* PHP5 only. This includes an overall rewrite of the code base to take advantage of PHP5-only stuff
* Responses from YouTube are now cached
* New galleries: Top favorites, Most recently added, Most discussed, Most linked, Most responded, Responses to a video
* New way to watch: Shadowbox.js
* Removed "New Window" player
* Customize textual formatting of dates
* Much more control over embedded player: Toggle "related videos" feature after a video finishes, Choose from several colors, Toggle auto-play, Toggle "enhanced genie menu" when mouse enters video area (instead of user clicking the "menu" button), Toggle video loop
* Interface improvements: Removed border and scroll bars from gallery, Removed time of day from date uploaded, Changed upload label from "Uploaded date" to "Uploaded", Pagination now supports HTTP/HTTPS and non-standard ports, Simplified templating (easier to customize the look of your galleries)
* Issues/enhancements closed: #20, #25, #7
* Upgrade source to GPLv3
= 1.5.7 =
* Fixed yet another title problem due to YouTube changing their feed
* Fixes issue #16
= 1.5.6 =
* Fixes a major problem displaying video titles due to change in YouTube feed format
= 1.5.5 RC3 =
* Fixes issue #13
= 1.5.5 RC2 =
* Fixes issue #5
* Changes default thumb width from 33% to 32% (helps with IE)
= 1.5.5 RC1 =
* "Favorites" mode now displays up to 500 videos
* "Search" mode now can return up to 1,000 videos
* New mode: most-viewed videos from today, this week, this month, or all time
* Customize the order of galleries by view-count, rating, relevance, or date-updated
* Randomize thumbnails (most videos come with 4 thumbnails, this option will mix it up for each pageload)
* Filter "racy" videos from galleries
* Option to show a videos category in its metadata
* All access to TubePressVideo member variables is now done through getters
* All HTML is generated via PEAR's HTML_Template_IT package
= 1.5.2 =
* Fixes a fatal error upon plugin activation in some PHP installations
= 1.5.1 =
* Fixes a minor bug with "search" mode due to YouTube changing the format of the XML results
= 1.5.0 =
* "All tags" and "Any tags" modes now merged into "YouTube search" mode
* Play videos with GreyBox (this replaces ThickBox)
* Play videos with lightWindow
* Pagination now uses modified Digg Style pagination
* Max player size is now 424px x 336px (removes thin white border from player)
* Input validation on options page
* All error messages are extremely detailed
* Debug mode is more comprehensive
* Option to disable debugging mode completely
* Embedded video is XHTML compliant
* "Playlist" mode pages correctly (thanks, YouTube!)
* "Normal" mode displays title and runtime correctly after user click
* Much better code documentation
* Code style is PEAR compliant
* XML parsing uses PEAR's XML_Unserializer instead of XMLIster
* Almost all functions moved to classes (helps namespace management)
* WordPress-specific code is cleanly isolated
* Improved message-resources handling
* Revamped directory structure
* Improved naming conventions all around
* Quasi-private methods (PHP4 OOP isn't too sophisticated)
* Most HTML printing methods use sprintf (or variant) - improves readability
= 1.2.0 =
* Fixed a bug that caused an incorrect count of YouTube video results
* Added debugging mode! See the documentation for how to use it.
= 1.1.5 =
* Fixed major XML bugs that caused a fatal error when parsing YouTube's XML
* CSS bug fixes with the pagination links
* Fixed a bug in the options page related to the "popular" mode drop down menu
= 1.1 =
* CSS bug fixes. Thanks to Scott for reporting it
= 1.05 =
* Fixed huge IE display bug (thanks to Keane and Jojo for reporting it)
* Disabled Thickbox by default due to incompatibilities with themes and other jquery-enabled features
= 1.0 =
* Now with seven modes of operation: videos by playlists (with paging), featured (the latest 25 featured videos from YouTube's homepage), popular (the most-viewed videos from the past day, week, or month), related (videos that match any tag that you specify), tag (videos that match all the tags you specify), favorite videos of any user, videos uploaded by any user
* You no longer need to supply your own developer ID and YouTube username! This means that anyone can use TubePress, even if you don't have a YouTube account!
* Pagination. You control how many videos per page show up (supported modes only)
* Leaner and meaner. The speedups in this version are ridiculous. Makes literally dozens less of the expensive database calls per page that existed in previous versions. Reduces database space in your wordpress options table from about 40 rows to only one.
* Options page is more concise and XHTML compliant
* Improved documentation
* Bug fixes. Too many to list!
= 0.9 =
* Now with five options on where to play the main video: Normally (at the top of your gallery), In a popup window, In a new window all by itself, In its original YouTube page, Using Thickbox (experimental, but very cool!)
* Bug fix regarding HTML special characters in video titles
= 0.8 =
* Major bug fix with PHP4. Thanks to Fabien and Paige for reporting it.
= 0.7 =
* Override global settings on a per-page basis! This will allow you to have one page with your videos (that you've uploaded), another page with your YouTube favorites, etc.
* Choose which meta information (author, rating, description, etc) you want to display
* Lots of optimizations and bug fixes
= 0.6 =
* Now works with PHP4
* CSS revisions
* Uses snoopy class instead of cURL libraries
* Added configurable timeout parameter for contacting YouTube
= 0.5 =
* Fixed small bug in time display
= 0.4 =
* Takes full advantage of the YouTube API: List videos from "your favorites", List your videos (that you've uploaded), List videos that match some tag, List videos of another user
* XHTML compliant
= 0.3 =
* OK, now the bug is really fixed. Sorry about that!
= 0.2 =
* Fixed major bug with CSS file path
= 0.1 =
* Initial release
== Screenshots ==
1. Sample TubePress gallery

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

View File

@ -1,34 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Performs TubePress-wide preflight checks and initialization.
*/
interface org_tubepress_api_bootstrap_Bootstrapper
{
/**
* Performs TubePress-wide initialization.
*
* @return null
*/
function boot();
}

View File

@ -1,45 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* String cache for TubePress
*/
interface org_tubepress_api_cache_Cache
{
/**
* Get a value from the cache
*
* @param string $key The key of the data to retrieve
*
* @return string The data at the given key, or false if not there
*/
function get($key);
/**
* Save the given data with the given key
*
* @param string $key The key at which to save the data
* @param string $data The data to save at the key
*
* @return void
*/
function save($key, $data);
}

View File

@ -1,42 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Filter execution point names.
*/
class org_tubepress_api_const_filters_ExecutionPoint
{
/* immediately after videos are returned by the provider */
const VIDEOS_DELIVERY = 'videosDelivery';
/* immediately after thumbnail gallery template generation */
const GALLERY_TEMPLATE = 'galleryTemplate';
/* immediately after thumbnail gallery template is converted to HTML */
const GALLERY_HTML = 'galleryHtml';
/* immediately after single video template generation */
const SINGLE_VIDEO_TEMPLATE = 'singleVideoTemplate';
/* immediately after single video template is converted to HTML */
const SINGLE_VIDEO_HTML = 'singleVideoHtml';
}

View File

@ -1,35 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* The valid options categories and their names
*
*/
class org_tubepress_api_const_options_CategoryName
{
const ADVANCED = 'advanced';
const DISPLAY = 'display';
const EMBEDDED = 'embedded';
const FEED = 'feed';
const META = 'meta';
const WIDGET = 'widget';
const OUTPUT = 'output';
}

View File

@ -1,42 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* The types of options TubePress can handle
*
*/
class org_tubepress_api_const_options_Type
{
const BOOL = 'boolean'; // Yes/No options
const COLOR = 'color'; // An HTML color (6 hex digits)
const INTEGRAL = 'integral'; // A number
const MODE = 'mode'; // A gallery mode
const ORDER = 'order'; // Video sort order
const OUTPUT = 'output'; // Output mode
const PLAYER = 'player'; // Shadowbox, popup, etc
const PLAYER_IMPL = 'playerImplementation'; // YouTube, Longtail, etc
const PLAYLIST = 'playlist'; // A YouTube playlist ID
const SAFE_SEARCH = 'safeSearch'; // a SafeSearch level
const TEXT = 'text'; // Free form text
const THEME = 'theme'; // TubePress theme to use
const TIME_FRAME = 'timeFrame'; // Today, last week, etc
const YT_USER = 'youtubeUser'; // A YouTube username
}

View File

@ -1,39 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Advanced option names for the plugin.
*/
class org_tubepress_api_const_options_names_Advanced
{
const CACHE_CLEAN_FACTOR = 'cacheCleaningFactor';
const CACHE_DIR = 'cacheDirectory';
const CACHE_LIFETIME_SECONDS = 'cacheLifetimeSeconds';
const DATEFORMAT = 'dateFormat';
const DEBUG_ON = 'debugging_enabled';
const DISABLE_HTTP_CURL = 'disableHttpTransportCurl';
const DISABLE_HTTP_EXTHTTP = 'disableHttpTransportExtHttp';
const DISABLE_HTTP_FOPEN = 'disableHttpTransportFopen';
const DISABLE_HTTP_FSOCKOPEN = 'disableHttpTransportFsockOpen';
const DISABLE_HTTP_STREAMS = 'disableHttpTransportStreams';
const KEYWORD = 'keyword';
const VIDEO_BLACKLIST = 'videoBlacklist';
}

View File

@ -1,43 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Display option names for the plugin
*
*/
class org_tubepress_api_const_options_names_Display
{
//The order in which these constants are declared dictates the
//order in which they'll be presented on the options page
const THEME = 'theme';
const AJAX_PAGINATION = 'ajaxPagination';
const CURRENT_PLAYER_NAME = 'playerLocation';
const RESULTS_PER_PAGE = 'resultsPerPage';
const HQ_THUMBS = 'hqThumbs';
const THUMB_HEIGHT = 'thumbHeight';
const THUMB_WIDTH = 'thumbWidth';
const ORDER_BY = 'orderBy';
const PAGINATE_ABOVE = 'paginationAbove';
const PAGINATE_BELOW = 'paginationBelow';
const RANDOM_THUMBS = 'randomize_thumbnails';
const RELATIVE_DATES = 'relativeDates';
const DESC_LIMIT = 'descriptionLimit';
}

View File

@ -1,41 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Option names for the embedded player
*
*/
class org_tubepress_api_const_options_names_Embedded
{
//The order in which these constants are declared dictates the
//order in which they'll be presented on the options page */
const PLAYER_IMPL = "playerImplementation";
const EMBEDDED_HEIGHT = "embeddedHeight";
const EMBEDDED_WIDTH = "embeddedWidth";
const AUTOPLAY = "autoplay";
const FULLSCREEN = "fullscreen";
const HIGH_QUALITY = "hd";
const LOOP = "loop";
const PLAYER_COLOR = "playerColor";
const PLAYER_HIGHLIGHT = "playerHighlight";
const SHOW_INFO = "showInfo";
const SHOW_RELATED = "showRelated";
}

View File

@ -1,37 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* YouTube feed options
*/
class org_tubepress_api_const_options_names_Feed
{
/* The order in which these constants are declared dictates the
order in which they'll be presented on the options page */
const CACHE_ENABLED = 'cacheEnabled';
const EMBEDDABLE_ONLY = 'embeddableOnly';
const FILTER = 'filter_racy';
const DEV_KEY = 'developerKey';
const RESULT_COUNT_CAP = 'resultCountCap';
const SEARCH_ONLY_USER = 'searchResultsRestrictedToUser';
const VIMEO_KEY = 'vimeoKey';
const VIMEO_SECRET = 'vimeoSecret';
}

View File

@ -1,41 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Option names that control which meta info is displayed below video
* thumbnails
*/
class org_tubepress_api_const_options_names_Meta
{
const AUTHOR = "author";
const CATEGORY = "category";
const DESCRIPTION = "description";
const ID = "id";
const LENGTH = "length";
const LIKES = 'likes';
const RATING = "rating";
const RATINGS = "ratings";
const TAGS = "tags";
const TITLE = "title";
const UPLOADED = "uploaded";
const URL = "url";
const VIEWS = "views";
}

View File

@ -1,51 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Option names defining what output to display
*/
class org_tubepress_api_const_options_names_Output
{
const MODE = 'mode';
const VIDEO = 'video';
const OUTPUT = 'output';
const SEARCH_RESULTS_URL = 'searchResultsUrl';
const SEARCH_RESULTS_ONLY = 'searchResultsOnly';
const SEARCH_PROVIDER = 'searchProvider';
const SEARCH_RESULTS_DOM_ID = 'searchResultsDomId';
const FAVORITES_VALUE = 'favoritesValue';
const MOST_VIEWED_VALUE = 'most_viewedValue';
const PLAYLIST_VALUE = 'playlistValue';
const TAG_VALUE = 'tagValue';
const TOP_FAVORITES_VALUE = 'youtubeTopFavoritesValue';
const TOP_RATED_VALUE = 'top_ratedValue';
const USER_VALUE = 'userValue';
const VIMEO_UPLOADEDBY_VALUE = 'vimeoUploadedByValue';
const VIMEO_LIKES_VALUE = 'vimeoLikesValue';
const VIMEO_APPEARS_IN_VALUE = 'vimeoAppearsInValue';
const VIMEO_SEARCH_VALUE = 'vimeoSearchValue';
const VIMEO_CREDITED_VALUE = 'vimeoCreditedToValue';
const VIMEO_CHANNEL_VALUE = 'vimeoChannelValue';
const VIMEO_ALBUM_VALUE = 'vimeoAlbumValue';
const VIMEO_GROUP_VALUE = 'vimeoGroupValue';
}

View File

@ -1,29 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Widget option names for the plugin
*/
class org_tubepress_api_const_options_names_Widget
{
const TAGSTRING = "widget-tagstring";
const TITLE = "widget-title";
}

View File

@ -1,46 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* TubePress gallery content modes.
*/
class org_tubepress_api_const_options_values_ModeValue
{
const FAVORITES = 'favorites';
const FEATURED = 'recently_featured';
const MOST_DISCUSSED = 'most_discussed';
const MOST_RECENT = 'most_recent';
const MOST_RESPONDED = 'most_responded';
const PLAYLIST = 'playlist';
const POPULAR = 'most_viewed';
const TAG = 'tag';
const TOP_FAVORITES = 'youtubeTopFavorites';
const TOP_RATED = 'top_rated';
const USER = 'user';
const VIMEO_UPLOADEDBY = 'vimeoUploadedBy';
const VIMEO_LIKES = 'vimeoLikes';
const VIMEO_APPEARS_IN = 'vimeoAppearsIn';
const VIMEO_SEARCH = 'vimeoSearch';
const VIMEO_CREDITED = 'vimeoCreditedTo';
const VIMEO_CHANNEL = 'vimeoChannel';
const VIMEO_ALBUM = 'vimeoAlbum';
const VIMEO_GROUP = 'vimeoGroup';
}

View File

@ -1,39 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* TubePress gallery content modes.
*/
class org_tubepress_api_const_options_values_OrderValue
{
const COMMENT_COUNT = 'commentCount';
const DATE_PUBLISHED = 'published';
const DURATION = 'duration';
const NEWEST = 'newest';
const OLDEST = 'oldest';
const POSITION = 'position';
const RANDOM = 'random';
const RATING = 'rating';
const RELEVANCE = 'relevance';
const TITLE = 'title';
const VIEW_COUNT = 'viewCount';
}

View File

@ -1,30 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Output options.
*/
class org_tubepress_api_const_options_values_OutputValue
{
const AJAX_SEARCH_INPUT = 'ajaxSearchInput';
const SEARCH_INPUT = 'searchInput';
const SEARCH_RESULTS = 'searchResults';
}

View File

@ -1,29 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* TubePress gallery content modes.
*/
class org_tubepress_api_const_options_values_PlayerImplementationValue
{
const LONGTAIL = 'longtail';
const PROVIDER_BASED = 'provider_based';
}

View File

@ -1,38 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* TubePress gallery content modes.
*/
class org_tubepress_api_const_options_values_PlayerValue
{
const NORMAL = 'normal';
const POPUP = 'popup';
const SHADOWBOX = 'shadowbox';
const JQMODAL = 'jqmodal';
const VIMEO = 'vimeo';
const YOUTUBE = 'youtube';
const STATICC = 'static';
const SOLO = 'solo';
const FANCYBOX = 'fancybox';
const TINYBOX = 'tinybox';
}

View File

@ -1,30 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* TubePress gallery content modes.
*/
class org_tubepress_api_const_options_values_SafeSearchValue
{
const NONE = 'none';
const MODERATE = 'moderate';
const STRICT = 'strict';
}

View File

@ -1,32 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* TubePress gallery content modes.
*/
class org_tubepress_api_const_options_values_TimeFrameValue
{
const TODAY = 'today';
const THIS_WEEK = 'this_week';
const THIS_MONTH = 'this_month';
const ALL_TIME = 'all_time';
}

View File

@ -1,33 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Query string parameter names.
*/
class org_tubepress_api_const_querystring_QueryParamName
{
const DEBUG = 'tubepress_debug';
const GALLERY_ID = 'tubepress_galleryId';
const PAGE = 'tubepress_page';
const SEARCH_TERMS = 'tubepress_search';
const SHORTCODE = 'tubepress_shortcode';
const VIDEO = 'tubepress_video';
}

View File

@ -1,79 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* TubePress template variables
*/
class org_tubepress_api_const_template_Variable
{
const AUTHOR_URL_PREFIX = 'authorUrlPrefix';
const EMBEDDED_AUTOSTART = 'autostart';
const EMBEDDED_COLOR_HIGHLIGHT = 'embeddedColorHightlight';
const EMBEDDED_COLOR_PRIMARY = 'embeddedColorPrimary';
const EMBEDDED_DATA_URL = 'homeURL';
const EMBEDDED_FULLSCREEN = 'embeddedFullscreen';
const EMBEDDED_HEIGHT = 'embeddedHeight';
const EMBEDDED_IMPL_NAME = 'embeddedImplementationName';
const EMBEDDED_SOURCE = 'embeddedSource';
const EMBEDDED_WIDTH = 'embeddedWidth';
const GALLERY_ID = 'galleryId';
const META_LABELS = 'metaLabels';
const META_SHOULD_SHOW = 'shouldShow';
const OPTIONS_PAGE_CATEGORIES = 'optionsPageCategories';
const OPTIONS_PAGE_CATEGORY_OPTIONS = 'optionsPageCategoryOptions';
const OPTIONS_PAGE_CATEGORY_TITLE = 'optionsPageCategoryTitle';
const OPTIONS_PAGE_INTRO = 'optionsPageIntro';
const OPTIONS_PAGE_OPTIONS_DESC = 'optionsPageOptionsDesc';
const OPTIONS_PAGE_OPTIONS_FILTER = 'optionsPageOptionsFilter';
const OPTIONS_PAGE_OPTIONS_PRO_ONLY = 'optionsPageProOnly';
const OPTIONS_PAGE_OPTIONS_TITLE = 'optionsPageOptionTitle';
const OPTIONS_PAGE_OPTIONS_WIDGET = 'optionsPageOptionsWidget';
const OPTIONS_PAGE_SAVE = 'optionsPageSave';
const OPTIONS_PAGE_TITLE = 'optionsPageTitle';
const OPTIONS_PAGE_VIMEO_OPTION = 'optionsPageVimeoOption';
const OPTIONS_PAGE_YOUTUBE_OPTION = 'optionsPageYouTubeOption';
const PAGINATION_BOTTOM = 'bottomPagination';
const PAGINATION_TOP = 'topPagination';
const PLAYER_HTML = 'preGallery';
const PLAYER_NAME = 'playerName';
const PRE_GALLERY = self::PLAYER_HTML;
const SEARCH_HANDLER_URL = 'searchHandlerUrl';
const SEARCH_HIDDEN_INPUTS = 'searchHiddenInputs';
const SEARCH_BUTTON = 'searchButton';
const SEARCH_TARGET_DOM_ID = 'searchTargetDomId';
const SEARCH_TERMS = 'searchTerms';
const SHORTCODE = 'shortcode';
const THEME_CSS = 'themeCssUrl';
const THUMBNAIL_HEIGHT = 'thumbHeight';
const THUMBNAIL_WIDTH = 'thumbWidth';
const TUBEPRESS_BASE_URL = 'tubepressBaseUrl';
const VIDEO_ARRAY = 'videoArray';
const VIDEO_SEARCH_PREFIX = 'videoSearchPrefix';
const VIDEO = 'video';
const WIDGET_CONTROL_SHORTCODE = 'widgetControlShortcode';
const WIDGET_CONTROL_TITLE = 'widgetControlTitle';
const WIDGET_SHORTCODE = 'widgetShortcode';
const WIDGET_TITLE = 'widgetTitle';
}
class org_tubepress_template_Template extends org_tubepress_api_const_template_Variable {
//the only purpose of this class is for backwards compatibility with user HTML templates :(
}

View File

@ -1,38 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Represents an HTML-embeddable Flash video player
*
*/
interface org_tubepress_api_embedded_EmbeddedPlayer
{
/**
* Spits back the text for this embedded player
*
* @param string $videoId The video ID to display
*
* @throws Exception If something goes wrong.
*
* @return string The text for this embedded player
*/
function toString($videoId);
}

View File

@ -1,40 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Detects TubePress's environment
*/
interface org_tubepress_api_environment_Detector
{
/**
* Detects if the user is running TubePress Pro.
*
* @return boolean True is the user is running TubePress Pro. False otherwise (or if there is a problem detecting the environment).
*/
function isPro();
/**
* Detects if the user is running within WordPress
*
* @return boolean True is the user is running within WordPress (or if there is a problem detecting the environment). False otherwise.
*/
function isWordPress();
}

View File

@ -1,35 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Converts raw video feeds to TubePress videos
*/
interface org_tubepress_api_factory_VideoFactory
{
/**
* Converts raw video feeds to TubePress videos
*
* @param unknown $feed The raw feed result from the video provider
*
* @return array an array of TubePress videos generated from the feed (may be empty).
*/
function feedToVideoArray($feed);
}

View File

@ -1,37 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* TubePress's feed retrieval mechanism
*
*/
interface org_tubepress_api_feed_FeedFetcher
{
/**
* Fetches the feed from the remote provider
*
* @param string $url The URL to fetch.
* @param boolean $useCache Whether or not to use the network cache.
*
* @return unknown The raw feed from the provider
*/
function fetch($url, $useCache);
}

View File

@ -1,35 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Examines the feed results.
*/
interface org_tubepress_api_feed_FeedInspector
{
/**
* Count the total videos in this feed result.
*
* @param unknown $rawFeed The raw video feed (varies depending on provider)
*
* @return int The total result count of this query, or 0 if there was a problem.
*/
function getTotalResultCount($rawFeed);
}

View File

@ -1,74 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Simple class to abstract the response from a video provider
*/
class org_tubepress_api_feed_FeedResult
{
private $_effectiveDisplayCount;
private $_effectiveTotalResultCount;
private $_videoArray;
/**
* Set the video array
*
* @param array $videos The video array.
*
* @return void
*/
public function setVideoArray($videos)
{
$this->_videoArray = $videos;
}
/**
* Set the effective total result count
*
* @param integer $count The effective total result count.
*
* @return void
*/
public function setEffectiveTotalResultCount($count)
{
$this->_effectiveTotalResultCount = $count;
}
/**
* Get the video array
*
* @return array The video array.
*/
public function getVideoArray()
{
return $this->_videoArray;
}
/**
* Get the effective total result count
*
* @return integer The effective total result count.
*/
public function getEffectiveTotalResultCount()
{
return $this->_effectiveTotalResultCount;
}
}

View File

@ -1,55 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Filesystem utilities.
*/
interface org_tubepress_api_filesystem_Explorer
{
/**
* Finds the absolute path of the TubePress installation on the filesystem.
*
* @return string The absolute filesystem path of this TubePress installation.
*/
function getTubePressBaseInstallationPath();
/**
* Find the directories contained in the given directory (non-recursive).
*
* @param string $dir The absolute filesystem path of the directory to examine.
* @param string $prefix The logging prefix.
*
* @return array The names of the directories in the given directory (non-recursive).
*/
function getDirectoriesInDirectory($dir, $prefix);
/**
* Find the files contained in the given directory (non-recursive).
*
* @param string $dir The absolute filesystem path of the directory to examine.
* @param string $prefix The logging prefix.
*
* @return array The names of the files in the given directory (non-recursive).
*/
function getFilenamesInDirectory($dir, $prefix);
function getSystemTempDirectory();
}

View File

@ -1,46 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Handles HTML.
*/
interface org_tubepress_api_html_HtmlGenerator
{
function getHeadJqueryIncludeString();
function getHeadInlineJavaScriptString();
function getHeadTubePressJsIncludeString();
function getHeadTubePressCssIncludeString();
function getHeadMetaString();
/**
* Generates the HTML for TubePress. Could be a gallery or single video.
*
* @param string $shortCodeContent The shortcode content. May be empty or null.
*
* @return The HTML for the given shortcode, or the error message if there was a problem.
*/
function getHtmlForShortcode($shortCodeContent);
}

View File

@ -1,57 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Handles HTTP client functionality.
*/
interface org_tubepress_api_http_HttpClient
{
const HTTP_METHOD_GET = 'GET';
const HTTP_METHOD_POST = 'POST';
const HTTP_METHOD_PUT = 'PUT';
const HTTP_HEADER_ACCEPT_ENCODING = 'Accept-Encoding';
const HTTP_HEADER_CONTENT_LENGTH = 'Content-Length';
const HTTP_HEADER_CONTENT_TYPE = 'Content-Type';
const HTTP_HEADER_USER_AGENT = 'User-Agent';
/**
* Get.
*
* @param string $url URI resource.
*
* @throws Exception If something goes wrong.
*
* @return string Resulting body as a string (could be null)
*/
function get($url);
/**
* Post.
*
* @param string $url URI resource.
* @param unknown $body The HTTP body.
*
* @return string Resulting body as a string (could be null)
*/
function post($url, $body);
}

View File

@ -1,35 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Dependency injector for TubePress
*/
interface org_tubepress_api_ioc_IocService
{
/**
* Get an object from the container by name.
*
* @param string $className The name of the object to retrieve.
*
* @return object The object with the given name.
*/
function get($className);
}

View File

@ -1,35 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* General purpose message abstraction for TubePress
*/
interface org_tubepress_api_message_MessageService
{
/**
* Get the message corresponding to the given key.
*
* @param string $messageKey The message key.
*
* @return string The corresponding message.
*/
function _($messageKey);
}

View File

@ -1,37 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Performs validation on option values
*/
interface org_tubepress_api_options_OptionValidator
{
/**
* Validates an option value. Will throw an Exception if validation
* fails.
*
* @param string $optionName The option name
* @param unknown_type $candidate The candidate option value
*
* @return void
*/
function validate($optionName, $candidate);
}

View File

@ -1,79 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Holds the current options for TubePress. This is the default options,
* usually in persistent storage somewhere, and custom options parsed
* from a shortcode
*/
interface org_tubepress_api_options_OptionsManager
{
/**
* Gets the value of an option
*
* @param string $optionName The name of the option
*
* @return unknown The option value
*/
function get($optionName);
/**
* Sets the value of an option
*
* @param string $optionName The name of the option
* @param unknown $optionValue The option value
*
* @return void
*/
function set($optionName, $optionValue);
/**
* Sets the options that differ from the default options.
*
* @param array $customOpts The custom options.
*
* @return void
*/
function setCustomOptions($customOpts);
/**
* Gets the options that differ from the default options.
*
* @return array The options that differ from the default options.
*/
function getCustomOptions();
/**
* Set the current shortcode.
*
* @param string $newTagString The current shortcode
*
* @return void
*/
function setShortcode($newTagString);
/**
* Get the current shortcode
*
* @return string The current shortcode
*/
function getShortcode();
}

View File

@ -1,62 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Handles persistent storage of TubePress options
*
*/
interface org_tubepress_api_options_StorageManager
{
/**
* Determines if an option exists
*
* @param string $optionName The name of the option in question
*
* @return boolean True if the option exists, false otherwise
*/
function exists($optionName);
/**
* Initializes the storage
*
* @return void
*/
function init();
/**
* Retrieve the current value of an option
*
* @param string $optionName The name of the option
*
* @return unknown_type The option's value
*/
function get($optionName);
/**
* Sets an option value
*
* @param string $optionName The option name
* @param unknown_type $optionValue The option value
*
* @return void
*/
function set($optionName, $optionValue);
}

View File

@ -1,35 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* TubePress gallery pagination service.
*/
interface org_tubepress_api_pagination_Pagination
{
/**
* Get the HTML for pagination.
*
* @param int $totalResults The total number of results in this gallery
*
* @return string The HTML for the pagination.
*/
function getHtml($totalResults);
}

View File

@ -1,47 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Manages the registration and execution of filters.
*/
interface org_tubepress_api_patterns_FilterManager
{
/**
* Run all filters for the specified execution point, giving each filter a chance
* to modify the given value.
*
* @param string $name The execution point name.
* @param unknown_type $value The value to send to the filters.
*
* @return unknown_type The modified value.
*/
function runFilters($name, $value);
/**
* Registers a filter for the specified execution point.
*
* @param string $name The execution point name.
* @param callback $callback The filter callback.
*
* @return void
*/
function registerFilter($name, $callback);
}

View File

@ -1,57 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* A generic strategy.
*/
interface org_tubepress_api_patterns_Strategy
{
/**
* Returns true if this strategy is able to handle
* the request.
*
* @return boolean True if the strategy can handle the request, false otherwise.
*/
function canHandle();
/**
* Execute the strategy.
*
* @return unknown The result of this strategy execution.
*/
function execute();
/**
* Called *before* canHandle() and execute() to allow the strategy
* to initialize itself.
*
* @return void
*/
function start();
/**
* Called *after* canHandle() and execute() to allow the strategy
* to tear itself down.
*
* @return void
*/
function stop();
}

View File

@ -1,35 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Finds the first strategy to execute and executes it.
*/
interface org_tubepress_api_patterns_StrategyManager
{
/**
* Executes the given strategies.
*
* @param array $strategyInstances An array of org_tubepress_api_patterns_Strategy class names to execute.
*
* @return unknown The result of the strategy execution.
*/
function executeStrategy($strategyInstances);
}

View File

@ -1,53 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_video_Video'));
/**
* A TubePress "player", such as lightWindow, GreyBox, popup window, etc
*/
interface org_tubepress_api_player_Player
{
const NORMAL = 'normal';
const POPUP = 'popup';
const SHADOWBOX = 'shadowbox';
const JQMODAL = 'jqmodal';
const YOUTUBE = 'youtube';
const TINYBOX = 'tinybox';
const FANCYBOX = 'fancybox';
const STATICC = 'static';
const SOLO = 'solo';
const VIMEO = 'vimeo';
/**
* Get's the HTML for the TubePress "player"
*
* @param org_tubepress_api_video_Video $vid The video to display in the player.
* @param unknown $galleryId The current gallery ID.
*
* @throws Exception If something goes wrong.
*
* @return string The HTML for this player with the given video.
*/
function getHtml(org_tubepress_api_video_Video $vid, $galleryId);
}

View File

@ -1,50 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_options_OptionsManager'));
/**
* Interface to a remove video provider
*/
interface org_tubepress_api_provider_Provider
{
const DIRECTORY = 'directory';
const YOUTUBE = 'youtube';
const VIMEO = 'vimeo';
/**
* Get the video feed result.
*
* @return org_tubepress_api_feed_FeedResult The feed result, never null.
*/
function getMultipleVideos();
/**
* Fetch a single video.
*
* @param string $customVideoId The video ID to fetch.
*
* @return org_tubepress_api_video_Video The video, or null if there's a problem.
*/
function getSingleVideo($customVideoId);
}

View File

@ -1,43 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Calculates video provider in use.
*/
interface org_tubepress_api_provider_ProviderCalculator
{
/**
* Determine the current video provider.
*
* @return string 'youtube', 'vimeo', or 'directory'
*/
function calculateCurrentVideoProvider();
/**
* Determine the provider of the given video ID.
*
* @param string $videoId The ID of the video to examine.
*
* @return string 'youtube', 'vimeo', or 'directory'
*/
function calculateProviderOfVideoId($videoId);
}

View File

@ -1,74 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Handles some tasks related to the query string
*/
interface org_tubepress_api_querystring_QueryStringService
{
/**
* Try to get the custom video ID from the query string
*
* @param array $getVars The PHP $_GET array
*
* @return string The custom video ID, or '' if not set or if there was a problem.
*/
function getCustomVideo($getVars);
/**
* Try to get the gallery ID from the query string
*
* @param array $getVars The PHP $_GET array
*
* @return string The gallery ID, or '' if not set or if there was a problem.
*/
function getGalleryId($getVars);
/**
* Returns what's in the address bar
*
* @param array $serverVars The PHP $_SERVER array
*
* @return string What's in the address bar
*/
function getFullUrl($serverVars);
/**
* Try to figure out what page we're on by looking at the query string
* Defaults to '1' if there's any doubt
*
* @param array $getVars The PHP $_GET array
*
* @return int The page number, or 1 if there was a problem.
*/
function getPageNum($getVars);
/**
* Try to get the shortcode from the query string
*
* @param array $getVars The PHP $_GET array
*
* @return string The shortcode, or '' if not set or if there was a problem.
*/
function getShortcode($getVars);
function getSearchTerms($getVars);
}

View File

@ -1,46 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Parses shortcodes.
*/
interface org_tubepress_api_shortcode_ShortcodeParser
{
/**
* This function is used to parse a shortcode into options that TubePress can use.
*
* @param string $content The haystack in which to search
*
* @return array The associative array of parsed options.
*/
function parse($content);
/**
* Determines if the given content contains a shortcode.
*
* @param string $content The content to search through
* @param string $trigger The shortcode trigger word
*
* @return boolean True if there's a shortcode in the content, false otherwise.
*/
function somethingToParse($content, $trigger = "tubepress");
}

View File

@ -1,36 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Handles requests for a single video (for embedding)
*/
interface org_tubepress_api_single_SingleVideo
{
/**
* Get the HTML for a single video display.
*
* @param string $videoId The ID of the video to display.
*
* @return string The HTML for the single video display.
*/
function getSingleVideoHtml($videoId);
}

View File

@ -1,63 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* TubePress template
*/
interface org_tubepress_api_template_Template
{
/**
* Converts this template to a string
*
*@throws Exception If there was a problem.
*
* @return string The string representation of this template.
*/
function toString();
/**
* Sets the path of this template.
*
* @param string $path The absolute path on the filesystem of this template.
*
* @throws Exception If there was a problem.
*
* @return void
*/
function setPath($path);
/**
* Set a template variable.
*
* @param string $name The name of the template variable to set.
* @param unknown $value The value of the template variable.
*
* @return void
*/
function setVariable($name, $value);
/**
* Resets this template for use. Clears out any set variables.
*
* @return void
*/
function reset();
}

View File

@ -1,54 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* TubePress theme handler.
*/
interface org_tubepress_api_theme_ThemeHandler
{
/**
* Gets an instance of a template appropriate for the current theme.
*
* @param string $pathToTemplate The relative path (from the root of the theme directory) to the template.
*
* @throws Exception If there was a problem.
*
* @return org_tubepress_api_template_Template The template instance.
*/
function getTemplateInstance($pathToTemplate);
/**
* Returns the URL of the CSS stylesheet for the given theme.
*
* @param string $currentTheme The name of the theme.
* @param boolean $relative Whether or not to include the full URL or just the portion relative to $tubepress_base_url
*
* @return string The URl of the CSS stylesheet.
*/
function getCssPath($currentTheme, $relative = false);
/**
* Returns the name of the current TubePress theme in use.
*
* @return string The current theme name, or 'default' if the default theme is in use or if there was a problem.
*/
function calculateCurrentThemeName();
}

View File

@ -1,294 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* URL class. Lifted mostly from PEAR's Net_URL2 class.
*/
class org_tubepress_api_url_Url
{
/**
* @var string|bool
*/
private $_scheme = false;
/**
* @var string|bool
*/
private $_userinfo = false;
/**
* @var string|bool
*/
private $_host = false;
/**
* @var string|bool
*/
private $_port = false;
/**
* @var string
*/
private $_path = '';
/**
* @var string|bool
*/
private $_query = false;
/**
* @var string|bool
*/
private $_fragment = false;
/**
* Constructor.
*
* @param string $url an absolute or relative URL
*/
public function __construct($url)
{
// The regular expression is copied verbatim from RFC 3986, appendix B.
// The expression does not validate the URL but matches any string.
preg_match('!^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?!', $url, $matches);
// "path" is always present (possibly as an empty string); the rest
// are optional.
$this->_scheme = !empty($matches[1]) ? $matches[2] : false;
$this->setAuthority(!empty($matches[3]) ? $matches[4] : false);
$this->_path = $matches[5];
$this->_query = !empty($matches[6]) ? $matches[7] : false;
$this->_fragment = !empty($matches[8]) ? $matches[9] : false;
}
/**
* Sets the query string to the specified variable in the query string.
*
* @param array $array (name => value) array
*
* @return void
*/
public function setQueryVariables(array $array)
{
if (!$array) {
$this->_query = false;
} else {
foreach ($array as $name => $value) {
$name = self::urlencode($name);
if (is_array($value)) {
foreach ($value as $k => $v) {
$parts[] = sprintf('%s[%s]=%s', $name, $k, $v);
}
} elseif (!is_null($value)) {
$parts[] = $name . '=' . self::urlencode($value);
} else {
$parts[] = $name;
}
}
$this->_query = implode('&', $parts);
}
}
/**
* Sets the specified variable in the query string.
*
* @param string $name variable name
* @param mixed $value variable value
*
* @return array
*/
public function setQueryVariable($name, $value)
{
$array = $this->getQueryVariables();
$array[$name] = $value;
$this->setQueryVariables($array);
}
/**
* Removes the specifed variable from the query string.
*
* @param string $name a query string variable, e.g. "foo" in "?foo=1"
*
* @return void
*/
public function unsetQueryVariable($name)
{
$array = $this->getQueryVariables();
unset($array[$name]);
$this->setQueryVariables($array);
}
/**
* Returns a string representation of this URL.
*
* @return string
*/
public function toString($encodeAmpersands = false)
{
// See RFC 3986, section 5.3
$url = "";
if ($this->_scheme !== false) {
$url .= $this->_scheme . ':';
}
$authority = $this->getAuthority();
if ($authority !== false) {
$url .= '//' . $authority;
}
$url .= $this->_path;
if ($this->_query !== false) {
$url .= '?' . $this->_query;
}
if ($this->_fragment !== false) {
$url .= '#' . $this->_fragment;
}
if ($encodeAmpersands) {
return str_replace("&", "&amp;", $url);
}
return $url;
}
/**
* Percent-encodes all non-alphanumeric characters except these: _ . - ~
* Similar to PHP's rawurlencode(), except that it also encodes ~ in PHP
* 5.2.x and earlier.
*
* @param $raw the string to encode
* @return string
*/
public static function urlencode($string)
{
$encoded = rawurlencode($string);
// This is only necessary in PHP < 5.3.
$encoded = str_replace('%7E', '~', $encoded);
return $encoded;
}
/**
* Sets the authority part, i.e. [ userinfo "@" ] host [ ":" port ]. Specify
* false if there is no authority.
*
* @param string|false $authority a hostname or an IP addresse, possibly
* with userinfo prefixed and port number
* appended, e.g. "foo:bar@example.org:81".
*
* @return void
*/
public function setAuthority($authority)
{
$this->_userinfo = false;
$this->_host = false;
$this->_port = false;
if (preg_match('@^(([^\@]*)\@)?([^:]+)(:(\d*))?$@', $authority, $reg)) {
if ($reg[1]) {
$this->_userinfo = $reg[2];
}
$this->_host = $reg[3];
if (isset($reg[5])) {
$this->_port = $reg[5];
}
}
}
/**
* Returns the authority part, i.e. [ userinfo "@" ] host [ ":" port ], or
* false if there is no authority.
*
* @return string|bool
*/
public function getAuthority()
{
if (!$this->_host) {
return false;
}
$authority = '';
if ($this->_userinfo !== false) {
$authority .= $this->_userinfo . '@';
}
$authority .= $this->_host;
if ($this->_port !== false) {
$authority .= ':' . $this->_port;
}
return $authority;
}
/**
* Returns the query string like an array as the variables would appear in
* $_GET in a PHP script. If the URL does not contain a "?", an empty array
* is returned.
*
* @return array
*/
public function getQueryVariables()
{
$pattern = '/[' . preg_quote('&', '/') . ']/';
$parts = preg_split($pattern, $this->_query, -1, PREG_SPLIT_NO_EMPTY);
$return = array();
foreach ($parts as $part) {
if (strpos($part, '=') !== false) {
list($key, $value) = explode('=', $part, 2);
} else {
$key = $part;
$value = null;
}
$key = rawurldecode($key);
$value = rawurldecode($value);
if (preg_match('#^(.*)\[([0-9a-z_-]*)\]#i', $key, $matches)) {
$key = $matches[1];
$idx = $matches[2];
// Ensure is an array
if (empty($return[$key]) || !is_array($return[$key])) {
$return[$key] = array();
}
// Add data
if ($idx === '') {
$return[$key][] = $value;
} else {
$return[$key][$idx] = $value;
}
} else {
$return[$key] = $value;
}
}
return $return;
}
}

View File

@ -1,49 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Builds URLs to send out to a remote provider
*
*/
interface org_tubepress_api_url_UrlBuilder
{
/**
* Builds a URL for a list of videos
*
* @param int $currentPage The current page number of the gallery.
*
* @throws Exception If there was a problem.
*
* @return string The request URL for this gallery
*/
function buildGalleryUrl($currentPage);
/**
* Builds a request url for a single video
*
* @param string $id The video ID to search for
*
* @throws Exception If there was a problem.
*
* @return string The URL for the single video given.
*/
function buildSingleVideoUrl($id);
}

View File

@ -1,100 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* A video object that TubePress processes
*/
class org_tubepress_api_video_Video
{
private $_authorDisplayName;
private $_authorUid;
private $_category;
private $_commentCount;
private $_description;
private $_duration;
private $_homeUrl;
private $_id;
private $_keywords;
private $_likesCount;
private $_ratingAverage;
private $_ratingCount;
private $_thumbnailUrl;
private $_timeLastUpdated;
private $_timePublished;
private $_title;
private $_viewCount;
public function __construct()
{
$this->_keywords = array();
}
public function getAuthorDisplayName() { return $this->_authorDisplayName; }
public function setAuthorDisplayName($author) { $this->_authorDisplayName = $author; }
public function getAuthorUid() { return $this->_authorUid; }
public function setAuthorUid($author) { $this->_authorUid = $author; }
public function getCategory() { return $this->_category; }
public function setCategory($category) { $this->_category = $category; }
public function getCommentCount() { return $this->_commentCount; }
public function setCommentCount($count) { $this->_commentCount = $count; }
public function getDescription() { return $this->_description; }
public function setDescription($description) { $this->_description = $description; }
public function getDuration() { return $this->_duration; }
public function setDuration($duration) { $this->_duration = $duration; }
public function getHomeUrl() { return $this->_homeUrl; }
public function setHomeUrl($url) { $this->_homeUrl = $url; }
public function getId() { return $this->_id; }
public function setId($id) { $this->_id = $id; }
public function getKeywords() { return $this->_keywords; }
public function setKeywords($keywords) { $this->_keywords = $keywords; }
public function getLikesCount() { return $this->_likesCount; }
public function setLikesCount($c) { $this->_likesCount = $c; }
public function getRatingAverage() { return $this->_ratingAverage; }
public function setRatingAverage($average) { $this->_ratingAverage = $average; }
public function getRatingCount() { return $this->_ratingCount; }
public function setRatingCount($count) { $this->_ratingCount = $count; }
public function getThumbnailUrl() { return $this->_thumbnailUrl; }
public function setThumbnailUrl($url) { $this->_thumbnailUrl = $url; }
public function getTimeLastUpdated() { return $this->_timeLastUpdated; }
public function setTimeLastUpdated($time) { $this->_timeLastUpdated = $time; }
public function getTimePublished() { return $this->_timePublished; }
public function setTimePublished($time) { $this->_timePublished = $time; }
public function getTitle() { return $this->_title; }
public function setTitle($title) { $this->_title = $title; }
public function getViewCount() { return $this->_viewCount; }
public function setViewCount($count) { $this->_viewCount = $count; }
}

View File

@ -1,125 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_bootstrap_Bootstrapper',
'org_tubepress_impl_log_Log',
'org_tubepress_api_const_filters_ExecutionPoint'));
/**
* Performs TubePress-wide initialization.
*/
abstract class org_tubepress_impl_bootstrap_AbstractBootstrapper implements org_tubepress_api_bootstrap_Bootstrapper
{
private static $_alreadyBooted = false;
/**
* Performs TubePress-wide initialization.
*
* @return null
*/
public function boot()
{
try {
$this->_wrappedBoot();
} catch (Exception $e) {
org_tubepress_impl_log_Log::log($this->_getName(), 'Caught exception while booting: '. $e->getMessage());
}
}
private function _wrappedBoot()
{
/* don't boot twice! */
if (self::$_alreadyBooted) {
return;
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$envDetector = $ioc->get('org_tubepress_api_environment_Detector');
/* WordPress likes to keep control of the output */
if ($envDetector->isWordPress()) {
ob_start();
}
/* Turn on logging if we need to */
org_tubepress_impl_log_Log::setEnabled($tpom->get(org_tubepress_api_const_options_names_Advanced::DEBUG_ON), $_GET);
org_tubepress_impl_log_Log::log($this->_getName(), 'Booting!');
/* register default filters */
$fs = $ioc->get('org_tubepress_api_filesystem_Explorer');
$baseDir = $fs->getTubePressBaseInstallationPath() . '/sys/classes/org/tubepress/impl/filters/';
$this->_loadFilters($baseDir . 'html', $fs, $ioc);
$this->_loadFilters($baseDir . 'template', $fs, $ioc);
$this->_loadFilters($baseDir . 'feedresult', $fs, $ioc);
/* continue booting process */
$this->_doBoot();
/* remember that we booted. */
self::$_alreadyBooted = true;
}
/**
* Get the name of this bootstrapper.
*
* @return void
*/
protected abstract function _getName();
/**
* Perform boot procedure.
*
* @return void
*/
protected abstract function _doBoot();
private function _loadFilters($directory, $fs, $ioc)
{
org_tubepress_impl_log_Log::log($this->_getName(), 'Loading TubePress filters from <tt>%s</tt>', $directory);
/* get a list of the files in the directory */
$pluginPaths = $fs->getFilenamesInDirectory($directory, $this->_getName());
/* we want to provide the filter manager to the filters */
$tubepressFilterManager = $ioc->get('org_tubepress_api_patterns_FilterManager');
/* include the PHP files that we can read */
foreach ($pluginPaths as $pluginPath) {
if ('.php' == substr($pluginPath, -4) && is_readable($pluginPath)) {
org_tubepress_impl_log_Log::log($this->_getName(), 'Loading TubePress filter at <tt>%s</tt>', $pluginPath);
include_once $pluginPath;
} else {
org_tubepress_impl_log_Log::log($this->_getName(), 'Ignoring non-filter file at <tt>%s</tt>', $pluginPath);
}
}
}
}

View File

@ -1,78 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_bootstrap_AbstractBootstrapper',
'org_tubepress_impl_env_wordpress_Main',
'org_tubepress_impl_env_wordpress_Admin',
'org_tubepress_impl_env_wordpress_Widget'));
/**
* Performs WordPress initialization.
*/
class org_tubepress_impl_bootstrap_FreeWordPressPluginBootstrapper extends org_tubepress_impl_bootstrap_AbstractBootstrapper
{
/**
* Perform boot procedure.
*
* @return void
*/
protected function _doBoot()
{
global $tubepress_base_url;
$baseName = $this->getBaseName();
/* set the tubepress_base_url global */
$tubepress_base_url = get_option('siteurl') . "/wp-content/plugins/$baseName";
/* register the plugin's message bundles */
load_plugin_textdomain('tubepress', false, "$baseName/sys/i18n");
add_filter('the_content', array('org_tubepress_impl_env_wordpress_Main', 'contentFilter'));
add_action('wp_head', array('org_tubepress_impl_env_wordpress_Main', 'headAction'));
add_action('init', array('org_tubepress_impl_env_wordpress_Main', 'initAction'));
add_action('admin_menu', array('org_tubepress_impl_env_wordpress_Admin', 'menuAction'));
add_action('admin_init', array('org_tubepress_impl_env_wordpress_Admin', 'initAction'));
add_action('widgets_init', array('org_tubepress_impl_env_wordpress_Widget', 'initAction'));
}
/**
* Get the name of this bootstrapper.
*
* @return void
*/
protected function _getName()
{
return 'WordPress Bootstrapper';
}
protected function getBaseName()
{
/* have to consider that sometimes people may name the "tubepress" directory differently */
$dirName = realpath(dirname(__FILE__) . '/../../../../../../');
return basename($dirName);
}
}

View File

@ -1,359 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*
* Fast, light and safe Cache Class lifted almost entirely from PEAR's Cache_Lite class.
*
* Cache_Lite is a fast, light and safe cache system. It's optimized
* for file containers. It is fast and safe (because it uses file
* locking and/or anti-corruption tests).
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_cache_Cache',
'org_tubepress_impl_log_Log',
'org_tubepress_impl_filesystem_FsExplorer'));
class org_tubepress_impl_cache_PearCacheLiteCacheService implements org_tubepress_api_cache_Cache
{
const HASH_DIR_LEVEL = 1;
const HASH_DIR_UMASK = 0700;
const LOG_PREFIX = 'Cache_Lite Cache';
/**
* Test if a cache is available and (if yes) return it
*
* @param string $id cache id
*
* @return string data of the cache (else : false)
*/
public function get($id)
{
try {
return $this->_wrappedGet($id);
} catch (Exception $e) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Caught exception when running "get": ' . $e->getMessage());
return false;
}
}
private function _wrappedGet($id)
{
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$life = $tpom->get(org_tubepress_api_const_options_names_Advanced::CACHE_LIFETIME_SECONDS);
$data = false;
$refreshTime = $this->_getRefreshTime($life);
$file = $this->_getFileWithPath($id, $ioc);
clearstatcache();
if (is_null($refreshTime)) {
if (file_exists($file)) {
$data = $this->_read($file, $life);
}
} else {
if ((file_exists($file)) && (@filemtime($file) > $refreshTime)) {
$data = $this->_read($file, $life);
}
}
return $data;
}
/**
* Save some data in a cache file
*
* @param string $id cache id
* @param string $data data to put in cache
*
* @return boolean true if no problem (else : false)
*/
public function save($id, $data)
{
try {
return $this->_wrappedSave($id, $data);
} catch (Exception $e) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Caught exception when saving: ' . $e->getMessage());
return false;
}
}
private function _wrappedSave($id, $data)
{
if (!is_string($data)) {
throw new Exception("Cache can only save string data");
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$life = $tpom->get(org_tubepress_api_const_options_names_Advanced::CACHE_LIFETIME_SECONDS);
$cleaningFactor = $tpom->get(org_tubepress_api_const_options_names_Advanced::CACHE_CLEAN_FACTOR);
$file = $this->_getFileWithPath($id, $ioc);
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Saving data to key at %s and file %s. Cleaning factor is %d', $id, $file, $cleaningFactor);
if ($cleaningFactor > 0) {
$rand = rand(1, $cleaningFactor);
if ($rand == 1) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Cleaning out old cache entries');
$this->_cleanDir($this->_getCacheDir($ioc));
}
}
$res = $this->_writeAndControl($id, $data, $life, $file, $ioc);
if (is_bool($res)) {
if ($res) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Saved data to key at %s', $id);
return true;
}
// if $res if false, we need to invalidate the cache
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Invalidating cache under key at %s', $id);
@touch($file, time() - 2 * abs($life));
return false;
}
return $res;
}
/**
* Should only be called during testing!
*
* @return void
*/
public function clean()
{
$this->_cleanDir($this->_getCacheDir(org_tubepress_impl_ioc_IocContainer::getInstance()));
}
/**
* Compute & set the refresh time
*
* @param int $life The current cache lifetime.
*
* @return int The Unix time when a cache item must be refreshed.
*/
private function _getRefreshTime($life)
{
if ($life === 0) {
return null;
} else {
return time() - $life;
}
}
/**
* Remove a file
*
* @param string $file complete file path and name
*
* @return boolean true if no problem
*/
private function _unlink($file)
{
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Removing file at %s', $file);
if (!@unlink($file)) {
throw new Exception('Cache_Lite : Unable to remove cache file at ' . $file);
}
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Removed file at %s', $file);
return true;
}
/**
* Recursive function for cleaning cache file in the given directory
*
* @param string $dir directory complete path (with a trailing slash)
*
* @return boolean true if no problem
*/
private function _cleanDir($dir)
{
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Removing cache files under directory at %s', $dir);
$motif = 'cache_';
if (!($dh = @opendir($dir))) {
return;
}
$result = true;
while ($file = readdir($dh)) {
if (($file != '.') && ($file != '..')) {
if (substr($file, 0, 6) == 'cache_') {
$fileTwo = $dir . $file;
if (is_file($fileTwo)) {
if (strpos($fileTwo, $motif) !== false) {
$result = ($result and ($this->_unlink($fileTwo)));
}
}
if ((is_dir($fileTwo)) and (self::HASH_DIR_LEVEL > 0)) {
$result = ($result and ($this->_cleanDir($fileTwo . '/')));
}
}
}
}
return $result;
}
private function _getFileWithoutPath($id)
{
return 'cache_' . md5($id);
}
private function _getFileWithPath($id, $ioc)
{
$suffix = $this->_getFileWithoutPath($id);
$root = $this->_getCacheDir($ioc);
if (self::HASH_DIR_LEVEL > 0) {
$hash = md5($suffix);
for ($i=0 ; $i < self::HASH_DIR_LEVEL ; $i++) {
$root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
}
}
return $root . $suffix;
}
private function _read($file, $life)
{
$fp = @fopen($file, "rb");
@flock($fp, LOCK_SH);
if (!$fp) {
throw new Exception('Unable to read cache file at ' . $file);
}
clearstatcache();
$length = @filesize($file);
$hashControl = @fread($fp, 32);
$length = $length - 32;
if ($length) {
$data = @fread($fp, $length);
} else {
$data = '';
}
@flock($fp, LOCK_UN);
@fclose($fp);
$hashData = $this->_hash($data);
if ($hashData != $hashControl) {
if (!(is_null($life))) {
@touch($file, time() - 2*abs($life));
} else {
@unlink($file);
}
return false;
}
return $data;
}
private function _write($id, $data, $ioc)
{
$file = $this->_getFileWithPath($id, $ioc);
$cacheDir = $this->_getCacheDir($ioc);
if (self::HASH_DIR_LEVEL > 0) {
$hash = md5($file);
$root = $cacheDir;
for ($i=0 ; $i < self::HASH_DIR_LEVEL ; $i++) {
$root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
if (!(@is_dir($root))) {
@mkdir($root, self::HASH_DIR_UMASK, true);
}
}
}
$dir = dirname($file);
if (!@is_dir($dir)) {
@mkdir($dir, self::HASH_DIR_UMASK, true);
}
$fp = @fopen($file, "wb");
if (!$fp) {
throw new Exception('Unable to write cache file : ' . $file);
}
@flock($fp, LOCK_EX);
@fwrite($fp, $this->_hash($data), 32);
@fwrite($fp, $data);
@flock($fp, LOCK_UN);
@fclose($fp);
return true;
}
private function _writeAndControl($id, $data, $life, $file, $ioc)
{
$result = $this->_write($id, $data, $ioc);
$dataRead = $this->_read($file, $life);
if ((is_bool($dataRead)) && (!$dataRead)) {
return false;
}
return $dataRead == $data;
}
private function _hash($data)
{
return sprintf('% 32d', crc32($data));
}
private function _getCacheDir($ioc)
{
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$cacheDir = $tpom->get(org_tubepress_api_const_options_names_Advanced::CACHE_DIR);
if ($cacheDir != '') {
return $cacheDir;
}
$fs = $ioc->get('org_tubepress_api_filesystem_Explorer');
$tempDir = $fs->getSystemTempDirectory();
if (!is_dir($tempDir)) {
throw new Exception('Could not determine location of system temp directory');
}
return $tempDir . '/tubepress_cache/';
}
}

View File

@ -1,58 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_patterns_StrategyManager',
'org_tubepress_api_embedded_EmbeddedPlayer',
'org_tubepress_impl_ioc_IocContainer',
'org_tubepress_api_provider_ProviderCalculator'));
/**
* An HTML-embeddable video player.
*/
class org_tubepress_impl_embedded_DelegatingEmbeddedPlayer implements org_tubepress_api_embedded_EmbeddedPlayer
{
/**
* Spits back the HTML for this embedded player
*
* @param string $videoId The video ID to display
*
* @return string The HTML for this embedded player
*/
public function toString($videoId)
{
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$pc = $ioc->get('org_tubepress_api_provider_ProviderCalculator');
$sm = $ioc->get('org_tubepress_api_patterns_StrategyManager');
//TODO: what if this bails?
$providerName = $pc->calculateProviderOfVideoId($videoId);
/* let the strategies do the heavy lifting */
//TODO: what if this bails?
return $sm->executeStrategy(array(
'org_tubepress_impl_embedded_strategies_JwFlvEmbeddedStrategy',
'org_tubepress_impl_embedded_strategies_YouTubeIframeEmbeddedStrategy',
'org_tubepress_impl_embedded_strategies_VimeoEmbeddedStrategy'
), $providerName, $videoId);
}
}

View File

@ -1,74 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
/**
* Embedded player utilities
*
*/
class org_tubepress_impl_embedded_EmbeddedPlayerUtils
{
/**
* Returns a valid HTML color.
*
* @param string $candidate The first-choice HTML color. May be invalid.
* @param string $default The fallback HTML color. Must be be invalid.
*
* @return string $candidate if it's a valid HTML color. $default otherwise.
*/
public static function getSafeColorValue($candidate, $default)
{
$pattern = '/^[0-9a-fA-F]{6}$/';
if (preg_match($pattern, $candidate) === 1) {
return $candidate;
}
return $default;
}
/**
* Converts a boolean value to a string 1 or 0.
*
* @param boolean $bool The boolean value to convert.
*
* @return string '1' or '0'
*/
public static function booleanToOneOrZero($bool)
{
if ($bool === '1' || $bool === '0') {
return $bool;
}
return $bool ? '1' : '0';
}
/**
* Converts a boolean value to string.
*
* @param boolean $bool The boolean value to convert.
*
* @return string 'true' or 'false'
*/
public static function booleanToString($bool)
{
return $bool ? 'true' : 'false';
}
}

View File

@ -1,122 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_patterns_Strategy',
'org_tubepress_impl_ioc_IocContainer',
'org_tubepress_api_const_options_names_Embedded',
'org_tubepress_impl_embedded_EmbeddedPlayerUtils',
'org_tubepress_api_options_OptionsManager'));
/**
* Base class for embedded strategies.
*/
abstract class org_tubepress_impl_embedded_strategies_AbstractEmbeddedStrategy implements org_tubepress_api_patterns_Strategy
{
private $_ioc;
private $_tpom;
/**
* Called *before* canHandle() and execute() to allow the strategy
* to initialize itself.
*/
public function start()
{
$this->_ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$this->_tpom = $this->_ioc->get('org_tubepress_api_options_OptionsManager');
}
/**
* Called *after* canHandle() and execute() to allow the strategy
* to tear itself down.
*/
public function stop()
{
unset($this->_ioc);
unset($this->_tpom);
}
/**
* Returns true if this strategy is able to handle
* the request.
*/
public function canHandle()
{
/* grab the arguments */
$args = func_get_args();
self::_checkArgs($args);
$providerName = $args[0];
$videoId = $args[1];
return $this->_canHandle($providerName, $videoId, $this->_ioc, $this->_tpom);
}
/**
* Execute the strategy.
*/
public function execute()
{
global $tubepress_base_url;
$args = func_get_args();
self::_checkArgs($args);
$providerName = $args[0];
$videoId = $args[1];
$theme = $this->_ioc->get('org_tubepress_api_theme_ThemeHandler');
$template = $theme->getTemplateInstance($this->_getTemplatePath($providerName, $videoId, $this->_ioc, $this->_tpom));
$fullscreen = $this->_tpom->get(org_tubepress_api_const_options_names_Embedded::FULLSCREEN);
$playerColor = org_tubepress_impl_embedded_EmbeddedPlayerUtils::getSafeColorValue($this->_tpom->get(org_tubepress_api_const_options_names_Embedded::PLAYER_COLOR), '999999');
$playerHighlight = org_tubepress_impl_embedded_EmbeddedPlayerUtils::getSafeColorValue($this->_tpom->get(org_tubepress_api_const_options_names_Embedded::PLAYER_HIGHLIGHT), 'FFFFFF');
$autoPlay = $this->_tpom->get(org_tubepress_api_const_options_names_Embedded::AUTOPLAY);
$template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_DATA_URL, $this->_getEmbeddedDataUrl($providerName, $videoId, $this->_ioc, $this->_tpom));
$template->setVariable(org_tubepress_api_const_template_Variable::TUBEPRESS_BASE_URL, $tubepress_base_url);
$template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_AUTOSTART, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToString($autoPlay));
$template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_WIDTH, $this->_tpom->get(org_tubepress_api_const_options_names_Embedded::EMBEDDED_WIDTH));
$template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_HEIGHT, $this->_tpom->get(org_tubepress_api_const_options_names_Embedded::EMBEDDED_HEIGHT));
$template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_COLOR_PRIMARY, $playerColor);
$template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_COLOR_HIGHLIGHT, $playerHighlight);
$template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_FULLSCREEN, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToString($fullscreen));
return $template->toString();
}
protected abstract function _canHandle($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom);
protected abstract function _getTemplatePath($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom);
protected abstract function _getEmbeddedDataUrl($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom);
private static function _checkArgs($args)
{
/* a little sanity checking */
if (count($args) !== 2) {
throw new Exception(sprintf("Wrong argument count sent to canHandle(). Expects 2, you sent %d", count($args)));
}
}
}
?>

View File

@ -1,67 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_embedded_strategies_AbstractEmbeddedStrategy',
'org_tubepress_api_ioc_IocService',
'org_tubepress_impl_embedded_EmbeddedPlayerUtils',
'org_tubepress_api_const_options_names_Embedded',
'org_tubepress_api_options_OptionsManager',
'org_tubepress_api_url_Url'));
/**
* Embedded player strategy for YouTube embeds
*/
abstract class org_tubepress_impl_embedded_strategies_AbstractYouTubeEmbeddedStrategy extends org_tubepress_impl_embedded_strategies_AbstractEmbeddedStrategy
{
protected function _getEmbeddedDataUrl($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom)
{
$link = new org_tubepress_api_url_Url($this->_getUrlBaseWithoutTrailingSlash() . '/' . $videoId);
$showRelated = $tpom->get(org_tubepress_api_const_options_names_Embedded::SHOW_RELATED);
$autoPlay = $tpom->get(org_tubepress_api_const_options_names_Embedded::AUTOPLAY);
$loop = $tpom->get(org_tubepress_api_const_options_names_Embedded::LOOP);
$fullscreen = $tpom->get(org_tubepress_api_const_options_names_Embedded::FULLSCREEN);
$playerColor = org_tubepress_impl_embedded_EmbeddedPlayerUtils::getSafeColorValue($tpom->get(org_tubepress_api_const_options_names_Embedded::PLAYER_COLOR), '999999');
$playerHighlight = org_tubepress_impl_embedded_EmbeddedPlayerUtils::getSafeColorValue($tpom->get(org_tubepress_api_const_options_names_Embedded::PLAYER_HIGHLIGHT), 'FFFFFF');
$showInfo = $tpom->get(org_tubepress_api_const_options_names_Embedded::SHOW_INFO);
if (!($playerColor == '999999' && $playerHighlight == 'FFFFFF')) {
$link->setQueryVariable('color2', '0x' . $playerColor);
$link->setQueryVariable('color1', '0x' . $playerHighlight);
}
$link->setQueryVariable('rel', org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showRelated));
$link->setQueryVariable('autoplay', org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($autoPlay));
$link->setQueryVariable('loop', org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($loop));
$link->setQueryVariable('fs', org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($fullscreen));
$link->setQueryVariable('showinfo', org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
if ($tpom->get(org_tubepress_api_const_options_names_Embedded::HIGH_QUALITY)) {
$link->setQueryVariable('hd', '1');
}
return $link->toString(true);
}
protected abstract function _getUrlBaseWithoutTrailingSlash();
}

View File

@ -1,54 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_embedded_strategies_AbstractEmbeddedStrategy',
'org_tubepress_api_ioc_IocService',
'org_tubepress_api_url_Url',
'org_tubepress_api_const_options_names_Embedded',
'org_tubepress_api_options_OptionsManager'));
/**
* Embedded player strategy for the JW FLV player
*/
class org_tubepress_impl_embedded_strategies_JwFlvEmbeddedStrategy extends org_tubepress_impl_embedded_strategies_AbstractEmbeddedStrategy
{
protected function _canHandle($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom)
{
return $providerName === org_tubepress_api_provider_Provider::YOUTUBE
&& $tpom->get(org_tubepress_api_const_options_names_Embedded::PLAYER_IMPL) === org_tubepress_api_const_options_values_PlayerImplementationValue::LONGTAIL;
}
protected function _getTemplatePath($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom)
{
return 'embedded_flash/longtail.tpl.php';
}
protected function _getEmbeddedDataUrl($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom)
{
$link = new org_tubepress_api_url_Url(sprintf('http://www.youtube.com/watch?v=%s', $videoId));
return $link->toString(true);
}
}
?>

View File

@ -1,73 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_embedded_strategies_AbstractEmbeddedStrategy',
'org_tubepress_api_ioc_IocService',
'org_tubepress_api_options_OptionsManager',
'org_tubepress_impl_embedded_EmbeddedPlayerUtils',
'org_tubepress_api_const_options_names_Embedded',
'org_tubepress_api_provider_Provider',
'org_tubepress_api_url_Url'));
/**
* Embedded player strategy for native Vimeo
*/
class org_tubepress_impl_embedded_strategies_VimeoEmbeddedStrategy extends org_tubepress_impl_embedded_strategies_AbstractEmbeddedStrategy
{
const VIMEO_EMBEDDED_PLAYER_URL = 'http://player.vimeo.com/';
const VIMEO_QUERYPARAM_AUTOPLAY = 'autoplay';
const VIMEO_QUERYPARAM_TITLE = 'title';
const VIMEO_QUERYPARAM_BYLINE = 'byline';
const VIMEO_QUERYPARAM_COLOR = 'color';
const VIMEO_QUERYPARAM_LOOP = 'loop';
const VIMEO_QUERYPARAM_PORTRAIT = 'portrait';
protected function _canHandle($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom)
{
return $providerName === org_tubepress_api_provider_Provider::VIMEO;
}
protected function _getTemplatePath($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom)
{
return 'embedded_flash/vimeo.tpl.php';
}
protected function _getEmbeddedDataUrl($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom)
{
$autoPlay = $tpom->get(org_tubepress_api_const_options_names_Embedded::AUTOPLAY);
$color = $tpom->get(org_tubepress_api_const_options_names_Embedded::PLAYER_COLOR);
$showInfo = $tpom->get(org_tubepress_api_const_options_names_Embedded::SHOW_INFO);
$loop = $tpom->get(org_tubepress_api_const_options_names_Embedded::LOOP);
/* build the data URL based on these options */
$link = new org_tubepress_api_url_Url(self::VIMEO_EMBEDDED_PLAYER_URL . "video/$videoId");
$link->setQueryVariable(self::VIMEO_QUERYPARAM_AUTOPLAY, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($autoPlay));
$link->setQueryVariable(self::VIMEO_QUERYPARAM_COLOR, $color);
$link->setQueryVariable(self::VIMEO_QUERYPARAM_LOOP, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($loop));
$link->setQueryVariable(self::VIMEO_QUERYPARAM_TITLE, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
$link->setQueryVariable(self::VIMEO_QUERYPARAM_BYLINE, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
$link->setQueryVariable(self::VIMEO_QUERYPARAM_PORTRAIT, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
return $link->toString(true);
}
}

View File

@ -1,50 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_embedded_strategies_AbstractYouTubeEmbeddedStrategy',
'org_tubepress_api_ioc_IocService',
'org_tubepress_api_options_OptionsManager',
'org_tubepress_api_const_options_names_Embedded',
'org_tubepress_api_provider_Provider',
'org_tubepress_api_embedded_EmbeddedPlayer'));
/**
* Embedded player strategy for YouTube iframe embeds
*/
class org_tubepress_impl_embedded_strategies_YouTubeIframeEmbeddedStrategy extends org_tubepress_impl_embedded_strategies_AbstractYouTubeEmbeddedStrategy
{
protected function _canHandle($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom)
{
return $providerName === org_tubepress_api_provider_Provider::YOUTUBE;
}
protected function _getTemplatePath($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_options_OptionsManager $tpom)
{
return "embedded_flash/youtube.tpl.php";
}
protected function _getUrlBaseWithoutTrailingSlash()
{
return 'http://www.youtube.com/embed';
}
}

View File

@ -1,95 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_ioc_FreeWordPressPluginIocService',
'org_tubepress_ioc_ProInWordPressIocService',
'org_tubepress_api_ioc_IocService',
'org_tubepress_impl_options_FormHandler',
'org_tubepress_api_filesystem_Explorer'));
class org_tubepress_impl_env_wordpress_Admin
{
/**
* Hook for WordPress init.
*
* @return void
*/
public static function initAction()
{
if (!is_admin()) {
return;
}
global $tubepress_base_url;
$iocContainer = org_tubepress_impl_ioc_IocContainer::getInstance();
$fs = $iocContainer->get('org_tubepress_api_filesystem_Explorer');
$dirName = basename($fs->getTubePressBaseInstallationPath());
wp_register_style('jquery-ui-flick', "$tubepress_base_url/sys/ui/static/css/jquery-ui-flick/jquery-ui-1.7.2.custom.css");
wp_register_script('jscolor-tubepress', "$tubepress_base_url/sys/ui/static/js/jscolor/jscolor.js");
wp_enqueue_style('jquery-ui-flick');
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('jscolor-tubepress');
}
/**
* Hook for WordPress admin menu.
*
* @return void
*/
public static function menuAction()
{
add_options_page('TubePress Options', 'TubePress', 'manage_options', __FILE__, array('org_tubepress_impl_env_wordpress_Admin', 'conditionalExecuteOptionsPage'));
}
/**
* Registers the TubePress options page
*
* @return void
*/
public static function conditionalExecuteOptionsPage()
{
/* grab the storage manager */
$iocContainer = org_tubepress_impl_ioc_IocContainer::getInstance();
$wpsm = $iocContainer->get('org_tubepress_api_options_StorageManager');
/* initialize our options in case we need to */
$wpsm->init();
/* get the form handler */
$optionsForm = $iocContainer->get('org_tubepress_impl_options_FormHandler');
/* are we updating? */
if (isset($_POST['tubepress_save'])) {
try {
$optionsForm->collect($_POST);
echo '<div id="message" class="updated fade"><p><strong>Options updated</strong></p></div>';
} catch (Exception $error) {
echo '<div id="message" class="error fade"><p><strong>' . $error->getMessage() . '</strong></p></div>';
}
}
print $optionsForm->getHtml();
}
}

View File

@ -1,146 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_options_WordPressStorageManager',
'org_tubepress_api_const_options_names_Advanced',
'org_tubepress_api_shortcode_ShortcodeParser',
'org_tubepress_ioc_ProInWordPressIocService',
'org_tubepress_impl_ioc_IocContainer',
'org_tubepress_impl_util_StringUtils',
'org_tubepress_api_const_options_values_ModeValue',
'org_tubepress_api_html_HtmlGenerator'));
class org_tubepress_impl_env_wordpress_Main
{
/**
* Filters the WordPress content, looking for TubePress shortcodes and replacing them with galleries/videos.
*
* @param string $content The WordPress content.
*
* @return string The modified content.
*/
public static function contentFilter($content = '')
{
try {
/* Whip up the IOC service */
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
/* do as little work as possible here 'cause we might not even run */
$wpsm = $ioc->get('org_tubepress_api_options_StorageManager');
$trigger = $wpsm->get(org_tubepress_api_const_options_names_Advanced::KEYWORD);
$parser = $ioc->get('org_tubepress_api_shortcode_ShortcodeParser');
/* no shortcode? get out */
if (!$parser->somethingToParse($content, $trigger)) {
return $content;
}
return self::_getHtml($content, $trigger, $parser, $ioc);
} catch (Exception $e) {
return $e->getMessage() . $content;
}
}
/**
* Does the heavy lifting of generating videos/galleries from content.
*
* @param string $content The WordPress content.
* @param string $trigger The shortcode keyword
*
* @return string The modified content.
*/
private static function _getHtml($content, $trigger, $parser, $ioc)
{
/* Get a handle to our options manager */
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
/* Grab the gallery that will do the heavy lifting */
$gallery = $ioc->get('org_tubepress_api_html_HtmlGenerator');
/* Parse each shortcode one at a time */
while ($parser->somethingToParse($content, $trigger)) {
/* Get the HTML for this particular shortcode. Could be a single video or a gallery. */
$generatedHtml = $gallery->getHtmlForShortcode($content);
/* remove any leading/trailing <p> tags from the content */
$pattern = '/(<[P|p]>\s*)(' . preg_quote($tpom->getShortcode(), '/') . ')(\s*<\/[P|p]>)/';
$content = preg_replace($pattern, '${2}', $content);
/* replace the shortcode with our new content */
$currentShortcode = $tpom->getShortcode();
$content = org_tubepress_impl_util_StringUtils::replaceFirst($currentShortcode, $generatedHtml, $content);
}
return $content;
}
/**
* WordPress head action hook.
*
* @return void
*/
public static function headAction()
{
/* no need to print anything in the head of the admin section */
if (is_admin()) {
return;
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$hh = $ioc->get('org_tubepress_api_html_HtmlGenerator');
/* this inline JS helps initialize TubePress */
$inlineJs = $hh->getHeadInlineJavaScriptString();
/* this meta stuff prevents search engines from indexing gallery pages > 1 */
$meta = $hh->getHeadMetaString();
print <<<EOT
$inlineJs
$meta
EOT;
}
/**
* WordPress init action hook.
*
* @return void
*/
public static function initAction()
{
/* no need to queue any of this stuff up in the admin section or login page */
if (is_admin() || __FILE__ === 'wp-login.php') {
return;
}
global $tubepress_base_url;
wp_register_script('tubepress', "$tubepress_base_url/sys/ui/static/js/tubepress.js");
wp_register_style('tubepress', "$tubepress_base_url/sys/ui/themes/default/style.css");
wp_enqueue_script('jquery');
wp_enqueue_script('tubepress');
wp_enqueue_style('tubepress');
}
}

View File

@ -1,135 +0,0 @@
<?php
/**
Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
This file is part of TubePress (http://tubepress.org)
TubePress 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.
TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_message_WordPressMessageService',
'org_tubepress_impl_ioc_FreeWordPressPluginIocService',
'org_tubepress_api_ioc_IocService',
'org_tubepress_api_const_options_names_Widget',
'org_tubepress_impl_template_SimpleTemplate',
'org_tubepress_api_const_template_Variable',
'org_tubepress_ioc_ProInWordPressIocService',
'org_tubepress_api_const_options_names_Advanced',
'org_tubepress_api_const_options_names_Display',
'org_tubepress_api_const_options_names_Meta',
'org_tubepress_api_player_Player'));
class org_tubepress_impl_env_wordpress_Widget
{
/**
* Registers the TubePress widget with WordPress.
*
* @return void
*/
public static function initAction()
{
$msg = new org_tubepress_impl_message_WordPressMessageService();
$widgetOps = array('classname' => 'widget_tubepress', 'description' => $msg->_('widget-description'));
wp_register_sidebar_widget('tubepress', 'TubePress', array('org_tubepress_impl_env_wordpress_Widget', 'printWidget'), $widgetOps);
wp_register_widget_control('tubepress', 'TubePress', array('org_tubepress_impl_env_wordpress_Widget', 'printControlPanel'));
}
/**
* Prints the output of the TubePress widget.
*
* @param array $opts The array of widget options.
*
* @return void
*/
public static function printWidget($opts)
{
extract($opts);
$iocContainer = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $iocContainer->get('org_tubepress_api_options_OptionsManager');
$parser = $iocContainer->get('org_tubepress_api_shortcode_ShortcodeParser');
$gallery = $iocContainer->get('org_tubepress_api_html_HtmlGenerator');
/* Turn on logging if we need to */
org_tubepress_impl_log_Log::setEnabled($tpom->get(org_tubepress_api_const_options_names_Advanced::DEBUG_ON), $_GET);
/* default widget options */
$defaultWidgetOptions = array(
org_tubepress_api_const_options_names_Display::RESULTS_PER_PAGE => 3,
org_tubepress_api_const_options_names_Meta::VIEWS => false,
org_tubepress_api_const_options_names_Meta::DESCRIPTION => true,
org_tubepress_api_const_options_names_Display::DESC_LIMIT => 50,
org_tubepress_api_const_options_names_Display::CURRENT_PLAYER_NAME => org_tubepress_api_player_Player::POPUP,
org_tubepress_api_const_options_names_Display::THUMB_HEIGHT => 105,
org_tubepress_api_const_options_names_Display::THUMB_WIDTH => 135,
org_tubepress_api_const_options_names_Display::PAGINATE_ABOVE => false,
org_tubepress_api_const_options_names_Display::PAGINATE_BELOW => false,
org_tubepress_api_const_options_names_Display::THEME => 'sidebar'
);
/* now apply the user's options */
$wpsm = $iocContainer->get('org_tubepress_api_options_OptionsManager');
$parser->parse($wpsm->get(org_tubepress_api_const_options_names_Widget::TAGSTRING));
/* calculate the final options */
$finalOptions = array_merge($defaultWidgetOptions, $tpom->getCustomOptions());
$tpom->setCustomOptions($finalOptions);
if ($tpom->get(org_tubepress_api_const_options_names_Display::THEME) === '') {
$tpom->set(org_tubepress_api_const_options_names_Display::THEME, 'sidebar');
}
$out = $gallery->getHtmlForShortcode('');
/* do the standard WordPress widget dance */
echo $before_widget . $before_title .
$wpsm->get(org_tubepress_api_const_options_names_Widget::TITLE) .
$after_title . $out . $after_widget;
}
/**
* Prints the TubePress widget control panel.
*
* @return void
*/
public static function printControlPanel()
{
$iocContainer = new org_tubepress_impl_ioc_FreeWordPressPluginIocService();
$wpsm = $iocContainer->get('org_tubepress_api_options_StorageManager');
$msg = $iocContainer->get('org_tubepress_api_message_MessageService');
/* are we saving? */
if (isset($_POST['tubepress-widget-submit'])) {
$wpsm->set(org_tubepress_api_const_options_names_Widget::TAGSTRING, strip_tags(stripslashes($_POST['tubepress-widget-tagstring'])));
$wpsm->set(org_tubepress_api_const_options_names_Widget::TITLE, strip_tags(stripslashes($_POST['tubepress-widget-title'])));
}
/* load up the gallery template */
$tpl = new org_tubepress_impl_template_SimpleTemplate();
$tpl->setPath(dirname(__FILE__) . '/../../../../../../../sys/ui/templates/wordpress/widget_controls.tpl.php');
/* set up the template */
$tpl->setVariable(org_tubepress_api_const_template_Variable::WIDGET_CONTROL_TITLE, $msg->_('options-meta-title-title'));
$tpl->setVariable(org_tubepress_api_const_template_Variable::WIDGET_TITLE, $wpsm->get(org_tubepress_api_const_options_names_Widget::TITLE));
$tpl->setVariable(org_tubepress_api_const_template_Variable::WIDGET_CONTROL_SHORTCODE, $msg->_('widget-tagstring-description'));
$tpl->setVariable(org_tubepress_api_const_template_Variable::WIDGET_SHORTCODE, $wpsm->get(org_tubepress_api_const_options_names_Widget::TAGSTRING));
/* get the template's output */
echo $tpl->toString();
}
}

View File

@ -1,51 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_environment_Detector'));
/**
* Detects TubePress's environment
*/
class org_tubepress_impl_environment_SimpleEnvironmentDetector implements org_tubepress_api_environment_Detector
{
/**
* Detects if the user is running TubePress Pro.
*
* @return boolean True is the user is running TubePress Pro. False otherwise.
*/
public function isPro()
{
return is_readable(dirname(__FILE__) . '/../ioc/ProIocService.class.php');
}
/**
* Detects if the user is running within WordPress
*
* @return boolean True is the user is running within WordPress. False otherwise.
*/
public function isWordPress()
{
return strpos(realpath(__FILE__), 'wp-content' . DIRECTORY_SEPARATOR . 'plugins') !== false
|| function_exists('wp_cron');
}
}

View File

@ -1,66 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require(dirname(__FILE__) . '/../../../../tubepress_classloader.php');
tubepress_load_classes(array('org_tubepress_api_factory_VideoFactory',
'org_tubepress_impl_ioc_IocContainer',
'org_tubepress_api_patterns_StrategyManager'));
/**
* Video factory that sends the feed to the right video factory based on the provider
*/
class org_tubepress_impl_factory_DelegatingVideoFactory implements org_tubepress_api_factory_VideoFactory
{
/**
* Converts raw video feeds to TubePress videos
*
* @param unknown $feed The raw feed result from the video provider
*
* @return array an array of TubePress videos generated from the feed
*/
public function feedToVideoArray($feed)
{
try {
return $this->_wrappedFeedToVideoArray($feed);
} catch (Exception $e) {
org_tubepress_impl_log_Log::log('Delegating video factory', 'Caught exception building videos: ' . $e->getMessage());
return array();
}
}
protected function getArrayOfStrategyNames()
{
return array(
'org_tubepress_impl_factory_strategies_YouTubeFactoryStrategy',
'org_tubepress_impl_factory_strategies_VimeoFactoryStrategy'
);
}
private function _wrappedFeedToVideoArray($feed)
{
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$sm = $ioc->get('org_tubepress_api_patterns_StrategyManager');
/* let the strategies do the heavy lifting */
return $sm->executeStrategy($this->getArrayOfStrategyNames(), $feed);
}
}

View File

@ -1,242 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_patterns_Strategy',
'org_tubepress_api_video_Video',
'org_tubepress_impl_log_Log',
'org_tubepress_impl_util_TimeUtils'));
/**
* Base class for factory strategies.
*/
abstract class org_tubepress_impl_factory_strategies_AbstractFactoryStrategy implements org_tubepress_api_patterns_Strategy
{
const LOG_PREFIX = 'Abstract Factory Strategy';
private $_tpom;
/**
* Called *before* canHandle() and execute() to allow the strategy
* to initialize itself.
*
* @return void
*/
function start()
{
return;
}
/**
* Called *after* canHandle() and execute() to allow the strategy
* to tear itself down.
*
* @return void
*/
function stop()
{
return;
}
/**
* Execute the strategy.
*
* @return unknown The result of this strategy execution.
*/
function execute()
{
/* grab the arguments */
$args = func_get_args();
self::_checkArgs($args);
$feed = $args[0];
/* give the strategy a chance to do some initial processing */
$this->_preExecute($feed);
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$this->_tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$results = array();
$index = 0;
$total = $this->_countVideosInFeed($feed);
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Now building %d video(s) from raw feed', $total);
for ($index = 0; $index < $total; $index++) {
if (!$this->_canHandleVideo($index)) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Skipping video at index %d', $index);
continue;
}
$results[] = $this->_buildVideo($index);
}
/* give the strategy a chance to do some post processing */
$this->_postExecute($feed);
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Built %d video(s) from raw feed', sizeof($results));
return $results;
}
/**
* Safely attempts to unserialize serialized PHP.
*
* @param unknown_type $raw The item to attempt to unserialize.
* @throws Exception If the item cannot be unserialized.
*
* @return unknown_type The unserialized PHP.
*/
protected static function _unserializePhpFeed($raw)
{
$result = false;
if (is_string($raw) && trim($raw) != '' && preg_match("/^(i|s|a|o|d):(.*);/si",$raw) > 0) {
$result = unserialize($raw);
}
if ($result === false) {
throw new Exception(sprintf('Unable to unserialize PHP from feed'));
}
return $result;
}
protected abstract function _preExecute($feed);
protected abstract function _postExecute($feed);
protected abstract function _countVideosInFeed($feed);
protected abstract function _canHandleVideo($index);
protected abstract function _getAuthorDisplayName($index);
protected abstract function _getAuthorUid($index);
protected abstract function _getCategory($index);
protected abstract function _getRawCommentCount($index);
protected abstract function _getDescription($index);
protected abstract function _getDurationInSeconds($index);
protected abstract function _getHomeUrl($index);
protected abstract function _getId($index);
protected abstract function _getKeywordsArray($index);
protected abstract function _getRawLikeCount($index);
protected abstract function _getRatingAverage($index);
protected abstract function _getRawRatingCount($index);
protected abstract function _getThumbnailUrlsArray($index);
protected abstract function _getTimeLastUpdatedInUnixTime($index);
protected abstract function _getTimePublishedInUnixTime($index);
protected abstract function _getTitle($index);
protected abstract function _getRawViewCount($index);
protected static function _checkArgs($args)
{
if (sizeof($args) !== 1) {
throw new Exception("Expected one arg. You sent %d", sizeof($args));
}
}
protected function _pickThumbnailUrl($urls)
{
if (!is_array($urls) || sizeof($urls) == 0) {
return '';
}
$random = $this->_tpom->get(org_tubepress_api_const_options_names_Display::RANDOM_THUMBS);
if ($random) {
return $urls[array_rand($urls)];
} else {
return $urls[1];
}
}
private function _buildVideo($index)
{
/* collect the pieces of the video */
$authorDisplayName = $this->_getAuthorDisplayName($index);
$authorUid = $this->_getAuthorUid($index);
$category = $this->_getCategory($index);
$commentCount = self::_fancyNumber($this->_getRawCommentCount($index));
$description = $this->_trimDescription($this->_getDescription($index));
$duration = org_tubepress_impl_util_TimeUtils::secondsToHumanTime($this->_getDurationInSeconds($index));
$homeUrl = $this->_getHomeUrl($index);
$id = $this->_getId($index);
$keywordsArray = $this->_getKeywordsArray($index);
$likesCount = self::_fancyNumber($this->_getRawLikeCount($index));
$ratingAverage = $this->_getRatingAverage($index);
$ratingCount = self::_fancyNumber($this->_getRawRatingCount($index));
$thumbUrl = $this->_pickThumbnailUrl($this->_getThumbnailUrlsArray($index));
$timeLastUpdated = $this->_fancyTime($this->_getTimeLastUpdatedInUnixTime($index));
$timePublished = $this->_fancyTime($this->_getTimePublishedInUnixTime($index));
$title = $this->_getTitle($index);
$viewCount = self::_fancyNumber($this->_getRawViewCount($index));
/* now build a video out of them */
$vid = new org_tubepress_api_video_Video();
$vid->setAuthorDisplayName($authorDisplayName);
$vid->setAuthorUid($authorUid);
$vid->setCategory($category);
$vid->setCommentCount($commentCount);
$vid->setDescription($description);
$vid->setDuration($duration);
$vid->setHomeUrl($homeUrl);
$vid->setId($id);
$vid->setKeywords($keywordsArray);
$vid->setLikesCount($likesCount);
$vid->setRatingAverage($ratingAverage);
$vid->setRatingCount($ratingCount);
$vid->setThumbnailUrl($thumbUrl);
$vid->setTimeLastUpdated($timeLastUpdated);
$vid->setTimePublished($timePublished);
$vid->setTitle($title);
$vid->setViewCount($viewCount);
return $vid;
}
private static function _fancyNumber($num)
{
if (!is_numeric($num)) {
return 'N/A';
}
return number_format($num);
}
private function _fancyTime($unixTime)
{
if ($unixTime == '') {
return '';
}
if ($this->_tpom->get(org_tubepress_api_const_options_names_Display::RELATIVE_DATES)) {
return org_tubepress_impl_util_TimeUtils::getRelativeTime($unixTime);
}
return date($this->_tpom->get(org_tubepress_api_const_options_names_Advanced::DATEFORMAT), $unixTime);
}
private function _trimDescription($description)
{
$limit = $this->_tpom->get(org_tubepress_api_const_options_names_Display::DESC_LIMIT);
if ($limit > 0 && strlen($description) > $limit) {
$description = substr($description, 0, $limit) . '...';
}
return $description;
}
}

View File

@ -1,187 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_factory_strategies_AbstractFactoryStrategy'));
/**
* Video factory for Vimeo
*/
class org_tubepress_impl_factory_strategies_VimeoFactoryStrategy extends org_tubepress_impl_factory_strategies_AbstractFactoryStrategy
{
const LOG_PREFIX = 'Vimeo Factory Strategy';
protected $_videoArray;
/**
* Returns true if this strategy is able to handle
* the request.
*
* @return boolean True if the strategy can handle the request, false otherwise.
*/
function canHandle()
{
/* grab the arguments */
$args = func_get_args();
self::_checkArgs($args);
$feed = $args[0];
try {
$unserialized = org_tubepress_impl_factory_strategies_AbstractFactoryStrategy::_unserializePhpFeed($feed);
} catch (Exception $e) {
return false;
}
return $unserialized->stat === 'ok';
}
protected function _preExecute($feed)
{
$unserialized = org_tubepress_impl_factory_strategies_AbstractFactoryStrategy::_unserializePhpFeed($feed);
if (isset($unserialized->video)) {
$this->_videoArray = $unserialized->video;
return;
}
if (isset($unserialized->videos) && isset($unserialized->videos->video)) {
$this->_videoArray = $unserialized->videos->video;
return;
}
$this->_videoArray = array();
}
protected function _postExecute($feed)
{
unset($this->_videoArray);
}
protected function _countVideosInFeed($feed)
{
return sizeof($this->_videoArray);
}
protected function _getAuthorDisplayName($index)
{
return $this->_videoArray[$index]->owner->display_name;
}
protected function _getAuthorUid($index)
{
return $this->_videoArray[$index]->owner->username;
}
protected function _getCategory($index)
{
return '';
}
protected function _getRawCommentCount($index)
{
return '';
}
protected function _getDescription($index)
{
return $this->_videoArray[$index]->description;
}
protected function _getDurationInSeconds($index)
{
return $this->_videoArray[$index]->duration;
}
protected function _getHomeUrl($index)
{
return 'http://vimeo.com/' . $this->_videoArray[$index]->id;
}
protected function _getId($index)
{
return $this->_videoArray[$index]->id;
}
protected function _getKeywordsArray($index)
{
return self::_gatherArrayOfContent($this->_videoArray[$index], 'tags', 'tag');
}
protected function _getRawLikeCount($index)
{
return $this->_videoArray[$index]->number_of_likes;
}
protected function _getRatingAverage($index)
{
return '';
}
protected function _getRawRatingCount($index)
{
return '';
}
protected function _getThumbnailUrlsArray($index)
{
$raw = self::_gatherArrayOfContent($this->_videoArray[$index], 'thumbnails', 'thumbnail');
return array($raw[0]);
}
protected function _getTimeLastUpdatedInUnixTime($index)
{
return '';
}
protected function _getTimePublishedInUnixTime($index)
{
return strtotime($this->_videoArray[$index]->upload_date);
}
protected function _getTitle($index)
{
return $this->_videoArray[$index]->title;
}
protected function _getRawViewCount($index)
{
return $this->_videoArray[$index]->number_of_plays;
}
protected function _canHandleVideo($index)
{
//Vimeo never sends us videos we can't display
return true;
}
protected static function _gatherArrayOfContent($node, $firstDimension, $secondDimension)
{
$results = array();
if (isset($node->$firstDimension) && is_array($node->$firstDimension->$secondDimension)) {
foreach ($node->$firstDimension->$secondDimension as $item) {
$results[] = $item->_content;
}
}
return $results;
}
}

View File

@ -1,252 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_patterns_Strategy',
'org_tubepress_api_video_Video',
'org_tubepress_api_url_Url',
'org_tubepress_impl_factory_strategies_AbstractFactoryStrategy'));
/**
* Video factory for YouTube
*/
class org_tubepress_impl_factory_strategies_YouTubeFactoryStrategy extends org_tubepress_impl_factory_strategies_AbstractFactoryStrategy
{
/* shorthands for the namespaces */
const NS_APP = 'http://www.w3.org/2007/app';
const NS_ATOM = 'http://www.w3.org/2005/Atom';
const NS_MEDIA = 'http://search.yahoo.com/mrss/';
const NS_YT = 'http://gdata.youtube.com/schemas/2007';
const NS_GD = 'http://schemas.google.com/g/2005';
const LOG_PREFIX = 'YouTube Video Factory';
private $_xpath;
/**
* Returns true if this strategy is able to handle
* the request.
*
* @return boolean True if the strategy can handle the request, false otherwise.
*/
function canHandle()
{
/* grab the arguments */
$args = func_get_args();
self::_checkArgs($args);
$feed = $args[0];
return is_string($feed) && strpos($feed, "http://gdata.youtube.com/schemas/2007") !== false;
}
protected function getXpath()
{
return $this->_xpath;
}
protected function _preExecute($feed)
{
$this->_xpath = $this->_createXPath($this->_createDomDocument($feed));
}
protected function _postExecute($feed)
{
unset($this->_xpath);
}
protected function _countVideosInFeed($feed)
{
return $this->_xpath->query('//atom:entry')->length;
}
protected function _canHandleVideo($index)
{
$states = $this->_relativeQuery($index, 'app:control/yt:state');
/* no state applied? we're good to go */
if ($states->length == 0) {
return true;
}
/* if state is other than limitedSyndication, it's not available */
return $this->_relativeQuery($index, "app:control/yt:state[@reasonCode='limitedSyndication']")->length !== 0;
}
protected function _getAuthorDisplayName($index)
{
return $this->_getAuthorUid($index);
}
protected function _getAuthorUid($index)
{
return $this->_relativeQuery($index, 'atom:author/atom:name')->item(0)->nodeValue;
}
protected function _getCategory($index)
{
return trim($this->_relativeQuery($index, 'media:group/media:category')->item(0)->getAttribute('label'));
}
protected function _getRawCommentCount($index)
{
return '';
}
protected function _getDescription($index)
{
return $this->_relativeQuery($index, 'media:group/media:description')->item(0)->nodeValue;
}
protected function _getDurationInSeconds($index)
{
return $this->_relativeQuery($index, 'media:group/yt:duration')->item(0)->getAttribute('seconds');
}
protected function _getHomeUrl($index)
{
$rawUrl = $this->_relativeQuery($index, "atom:link[@rel='alternate']")->item(0)->getAttribute('href');
$url = new org_tubepress_api_url_Url($rawUrl);
return $url->toString(true);
}
protected function _getId($index)
{
$link = $this->_relativeQuery($index, "atom:link[@type='text/html']")->item(0);
$matches = array();
preg_match('/.*v=(.{11}).*/', $link->getAttribute('href'), $matches);
return $matches[1];
}
protected function _getKeywordsArray($index)
{
$rawKeywords = $this->_relativeQuery($index, 'media:group/media:keywords')->item(0);
$raw = trim($rawKeywords->nodeValue);
return split(", ", $raw);
}
protected function _getRawLikeCount($index)
{
return '';
}
protected function _getRatingAverage($index)
{
$count = $this->_relativeQuery($index, 'gd:rating')->item(0);
if ($count != null) {
return number_format($count->getAttribute('average'), 2);
}
return '';
}
protected function _getRawRatingCount($index)
{
$count = $this->_relativeQuery($index, 'gd:rating')->item(0);
if ($count != null) {
return $count->getAttribute('numRaters');
}
return '';
}
protected function _getThumbnailUrlsArray($index)
{
$thumbs = $this->_relativeQuery($index, 'media:group/media:thumbnail');
$result = array();
foreach ($thumbs as $thumb) {
//if (strpos($thumb->getAttribute('url'), 'hqdefault') === false) {
$result[] = $thumb->getAttribute('url');
//}
}
return $result;
}
protected function _getTimeLastUpdatedInUnixTime($index)
{
return '';
}
protected function _getTimePublishedInUnixTime($index)
{
$publishedNode = $this->_relativeQuery($index, 'atom:published');
if ($publishedNode->length == 0) {
return '';
}
$rawTime = $publishedNode->item(0)->nodeValue;
return org_tubepress_impl_util_TimeUtils::rfc3339toUnixTime($rawTime);
}
protected function _getTitle($index)
{
return $this->_relativeQuery($index, 'atom:title')->item(0)->nodeValue;
}
protected function _getRawViewCount($index)
{
$stats = $this->_relativeQuery($index, 'yt:statistics')->item(0);
if ($stats != null) {
return $stats->getAttribute('viewCount');
}
return '';
}
protected function _relativeQuery($index, $query)
{
return $this->_xpath->query('//atom:entry[' . ($index + 1) . "]/$query");
}
private function _createXPath(DOMDocument $doc)
{
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Building xpath to parse XML');
if (!class_exists('DOMXPath')) {
throw new Exception('Class DOMXPath not found');
}
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('atom', self::NS_ATOM);
$xpath->registerNamespace('yt', self::NS_YT);
$xpath->registerNamespace('gd', self::NS_GD);
$xpath->registerNamespace('media', self::NS_MEDIA);
$xpath->registerNamespace('app', self::NS_APP);
return $xpath;
}
private function _createDomDocument($feed)
{
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Attempting to load XML from YouTube');
if (!class_exists('DOMDocument')) {
throw new Exception('DOMDocument class not found');
}
$doc = new DOMDocument();
if ($doc->loadXML($feed) === false) {
throw new Exception('Could not parse XML from YouTube');
}
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Successfully loaded XML from YouTube');
return $doc;
}
}

View File

@ -1,80 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes') || require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_feed_FeedFetcher',
'org_tubepress_api_cache_Cache',
'org_tubepress_impl_log_Log',
'org_tubepress_impl_ioc_IocContainer',
'org_tubepress_api_http_HttpClient'));
/**
* Base functionality for feed retrieval services.
*/
class org_tubepress_impl_feed_CacheAwareFeedFetcher implements org_tubepress_api_feed_FeedFetcher
{
const LOG_PREFIX = 'Cache Aware Feed Fetcher';
/**
* Fetches the feed from a remote provider
*
* @param string $url The URL to fetch.
* @param boolean $useCache Whether or not to use the network cache.
*
* @return unknown The raw feed from the provider
*/
public function fetch($url, $useCache)
{
global $tubepress_base_url;
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$cache = $ioc->get('org_tubepress_api_cache_Cache');
$result = '';
if ($useCache) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'First asking cache for <a href="%s">%s</a>', $url, $url);
$result = $cache->get($url);
if ($result !== false) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Cache has <a href="%s">%s</a>. Sweet.', $url, $url);
} else {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Cache does not have <a href="%s">%s</a>. We\'ll have to get it from the network.', $url, $url);
$result = $this->_getFromNetwork($url, $ioc);
$cache->save($url, $result);
}
} else {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Skip cache check for <a href="%s">%s</a>', $url, $url);
$result = $this->_getFromNetwork($url, $ioc);
}
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Raw result for <a href="%s">%s</a> is in the HTML source for this page. <span style="display:none">%s</span>', $url, $url, htmlspecialchars($result));
return $result;
}
private function _getFromNetwork($url, $ioc)
{
$client = $ioc->get('org_tubepress_api_http_HttpClient');
return $client->get($url);
}
}

View File

@ -1,65 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_feed_FeedInspector',
'org_tubepress_api_feed_FeedResult',
'org_tubepress_impl_ioc_IocContainer',
'org_tubepress_api_provider_ProviderCalculator',
'org_tubepress_api_patterns_StrategyManager'));
/**
* Sends the feed to the right inspection service based on the provider.
*/
class org_tubepress_impl_feed_DelegatingFeedInspector implements org_tubepress_api_feed_FeedInspector
{
/**
* Count the total videos in this feed result.
*
* @param unknown $rawFeed The raw video feed (varies depending on provider)
*
* @return int The total result count of this query, or 0 if there was a problem.
*/
public function getTotalResultCount($rawFeed)
{
try {
return $this->_wrappedCount($rawFeed);
} catch (Exception $e) {
org_tubepress_impl_log_Log::log('Delegating Feed Inspector', 'Caught exception while counting: ' . $e->getMessage());
return 0;
}
}
private function _wrappedCount($rawFeed)
{
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$pc = $ioc->get('org_tubepress_api_provider_ProviderCalculator');
$sm = $ioc->get('org_tubepress_api_patterns_StrategyManager');
$providerName = $pc->calculateCurrentVideoProvider();
/* let the strategies do the heavy lifting */
return $sm->executeStrategy(array(
'org_tubepress_impl_feed_inspectionstrategies_YouTubeFeedInspectionStrategy',
'org_tubepress_impl_feed_inspectionstrategies_VimeoFeedInspectionStrategy'
), $providerName, $rawFeed);
}
}

View File

@ -1,91 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_patterns_Strategy'));
/**
* Base functionality for feed inspection.
*/
abstract class org_tubepress_impl_feed_inspectionstrategies_AbstractFeedInspectionStrategy implements org_tubepress_api_patterns_Strategy
{
/**
* Called *before* canHandle() and execute() to allow the strategy
* to initialize itself.
*/
public function start()
{
//do nothing
}
/**
* Called *after* canHandle() and execute() to allow the strategy
* to tear itself down.
*/
public function stop()
{
//do nothing
}
/**
* Returns true if this strategy is able to handle
* the request.
*/
public function canHandle()
{
/* grab the arguments */
$args = func_get_args();
self::_checkArgs($args);
$providerName = $args[0];
return $args[0] === $this->_getNameOfHandledProvider();
}
/**
* Execute the strategy.
*/
public function execute()
{
/* grab the arguments */
$args = func_get_args();
self::_checkArgs($args);
$rawFeed = $args[1];
return $this->_count($rawFeed);
}
protected abstract function _getNameOfHandledProvider();
protected abstract function _count($rawFeed);
private static function _checkArgs($args)
{
/* a little sanity checking */
if (count($args) !== 2) {
throw new Exception(sprintf("Wrong argument count. Expects 2, you sent %d", count($args)));
}
}
}

View File

@ -1,43 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_feed_inspectionstrategies_AbstractFeedInspectionStrategy'));
/**
* Examines the feed from Vimeo
*/
class org_tubepress_impl_feed_inspectionstrategies_VimeoFeedInspectionStrategy extends org_tubepress_impl_feed_inspectionstrategies_AbstractFeedInspectionStrategy
{
protected function _getNameOfHandledProvider()
{
return org_tubepress_api_provider_Provider::VIMEO;
}
protected function _count($rawFeed)
{
$feed = @unserialize($rawFeed);
return isset($feed->videos->total) ? $feed->videos->total : 0;
}
}

View File

@ -1,67 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_feed_inspectionstrategies_AbstractFeedInspectionStrategy'));
/**
* Examines the feed from YouTube
*
*/
class org_tubepress_impl_feed_inspectionstrategies_YouTubeFeedInspectionStrategy extends org_tubepress_impl_feed_inspectionstrategies_AbstractFeedInspectionStrategy
{
const NS_OPENSEARCH = 'http://a9.com/-/spec/opensearch/1.1/';
protected function _count($rawFeed)
{
$dom = $this->_getDom($rawFeed);
$totalResults = $dom->getElementsByTagNameNS(self::NS_OPENSEARCH, 'totalResults')->item(0)->nodeValue;
self::_makeSureNumeric($totalResults);
return $totalResults;
}
protected function _getNameOfHandledProvider()
{
return org_tubepress_api_provider_Provider::YOUTUBE;
}
private function _getDom($rawFeed)
{
if (!class_exists('DOMDocument')) {
throw new Exception('DOMDocument class not found');
}
$dom = new DOMDocument();
if ($dom->loadXML($rawFeed) === false) {
throw new Exception('Problem parsing XML from YouTube');
}
return $dom;
}
private static function _makeSureNumeric($result)
{
if (is_numeric($result) === false) {
throw new Exception("YouTube returned a non-numeric result count: $result");
}
}
}

View File

@ -1,128 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
tubepress_load_classes(array(
'org_tubepress_impl_log_Log',
'org_tubepress_api_filesystem_Explorer'
));
/**
* Some filesystem utilities
*
*/
class org_tubepress_impl_filesystem_FsExplorer implements org_tubepress_api_filesystem_Explorer
{
public function getTubePressBaseInstallationPath()
{
return realpath(dirname(__FILE__) . '/../../../../../../');
}
public function getDirectoriesInDirectory($dir, $prefix)
{
$realDir = $dir;
if (!is_dir($dir)) {
org_tubepress_impl_log_Log::log($prefix, '<tt>%s</tt> is not a directory', $realDir);
return array();
}
$toReturn = array();
if ($handle = opendir($dir)) {
org_tubepress_impl_log_Log::log($prefix, 'Successfully opened <tt>%s</tt> to read contents.', $realDir);
while (($file = readdir($handle)) !== false) {
if ($file === '.' || $file === '..' || strpos($file, ".") === 0) {
continue;
}
if (!is_dir($dir . '/' . $file)) {
continue;
}
array_push($toReturn, realpath($dir . '/' . $file));
}
closedir($handle);
} else {
org_tubepress_impl_log_Log::log($prefix, 'Could not open <tt>%s</tt>', $realDir);
}
return $toReturn;
}
public function getFilenamesInDirectory($dir, $prefix)
{
$realDir = $dir;
if (!is_dir($dir)) {
org_tubepress_impl_log_Log::log($prefix, '<tt>%s</tt> is not a directory', $realDir);
return array();
}
$toReturn = array();
if ($handle = opendir($dir)) {
org_tubepress_impl_log_Log::log($prefix, 'Successfully opened <tt>%s</tt> to read contents.', $realDir);
while (($file = readdir($handle)) !== false) {
if ($file === '.' || $file === '..') {
continue;
}
if (is_dir($dir . '/' . $file)) {
continue;
}
array_push($toReturn, realpath($dir . '/' . $file));
}
closedir($handle);
} else {
org_tubepress_impl_log_Log::log($prefix, 'Could not open <tt>%s</tt>', $realDir);
}
return $toReturn;
}
public function getSystemTempDirectory()
{
if (function_exists('sys_get_temp_dir')) {
return sys_get_temp_dir();
}
// Try to get from environment variable
if (!empty($_ENV['TMP'])) {
return realpath($_ENV['TMP']);
} else if (!empty($_ENV['TMPDIR'])) {
return realpath($_ENV['TMPDIR']);
} else if (!empty($_ENV['TEMP'])) {
return realpath($_ENV['TEMP']);
} else {
// Detect by creating a temporary file
// Try to use system's temporary directory
// as random name shouldn't exist
$tempfile = @tempnam(md5(uniqid(rand(), true)), '');
if ( $tempfile ) {
$tempdir = realpath(dirname($tempfile));
@unlink($tempfile);
return $tempdir;
} else {
return false;
}
}
}
}

View File

@ -1,77 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Trims down the number of results based on various criteria.
*/
class org_tubepress_impl_filters_feedresult_ResultCountCapper
{
const LOG_PREFIX = 'Result Count Capper';
public function filter()
{
$args = func_get_args();
$feedResult = $args[0];
$totalResults = $feedResult->getEffectiveTotalResultCount();
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$limit = $tpom-> get(org_tubepress_api_const_options_names_Feed::RESULT_COUNT_CAP);
$firstCut = $limit == 0 ? $totalResults : min($limit, $totalResults);
$secondCut = min($firstCut, self::_calculateRealMax($tpom, $firstCut));
$videos = $feedResult->getVideoArray();
$resultCount = count($videos);
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Effective total result count (taking into account user-defined limit) is %d video(s)', $secondCut);
if ($resultCount > $secondCut) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Result has %d video(s), limit is %d. So we\'re chopping it down.', $resultCount, $secondCut);
$feedResult->setVideoArray(array_splice($videos, 0, $secondCut - $resultCount));
}
$feedResult->setEffectiveTotalResultCount($secondCut);
return $feedResult;
}
private static function _calculateRealMax($tpom, $reported)
{
$mode = $tpom->get(org_tubepress_api_const_options_names_Output::MODE);
switch ($mode) {
case org_tubepress_api_const_options_values_ModeValue::TAG:
//http://code.google.com/apis/youtube/2.0/reference.html#Videos_feed
return 999;
case org_tubepress_api_const_options_values_ModeValue::FAVORITES:
//http://code.google.com/apis/youtube/2.0/reference.html#User_favorites_feed
return 50;
case org_tubepress_api_const_options_values_ModeValue::PLAYLIST:
//http://code.google.com/apis/youtube/2.0/reference.html#Playlist_feed
return 200;
}
return $reported;
}
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$fm = $ioc->get('org_tubepress_api_patterns_FilterManager');
$instance = $ioc->get('org_tubepress_impl_filters_feedresult_ResultCountCapper');
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::VIDEOS_DELIVERY, array($instance, 'filter'));

View File

@ -1,58 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Shuffles videos on request.
*/
class org_tubepress_impl_filters_feedresult_Shuffler
{
public function filter()
{
$args = func_get_args();
$feedResult = $args[0];
$videos = $feedResult->getVideoArray();
if (!is_array($videos)) {
//log
return $feedResult;
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
/* shuffle if we need to */
if ($tpom->get(org_tubepress_api_const_options_names_Display::ORDER_BY) == org_tubepress_api_const_options_values_OrderValue::RANDOM) {
org_tubepress_impl_log_Log::log('Shuffler', 'Shuffling videos');
shuffle($videos);
}
/* modify the feed result */
$feedResult->setVideoArray($videos);
return $feedResult;
}
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$fm = $ioc->get('org_tubepress_api_patterns_FilterManager');
$instance = $ioc->get('org_tubepress_impl_filters_feedresult_Shuffler');
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::VIDEOS_DELIVERY, array($instance, 'filter'));

View File

@ -1,76 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Filters out any videos that the user has in their blacklist.
*/
class org_tubepress_impl_filters_feedresult_VideoBlacklist
{
public function filter()
{
$args = func_get_args();
$feedResult = $args[0];
$videos = $feedResult->getVideoArray();
if (!is_array($videos)) {
//log
return $feedResult;
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$blacklist = $tpom->get(org_tubepress_api_const_options_names_Advanced::VIDEO_BLACKLIST);
$videosToKeep = array();
$blacklistCount = 0;
foreach ($videos as $video) {
$id = $video->getId();
/* keep videos without an ID or that aren't blacklisted */
if (!isset($id) || $this->_isNotBlacklisted($id, $blacklist)) {
$videosToKeep[] = $video;
} else {
$blacklistCount++;
}
}
/* modify the feed result */
$feedResult->setVideoArray($videosToKeep);
return $feedResult;
}
protected function _isNotBlacklisted($id, $blacklist)
{
if (strpos($blacklist, $id) !== false) {
org_tubepress_impl_log_Log::log($this->_logPrefix, 'Video with ID %s is blacklisted. Skipping it.', $id);
return false;
}
return true;
}
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$fm = $ioc->get('org_tubepress_api_patterns_FilterManager');
$instance = $ioc->get('org_tubepress_impl_filters_feedresult_VideoBlacklist');
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::VIDEOS_DELIVERY, array($instance, 'filter'));

View File

@ -1,114 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_querystring_QueryStringService',
'org_tubepress_impl_log_Log',
'org_tubepress_impl_ioc_IocContainer',
'org_tubepress_api_const_filters_ExecutionPoint'));
/**
* Appends/moves a video the front of the gallery based on the query string parameter.
*/
class org_tubepress_impl_filters_feedresult_VideoPrepender
{
const LOG_PREFIX = 'Video Prepender';
public function filter()
{
$args = func_get_args();
$feedResult = $args[0];
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$qss = $ioc->get('org_tubepress_api_querystring_QueryStringService');
$customVideoId = $qss->getCustomVideo($_GET);
/* they didn't set a custom video id */
if ($customVideoId == '') {
return $feedResult;
}
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Prepending video %s to the gallery', $customVideoId);
return self::_prependVideo($ioc, $customVideoId, $feedResult);
}
private static function _moveVideoUpFront($videos, $id)
{
for ($x = 0; $x < count($videos); $x++) {
if ($videos[$x]->getId() == $id) {
$saved = $videos[$x];
unset($videos[$x]);
array_unshift($videos, $saved);
break;
}
}
return $videos;
}
private static function _videoArrayAlreadyHasVideo($videos, $id)
{
foreach ($videos as $video) {
if ($video->getId() == $id) {
return true;
}
}
return false;
}
private static function _prependVideo($ioc, $id, $feedResult)
{
$videos = $feedResult->getVideoArray();
if (!is_array($videos)) {
//log
return $feedResult;
}
/* see if the array already has it */
if (self::_videoArrayAlreadyHasVideo($videos, $id)) {
$videos = self::_moveVideoUpFront($videos, $id);
$feedResult->setVideoArray($videos);
return $feedResult;
}
$provider = $ioc->get('org_tubepress_video_feed_provider_Provider');
try {
$video = $provider->getSingleVideo($customVideoId);
array_unshift($videos, $video);
} catch (Exception $e) {
org_tubepress_log_Log::log(self::LOG_PREFIX, 'Could not prepend video %s to the gallery: %s', $customVideoId, $e->getMessage());
}
/* modify the feed result */
$feedResult->setVideoArray($videos);
return $feedResult;
}
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$fm = $ioc->get('org_tubepress_api_patterns_FilterManager');
$instance = $ioc->get('org_tubepress_impl_filters_feedresult_VideoPrepender');
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::VIDEOS_DELIVERY, array($instance, 'filter'));

View File

@ -1,74 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
tubepress_load_classes(array(
'org_tubepress_api_filesystem_Explorer',
'org_tubepress_api_const_filters_ExecutionPoint'
));
/**
* Injects Ajax pagination code into the gallery's HTML, if necessary.
*/
class org_tubepress_impl_filters_html_AjaxPagination
{
const LOG_PREFIX = 'Ajax Pagination Filter';
/**
* Filters the HTML for the gallery.
*
* @param string $html The gallery HTML.
* @param string $galleryId The current gallery ID
*
* @return string The modified HTML
*/
public function filter($html, $galleryId)
{
if (!is_string($html)) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Filter invoked with a non-string argument :(');
return $html;
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
if (!$tpom->get(org_tubepress_api_const_options_names_Display::AJAX_PAGINATION)) {
return $html;
}
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Using Ajax pagination');
$template = new org_tubepress_impl_template_SimpleTemplate();
$fs = $ioc->get('org_tubepress_api_filesystem_Explorer');
$baseInstallationPath = $fs->getTubePressBaseInstallationPath();
$template->setPath("$baseInstallationPath/sys/ui/templates/gallery/ajax_pagination.tpl.php");
$template->setVariable(org_tubepress_api_const_template_Variable::GALLERY_ID, $galleryId);
$template->setVariable(org_tubepress_api_const_template_Variable::SHORTCODE, rawurlencode($tpom->getShortcode()));
return $html . $template->toString();
}
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$fm = $ioc->get('org_tubepress_api_patterns_FilterManager');
$instance = $ioc->get('org_tubepress_impl_filters_html_AjaxPagination');
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::GALLERY_HTML, array($instance, 'filter'));

View File

@ -1,91 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Injects theme CSS to the gallery's HTML, if necessary.
*/
class org_tubepress_impl_filters_html_ThemeCss
{
const LOG_PREFIX = 'Theme CSS Filter';
/**
* Filters the HTML for the gallery.
*
* @param string $html The gallery HTML.
*
* @return string The modified HTML
*/
public function filter($html)
{
if (!is_string($html)) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Filter invoked with a non-string :(');
return $html;
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$themeHandler = $ioc->get('org_tubepress_api_theme_ThemeHandler');
$currentTheme = $themeHandler->calculateCurrentThemeName();
if ($currentTheme === 'default') {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Default theme is in use. No need to inject extra CSS.');
return $html;
}
/* get the CSS file's path on the filesystem */
$cssPath = $themeHandler->getCssPath($currentTheme);
if (!is_readable($cssPath) || strpos($cssPath, 'themes' . DIRECTORY_SEPARATOR . 'default') !== false) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'No theme CSS found.');
return $html;
} else {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Theme CSS found at <tt>%s</tt>', $cssPath);
}
return $this->_injectCss($html, $themeHandler, $currentTheme, $ioc);
}
/**
* Handles the heavy lifting of injecting CSS loader
*/
private function _injectCss($html, $themeHandler, $currentTheme, $ioc)
{
global $tubepress_base_url;
$fs = $ioc->get('org_tubepress_api_filesystem_Explorer');
$cssRelativePath = $themeHandler->getCssPath($currentTheme, true);
$baseInstallationPath = $fs->getTubePressBaseInstallationPath();
$cssUrl = "$tubepress_base_url/$cssRelativePath";
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Will inject CSS from <tt>%s</tt>', $cssUrl);
$template = new org_tubepress_impl_template_SimpleTemplate();
$template->setPath("$baseInstallationPath/sys/ui/templates/gallery/theme_loader.tpl.php");
$template->setVariable(org_tubepress_api_const_template_Variable::THEME_CSS, $cssUrl);
return $html . $template->toString();
}
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$fm = $ioc->get('org_tubepress_api_patterns_FilterManager');
$instance = $ioc->get('org_tubepress_impl_filters_html_ThemeCss');
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::GALLERY_HTML, array($instance, 'filter'));

View File

@ -1,57 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
tubepress_load_classes(array('org_tubepress_api_provider_ProviderCalculator'));
/**
* Applies the embedded service name to the template.
*/
class org_tubepress_impl_filters_template_EmbeddedPlayerName
{
public function filter($template, $feedResult, $galleryId)
{
$template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_IMPL_NAME, self::_getEmbeddedServiceName());
return $template;
}
private static function _getEmbeddedServiceName()
{
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$stored = $tpom->get(org_tubepress_api_const_options_names_Embedded::PLAYER_IMPL);
$pc = $ioc->get('org_tubepress_api_provider_ProviderCalculator');
$providerName = $pc->calculateCurrentVideoProvider();
if ($stored === org_tubepress_api_const_options_values_PlayerImplementationValue::LONGTAIL
&& $providerName !== org_tubepress_api_provider_Provider::VIMEO) {
return $stored;
}
return $providerName;
}
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$fm = $ioc->get('org_tubepress_api_patterns_FilterManager');
$instance = $ioc->get('org_tubepress_impl_filters_template_EmbeddedPlayerName');
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::GALLERY_TEMPLATE, array($instance, 'filter'));

View File

@ -1,46 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Handles applying the embedded player's HTML to the template.
*/
class org_tubepress_impl_filters_template_EmbeddedSource
{
public function filter($template, $video)
{
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$eps = $ioc->get('org_tubepress_api_embedded_EmbeddedPlayer');
/* apply it to the template */
$template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_SOURCE, $eps->toString($video->getId()));
$template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_WIDTH, $tpom->get(org_tubepress_api_const_options_names_Embedded::EMBEDDED_WIDTH));
return $template;
}
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$fm = $ioc->get('org_tubepress_api_patterns_FilterManager');
$instance = $ioc->get('org_tubepress_impl_filters_template_EmbeddedSource');
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::SINGLE_VIDEO_TEMPLATE, array($instance, 'filter'));

View File

@ -1,59 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_ioc_IocContainer',
'org_tubepress_api_const_options_names_Display',
'org_tubepress_api_const_template_Variable',
'org_tubepress_api_const_filters_ExecutionPoint',
'org_tubepress_api_feed_FeedResult'));
/**
* Handles applying pagination to the gallery template.
*/
class org_tubepress_impl_filters_template_Pagination
{
public function filter($template, $feedResult, $galleryId)
{
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$paginationService = $ioc->get('org_tubepress_api_pagination_Pagination');
$pagination = $paginationService->getHtml($feedResult->getEffectiveTotalResultCount());
if ($tpom->get(org_tubepress_api_const_options_names_Display::PAGINATE_ABOVE)) {
$template->setVariable(org_tubepress_api_const_template_Variable::PAGINATION_TOP, $pagination);
}
if ($tpom->get(org_tubepress_api_const_options_names_Display::PAGINATE_BELOW)) {
$template->setVariable(org_tubepress_api_const_template_Variable::PAGINATION_BOTTOM, $pagination);
}
return $template;
}
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$fm = $ioc->get('org_tubepress_api_patterns_FilterManager');
$instance = $ioc->get('org_tubepress_impl_filters_template_Pagination');
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::GALLERY_TEMPLATE, array($instance, 'filter'));

View File

@ -1,57 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_impl_ioc_IocContainer',
'org_tubepress_api_const_options_names_Display',
'org_tubepress_api_const_template_Variable',
'org_tubepress_api_const_filters_ExecutionPoint',
'org_tubepress_api_feed_FeedResult',
'org_tubepress_api_video_Video',
'org_tubepress_api_player_Player'));
/**
* Handles applying the player HTML to the gallery template.
*/
class org_tubepress_impl_filters_template_Player
{
public function filter($template, $feedResult, $galleryId)
{
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$playerName = $tpom->get(org_tubepress_api_const_options_names_Display::CURRENT_PLAYER_NAME);
$player = $ioc->get('org_tubepress_api_player_Player');
$videos = $feedResult->getVideoArray();
$playerHtml = $player->getHtml($videos[0], $galleryId);
$template->setVariable(org_tubepress_api_const_template_Variable::PLAYER_HTML, $playerHtml);
$template->setVariable(org_tubepress_api_const_template_Variable::PLAYER_NAME, $playerName);
return $template;
}
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$fm = $ioc->get('org_tubepress_api_patterns_FilterManager');
$instance = $ioc->get('org_tubepress_impl_filters_template_Player');
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::GALLERY_TEMPLATE, array($instance, 'filter'));

View File

@ -1,55 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
tubepress_load_classes(array('org_tubepress_api_const_options_CategoryName'));
/**
* Handles applying video meta info to the gallery template.
*/
class org_tubepress_impl_filters_template_VideoMeta
{
public function filter($template)
{
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
$messageService = $ioc->get('org_tubepress_api_message_MessageService');
$metaNames = org_tubepress_impl_options_OptionsReference::getOptionNamesForCategory(org_tubepress_api_const_options_CategoryName::META);
$shouldShow = array();
$labels = array();
foreach ($metaNames as $metaName) {
$shouldShow[$metaName] = $tpom->get($metaName);
$labels[$metaName] = $messageService->_('video-' . $metaName);
}
$template->setVariable(org_tubepress_api_const_template_Variable::META_SHOULD_SHOW, $shouldShow);
$template->setVariable(org_tubepress_api_const_template_Variable::META_LABELS, $labels);
return $template;
}
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$fm = $ioc->get('org_tubepress_api_patterns_FilterManager');
$instance = $ioc->get('org_tubepress_impl_filters_template_VideoMeta');
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::GALLERY_TEMPLATE, array($instance, 'filter'));
$fm->registerFilter(org_tubepress_api_const_filters_ExecutionPoint::SINGLE_VIDEO_TEMPLATE, array($instance, 'filter'));

View File

@ -1,115 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_html_HtmlGenerator',
'org_tubepress_api_querystring_QueryStringService',
'org_tubepress_impl_ioc_IocContainer',
'org_tubepress_impl_log_Log',
'org_tubepress_api_patterns_StrategyManager'));
/**
* HTML handler implementation.
*/
class org_tubepress_impl_html_DefaultHtmlGenerator implements org_tubepress_api_html_HtmlGenerator
{
const LOG_PREFIX = 'HTML Generator';
/**
* Generates the HTML for TubePress. Could be a gallery or single video.
*
* @param string $shortCodeContent The shortcode content. May be empty or null.
*
* @return The HTML for the given shortcode.
*/
public function getHtmlForShortcode($shortCodeContent)
{
try {
return $this->_wrappedGetHtmlForShortcode($shortCodeContent);
} catch (Exception $e) {
return $e->getMessage;
}
}
private function _wrappedGetHtmlForShortcode($shortCodeContent)
{
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
/* do a bit of logging */
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Type of IOC container is %s', get_class($ioc));
/* parse the shortcode if we need to */
if ($shortCodeContent != '') {
$shortcodeParser = $ioc->get('org_tubepress_api_shortcode_ShortcodeParser');
$shortcodeParser->parse($shortCodeContent);
}
/* use the strategy manager to get the HTML */
return $ioc->get('org_tubepress_api_patterns_StrategyManager')->executeStrategy($this->getStrategies());
}
public function getHeadJqueryIncludeString()
{
global $tubepress_base_url;
return "<script type=\"text/javascript\" src=\"$tubepress_base_url/sys/ui/static/js/jquery-1.5.1.min.js\"></script>";
}
public function getHeadInlineJavaScriptString()
{
global $tubepress_base_url;
return "<script type=\"text/javascript\">function getTubePressBaseUrl(){return \"$tubepress_base_url\";}</script>";
}
public function getHeadTubePressJsIncludeString()
{
global $tubepress_base_url;
return "<script type=\"text/javascript\" src=\"$tubepress_base_url/sys/ui/static/js/tubepress.js\"></script>";
}
public function getHeadTubePressCssIncludeString()
{
global $tubepress_base_url;
return "<link rel=\"stylesheet\" href=\"$tubepress_base_url/sys/ui/themes/default/style.css\" type=\"text/css\" />";
}
public function getHeadMetaString()
{
global $tubepress_base_url;
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$qss = $ioc->get('org_tubepress_api_querystring_QueryStringService');
$page = $qss->getPageNum($_GET);
return $page > 1 ? "<meta name=\"robots\" content=\"noindex, nofollow\" />" : '';
}
protected function getStrategies()
{
return array(
'org_tubepress_impl_html_strategies_SearchInputStrategy',
'org_tubepress_impl_html_strategies_SearchOutputStrategy',
'org_tubepress_impl_html_strategies_SingleVideoStrategy',
'org_tubepress_impl_html_strategies_SoloPlayerStrategy',
'org_tubepress_impl_html_strategies_ThumbGalleryStrategy'
);
}
}

View File

@ -1,124 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
tubepress_load_classes(array('org_tubepress_api_patterns_Strategy',
'org_tubepress_api_const_options_names_Output',
'org_tubepress_api_const_options_values_OutputValue',
'org_tubepress_api_url_Url'));
/**
* HTML generation strategy that generates HTML for a single video + meta info.
*/
class org_tubepress_impl_html_strategies_SearchInputStrategy implements org_tubepress_api_patterns_Strategy
{
const LOG_PREFIX = 'Search Input Strategy';
private $_ioc;
protected $_tpom;
/**
* Called *before* canHandle() and execute() to allow the strategy
* to initialize itself.
*
* @return void
*/
public function start()
{
$this->_ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$this->_tpom = $this->_ioc->get('org_tubepress_api_options_OptionsManager');
}
/**
* Called *after* canHandle() and execute() to allow the strategy
* to tear itself down.
*
* @return void
*/
public function stop()
{
unset($this->_ioc);
unset($this->_tpom);
}
/**
* Returns true if this strategy is able to handle
* the request.
*
* @return boolean True if the strategy can handle the request, false otherwise.
*/
public function canHandle()
{
return $this->_tpom->get(org_tubepress_api_const_options_names_Output::OUTPUT) === org_tubepress_api_const_options_values_OutputValue::SEARCH_INPUT;
}
/**
* Execute the strategy.
*
* @return unknown The result of this strategy execution.
*/
public function execute()
{
$th = $this->_ioc->get('org_tubepress_api_theme_ThemeHandler');
$ms = $this->_ioc->get('org_tubepress_api_message_MessageService');
$template = $th->getTemplateInstance($this->getTemplatePath());
$resultsUrl = $this->_tpom->get(org_tubepress_api_const_options_names_Output::SEARCH_RESULTS_URL);
$qss = $this->_ioc->get('org_tubepress_api_querystring_QueryStringService');
/* if the user didn't request a certain page, just send the search results right back here */
if ($resultsUrl == '') {
$resultsUrl = $qss->getFullUrl($_SERVER);
}
/* clean up the search terms a bit */
$searchTerms = urldecode($qss->getSearchTerms($_GET));
$searchTerms = org_tubepress_impl_util_StringUtils::cleanForSearch($searchTerms);
/*
* read http://stackoverflow.com/questions/1116019/submitting-a-get-form-with-query-string-params-and-hidden-params-disappear
* if you're curious as to what's going on here
*/
$url = new org_tubepress_api_url_Url($resultsUrl);
$params = $url->getQueryVariables();
unset($params[org_tubepress_api_const_querystring_QueryParamName::PAGE]);
unset($params[org_tubepress_api_const_querystring_QueryParamName::SEARCH_TERMS]);
/* apply the template variables */
$template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_HANDLER_URL, $resultsUrl);
$template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_HIDDEN_INPUTS, $params);
$template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_TERMS, $searchTerms);
$template->setVariable(org_tubepress_api_const_template_Variable::SEARCH_BUTTON, $ms->_('search-input-button'));
$this->applyTemplateVariables($template);
return $template->toString();
}
protected function applyTemplateVariables($template)
{
//override point
}
protected function getTemplatePath()
{
return 'search/search_input.tpl.php';
}
}

View File

@ -1,123 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
tubepress_load_classes(array('org_tubepress_api_patterns_Strategy',
'org_tubepress_api_const_options_names_Output'));
/**
* HTML generation strategy that generates HTML for a single video + meta info.
*/
class org_tubepress_impl_html_strategies_SearchOutputStrategy implements org_tubepress_api_patterns_Strategy
{
const LOG_PREFIX = 'Search Output Strategy';
private $_ioc;
private $_tpom;
private $_rawSearchTerms;
/**
* Called *before* canHandle() and execute() to allow the strategy
* to initialize itself.
*
* @return void
*/
public function start()
{
$this->_ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$this->_tpom = $this->_ioc->get('org_tubepress_api_options_OptionsManager');
}
/**
* Called *after* canHandle() and execute() to allow the strategy
* to tear itself down.
*
* @return void
*/
public function stop()
{
unset($this->_ioc);
unset($this->_tpom);
unset($this->_rawSearchTerms);
}
/**
* Returns true if this strategy is able to handle
* the request.
*
* @return boolean True if the strategy can handle the request, false otherwise.
*/
public function canHandle()
{
/* not configured at all for search results */
if ($this->_tpom->get(org_tubepress_api_const_options_names_Output::OUTPUT) !== org_tubepress_api_const_options_values_OutputValue::SEARCH_RESULTS) {
return false;
}
/* do we have search terms? */
$qss = $this->_ioc->get('org_tubepress_api_querystring_QueryStringService');
$this->_rawSearchTerms = $qss->getSearchTerms($_GET);
/* are we set up for a gallery fallback? */
$mustShowSearchResults = $this->_tpom->get(org_tubepress_api_const_options_names_Output::SEARCH_RESULTS_ONLY);
/* either the user is searching, or they've requested that we only show search results */
return $this->_rawSearchTerms != '' || $mustShowSearchResults;
}
/**
* Execute the strategy.
*
* @return unknown The result of this strategy execution.
*/
public function execute()
{
/* if the user isn't searching, don't display anything */
if ($this->_rawSearchTerms == '') {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'User doesn\'t appear to be searching. Will not display anything.');
return '';
}
/* clean up the search terms */
$searchTerms = org_tubepress_impl_util_StringUtils::cleanForSearch($this->_rawSearchTerms);
/* who are we searching? */
switch ($this->_tpom->get(org_tubepress_api_const_options_names_Output::SEARCH_PROVIDER)) {
case 'vimeo':
$this->_tpom->set(org_tubepress_api_const_options_names_Output::MODE, org_tubepress_api_const_options_values_ModeValue::VIMEO_SEARCH);
$this->_tpom->set(org_tubepress_api_const_options_names_Output::VIMEO_SEARCH_VALUE, $searchTerms);
break;
default:
$this->_tpom->set(org_tubepress_api_const_options_names_Output::MODE, org_tubepress_api_const_options_values_ModeValue::TAG);
$this->_tpom->set(org_tubepress_api_const_options_names_Output::TAG_VALUE, $searchTerms);
break;
}
/* display the results as a thumb gallery */
//TODO: what if this bails?
return $this->_ioc->get('org_tubepress_api_patterns_StrategyManager')->executeStrategy(array(
'org_tubepress_impl_html_strategies_ThumbGalleryStrategy'
));
}
}

View File

@ -1,86 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
tubepress_load_classes(array('org_tubepress_api_patterns_Strategy',
'org_tubepress_api_single_SingleVideo'));
/**
* HTML generation strategy that generates HTML for a single video + meta info.
*/
class org_tubepress_impl_html_strategies_SingleVideoStrategy implements org_tubepress_api_patterns_Strategy
{
const LOG_PREFIX = 'Single Video Strategy';
private $_ioc;
private $_tpom;
/**
* Called *before* canHandle() and execute() to allow the strategy
* to initialize itself.
*
* @return void
*/
public function start()
{
$this->_ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$this->_tpom = $this->_ioc->get('org_tubepress_api_options_OptionsManager');
}
/**
* Called *after* canHandle() and execute() to allow the strategy
* to tear itself down.
*
* @return void
*/
public function stop()
{
unset($this->_ioc);
unset($this->_tpom);
}
/**
* Returns true if this strategy is able to handle
* the request.
*
* @return boolean True if the strategy can handle the request, false otherwise.
*/
public function canHandle()
{
return $this->_tpom->get(org_tubepress_api_const_options_names_Output::VIDEO) != '';
}
/**
* Execute the strategy.
*
* @return unknown The result of this strategy execution.
*/
public function execute()
{
$videoId = $this->_tpom->get(org_tubepress_api_const_options_names_Output::VIDEO);
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Building single video with ID %s', $videoId);
$singleVideoGenerator = $this->_ioc->get('org_tubepress_api_single_SingleVideo');
return $singleVideoGenerator->getSingleVideoHtml($videoId);
}
}

View File

@ -1,104 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
tubepress_load_classes(array('org_tubepress_api_patterns_Strategy',
'org_tubepress_api_const_options_names_Display',
'org_tubepress_api_player_Player',
'org_tubepress_impl_log_Log',
'org_tubepress_api_querystring_QueryStringService'));
/**
* HTML-generation strategy that implements the "solo" player strategy.
*/
class org_tubepress_impl_html_strategies_SoloPlayerStrategy implements org_tubepress_api_patterns_Strategy
{
const LOG_PREFIX = 'Solo Player Strategy';
private $_ioc;
private $_videoId;
/**
* Called *before* canHandle() and execute() to allow the strategy
* to initialize itself.
*
* @return void
*/
public function start()
{
$this->_ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
}
/**
* Called *after* canHandle() and execute() to allow the strategy
* to tear itself down.
*
* @return void
*/
public function stop()
{
unset($this->_ioc);
unset($this->_videoId);
}
/**
* Returns true if this strategy is able to handle
* the request.
*
* @return boolean True if the strategy can handle the request, false otherwise.
*/
public function canHandle()
{
$tpom = $this->_ioc->get('org_tubepress_api_options_OptionsManager');
$playerName = $tpom->get(org_tubepress_api_const_options_names_Display::CURRENT_PLAYER_NAME);
if ($playerName !== org_tubepress_api_player_Player::SOLO) {
return false;
}
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Solo player detected. Checking query string for video ID.');
/* see if we have a custom video ID set */
$qss = $this->_ioc->get('org_tubepress_api_querystring_QueryStringService');
$videoId = $qss->getCustomVideo($_GET);
if ($videoId == '') {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Solo player in use, but no video ID set in URL.');
return false;
}
$this->_videoId = $videoId;
return true;
}
/**
* Execute the strategy.
*
* @return unknown The result of this strategy execution.
*/
public function execute()
{
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Building single video with ID %s', $this->_videoId);
$single = $this->_ioc->get('org_tubepress_api_single_SingleVideo');
return $single->getSingleVideoHtml($this->_videoId, $this->_ioc);
}
}

View File

@ -1,136 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
tubepress_load_classes(array('org_tubepress_api_patterns_Strategy',
'org_tubepress_api_const_template_Variable',
'org_tubepress_impl_log_Log',
'org_tubepress_api_const_filters_ExecutionPoint',
'org_tubepress_api_provider_Provider',
'org_tubepress_api_feed_FeedResult',
'org_tubepress_api_patterns_FilterManager'));
class org_tubepress_impl_html_strategies_ThumbGalleryStrategy implements org_tubepress_api_patterns_Strategy
{
const LOG_PREFIX = 'Thumb Gallery Strategy';
private $_ioc;
/**
* Called *before* canHandle() and execute() to allow the strategy
* to initialize itself.
*
* @return void
*/
public function start()
{
$this->_ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
}
/**
* Called *after* canHandle() and execute() to allow the strategy
* to tear itself down.
*
* @return void
*/
public function stop()
{
unset($this->_ioc);
}
/**
* Returns true if this strategy is able to handle
* the request.
*
* @return boolean True if the strategy can handle the request, false otherwise.
*/
public function canHandle()
{
return true;
}
/**
* Execute the strategy.
*
* @return unknown The result of this strategy execution.
*/
public function execute()
{
$qss = $this->_ioc->get('org_tubepress_api_querystring_QueryStringService');
$galleryId = $qss->getGalleryId($_GET);
if ($galleryId == '') {
$galleryId = mt_rand();
}
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Starting to build thumbnail gallery %s', $galleryId);
return $this->_getHtml($galleryId);
}
/**
* Generates the content of this gallery
*
* @param integer $galleryId The unique identifier of the gallery.
*
* @return The HTML content for this gallery
*/
private function _getHtml($galleryId)
{
$provider = $this->_ioc->get('org_tubepress_api_provider_Provider');
$tpom = $this->_ioc->get('org_tubepress_api_options_OptionsManager');
$filterManager = $this->_ioc->get('org_tubepress_api_patterns_FilterManager');
$themeHandler = $this->_ioc->get('org_tubepress_api_theme_ThemeHandler');
$ms = $this->_ioc->get('org_tubepress_api_message_MessageService');
$template = $themeHandler->getTemplateInstance('gallery.tpl.php');
/* first grab the videos */
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Asking provider for videos');
$feedResult = $provider->getMultipleVideos();
$numVideos = sizeof($feedResult->getVideoArray());
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Provider has delivered %d videos', $numVideos);
if ($numVideos == 0) {
return $ms->_('no-videos-found');
}
/* send the feed result through the filters */
$feedResult = $filterManager->runFilters(org_tubepress_api_const_filters_ExecutionPoint::VIDEOS_DELIVERY, $feedResult, $galleryId);
/* add some core template variables */
$template->setVariable(org_tubepress_api_const_template_Variable::VIDEO_ARRAY, $feedResult->getVideoArray());
$template->setVariable(org_tubepress_api_const_template_Variable::GALLERY_ID, $galleryId);
$template->setVariable(org_tubepress_api_const_template_Variable::THUMBNAIL_WIDTH, $tpom->get(org_tubepress_api_const_options_names_Display::THUMB_WIDTH));
$template->setVariable(org_tubepress_api_const_template_Variable::THUMBNAIL_HEIGHT, $tpom->get(org_tubepress_api_const_options_names_Display::THUMB_HEIGHT));
/* send the template through the filters */
$filteredTemplate = $filterManager->runFilters(org_tubepress_api_const_filters_ExecutionPoint::GALLERY_TEMPLATE, $template, $feedResult, $galleryId);
/* send gallery HTML through the filters */
$filteredHtml = $filterManager->runFilters(org_tubepress_api_const_filters_ExecutionPoint::GALLERY_HTML, $filteredTemplate->toString(), $galleryId);
/* we're done. tie up */
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Done assembling gallery %d', $galleryId);
$tpom = $this->_ioc->get('org_tubepress_api_options_OptionsManager');
$tpom->setCustomOptions(array());
return $filteredHtml;
}
}

View File

@ -1,207 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_http_HttpClient',
'org_tubepress_impl_http_clientimpl_Encoding',
'org_tubepress_api_patterns_StrategyManager'));
/**
* Lifted from http://core.trac.wordpress.org/browser/tags/3.0.4/wp-includes/class-http.php
*
* HTTP Class for managing HTTP Transports and making HTTP requests.
*
*/
class org_tubepress_impl_http_FastHttpClient implements org_tubepress_api_http_HttpClient
{
const LOG_PREFIX = 'HTTP Client';
const ARGS_BODY = 'body';
const ARGS_COOKIES = 'cookies';
const ARGS_COMPRESS = 'compress';
const ARGS_DECOMPRESS = 'decompress';
const ARGS_HEADERS = 'headers';
const ARGS_HTTP_VERSION = 'httpversion';
const ARGS_IS_SSL = 'ssl';
const ARGS_METHOD = 'method';
const ARGS_SSL_VERIFY = 'sslverify';
const ARGS_TIMEOUT = 'timeout';
const ARGS_USER_AGENT = 'user-agent';
/**
* Post.
*
* @param string $url URI resource.
* @param unknown $body The body of the POST
*
* @return string Resulting body as a string (could be null)
*/
public function post($url, $body)
{
return $this->_request($url, array(
self::ARGS_METHOD => org_tubepress_api_http_HttpClient::HTTP_METHOD_POST,
self::ARGS_BODY => $body
));
}
/**
* Get.
*
* @param string $url URI resource.
*
* @return string Resulting body as a string (could be null)
*/
public function get($url)
{
return $this->_request($url, array(self::ARGS_METHOD => org_tubepress_api_http_HttpClient::HTTP_METHOD_GET));
}
/**
* Send a HTTP request to a URI.
*
* The body and headers are part of the arguments. The 'body' argument is for the body and will
* accept either a string or an array. The 'headers' argument should be an array, but a string
* is acceptable.
*
* The only URI that are supported in the HTTP Transport implementation are the HTTP and HTTPS
* protocols. HTTP and HTTPS are assumed so the server might not know how to handle the send
* headers. Other protocols are unsupported and most likely will fail.
*
* @param string $url URI resource.
* @param array $args Generic HTTP options.
*
* @return array containing 'headers', 'body', 'response', 'cookies'
*/
private function _request($url, $args)
{
$defaults = array(
self::ARGS_METHOD => org_tubepress_api_http_HttpClient::HTTP_METHOD_GET,
self::ARGS_TIMEOUT => 5,
self::ARGS_HTTP_VERSION => '1.0',
self::ARGS_USER_AGENT => 'TubePress; http://tubepress.org',
self::ARGS_HEADERS => array(),
self::ARGS_COOKIES => array(),
self::ARGS_BODY => null,
self::ARGS_COMPRESS => false,
self::ARGS_DECOMPRESS => true,
self::ARGS_SSL_VERIFY => true
);
$r = array_merge($defaults, $args);
$arrURL = parse_url($url);
if (empty($url) || empty($arrURL['scheme'])) {
throw new Exception('A valid URL was not provided.');
}
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Will perform %s to <a href="%s">%s</a>', $r[self::ARGS_METHOD], $url, $url);
// Determine if this is a https call and pass that on to the transport functions
// so that we can blacklist the transports that do not support ssl verification
$r[self::ARGS_IS_SSL] = $arrURL['scheme'] == 'https' || $arrURL['scheme'] == 'ssl';
// Determine if this request is local
$r['local'] = 'localhost' == $arrURL['host'];
if (org_tubepress_impl_http_clientimpl_Encoding::isCompressionAvailable()) {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'HTTP compression is available. Yay!');
$r[self::ARGS_HEADERS][org_tubepress_api_http_HttpClient::HTTP_HEADER_ACCEPT_ENCODING] = org_tubepress_impl_http_clientimpl_Encoding::getAcceptEncodingString();
} else {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'HTTP compression is NOT available. Boo.');
}
if (empty($r[self::ARGS_BODY])) {
$r[self::ARGS_BODY] = null;
// Some servers fail when sending content without the content-length header being set.
// Also, to fix another bug, we only send when doing POST and PUT and the content-length
// header isn't already set.
if (($r[self::ARGS_METHOD] == org_tubepress_api_http_HttpClient::HTTP_METHOD_POST || $r[self::ARGS_METHOD] == org_tubepress_api_http_HttpClient::HTTP_METHOD_PUT)) {
$r[self::ARGS_HEADERS][org_tubepress_api_http_HttpClient::HTTP_HEADER_CONTENT_LENGTH] = 0;
}
} else {
$r[self::ARGS_HEADERS][org_tubepress_api_http_HttpClient::HTTP_HEADER_CONTENT_LENGTH] = strlen($r[self::ARGS_BODY]);
}
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$strategies = self::_getTransportStrategies($ioc);
$sm = $ioc->get('org_tubepress_api_patterns_StrategyManager');
$result = $sm->executeStrategy($strategies, $url, $r);
if (is_null($result)) {
throw new Exception("Could not retrieve $url");
}
//log
return $result;
}
private static function _getTransportStrategies(org_tubepress_api_ioc_IocService $ioc)
{
$result = array();
$tpom = $ioc->get('org_tubepress_api_options_OptionsManager');
if (!$tpom->get(org_tubepress_api_const_options_names_Advanced::DISABLE_HTTP_EXTHTTP)) {
$result[] = 'org_tubepress_impl_http_clientimpl_strategies_ExtHttpStrategy';
} else {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'ExtHttp transport disabled by request');
}
if (!$tpom->get(org_tubepress_api_const_options_names_Advanced::DISABLE_HTTP_CURL)) {
$result[] = 'org_tubepress_impl_http_clientimpl_strategies_CurlStrategy';
} else {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Curl transport disabled by request');
}
if (!$tpom->get(org_tubepress_api_const_options_names_Advanced::DISABLE_HTTP_STREAMS)) {
$result[] = 'org_tubepress_impl_http_clientimpl_strategies_StreamsStrategy';
} else {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'Streams transport disabled by request');
}
if (!$tpom->get(org_tubepress_api_const_options_names_Advanced::DISABLE_HTTP_FOPEN)) {
$result[] = 'org_tubepress_impl_http_clientimpl_strategies_FopenStrategy';
} else {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'fopen transport disabled by request');
}
if (!$tpom->get(org_tubepress_api_const_options_names_Advanced::DISABLE_HTTP_FSOCKOPEN)) {
$result[] = 'org_tubepress_impl_http_clientimpl_strategies_FsockOpenStrategy';
} else {
org_tubepress_impl_log_Log::log(self::LOG_PREFIX, 'fsockopen transport disabled by request');
}
if (sizeof($result) === 0) {
throw new Exception("Must enable at least one HTTP transport");
}
return $result;
}
}

View File

@ -1,188 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Lifted from http://core.trac.wordpress.org/browser/tags/3.0.4/wp-includes/class-http.php
*
* Internal representation of a single cookie.
*
* Returned cookies are represented using this class, and when cookies are set, if they are not
* already a org_tubepress_impl_http_clientimpl_Cookie() object, then they are turned into one.
*
*/
class org_tubepress_impl_http_clientimpl_Cookie
{
/** Cookie name. */
var $name;
/** Cookie value. */
var $value;
/** When the cookie expires. */
var $expires;
/** Cookie URL path. */
var $path;
/** Cookie Domain. */
var $domain;
/**
* Sets up this cookie object.
*
* The parameter $data should be either an associative array containing the indices names below
* or a header string detailing it.
*
* If it's an array, it should include the following elements:
* <ol>
* <li>Name</li>
* <li>Value - should NOT be urlencoded already.</li>
* <li>Expires - (optional) String or int (UNIX timestamp).</li>
* <li>Path (optional)</li>
* <li>Domain (optional)</li>
* </ol>
*
* @param string|array $data Raw cookie data.
*/
public function __construct($data)
{
if (is_string($data)) {
// Assume it's a header string direct from a previous request
$pairs = explode(';', $data);
// Special handling for first pair; name=value. Also be careful of "=" in value
$name = trim(substr($pairs[0], 0, strpos($pairs[0], '=')));
$value = substr($pairs[0], strpos($pairs[0], '=') + 1);
$this->name = $name;
$this->value = urldecode($value);
array_shift($pairs); //Removes name=value from items.
// Set everything else as a property
foreach ($pairs as $pair) {
$pair = rtrim($pair);
if (empty($pair)) { //Handles the cookie ending in ; which results in a empty final pair
continue;
}
list($key, $val) = strpos($pair, '=') ? explode('=', $pair) : array($pair, '');
$key = strtolower(trim($key));
if ('expires' == $key) {
$val = strtotime($val);
}
$this->$key = $val;
}
} else {
if (!isset($data['name'])) {
return false;
}
// Set properties based directly on parameters
$this->name = $data['name'];
$this->value = isset($data['value']) ? $data['value'] : '';
$this->path = isset($data['path']) ? $data['path'] : '';
$this->domain = isset($data['domain']) ? $data['domain'] : '';
if (isset($data['expires'])) {
$this->expires = is_int($data['expires']) ? $data['expires'] : strtotime($data['expires']);
} else {
$this->expires = null;
}
}
}
/**
* Confirms that it's OK to send this cookie to the URL checked against.
*
* Decision is based on RFC 2109/2965, so look there for details on validity.
*
* @param string $url URL you intend to send this cookie to
*
* @return boolean TRUE if allowed, FALSE otherwise.
*/
public function test($url)
{
// Expires - if expired then nothing else matters
if (time() > $this->expires) {
return false;
}
// Get details on the URL we're thinking about sending to
$url = parse_url($url);
$url['port'] = isset($url['port']) ? $url['port'] : 80;
$url['path'] = isset($url['path']) ? $url['path'] : '/';
// Values to use for comparison against the URL
$path = isset($this->path) ? $this->path : '/';
$port = isset($this->port) ? $this->port : 80;
$domain = isset($this->domain) ? strtolower($this->domain) : strtolower($url['host']);
if (false === stripos($domain, '.')) {
$domain .= '.local';
}
// Host - very basic check that the request URL ends with the domain restriction (minus leading dot)
$domain = substr($domain, 0, 1) == '.' ? substr($domain, 1) : $domain;
if (substr($url['host'], -strlen($domain)) != $domain) {
return false;
}
// Port - supports "port-lists" in the format: "80,8000,8080"
if (!in_array($url['port'], explode(',', $port))) {
return false;
}
// Path - request path must start with path restriction
if (substr($url['path'], 0, strlen($path)) != $path) {
return false;
}
return true;
}
/**
* Convert cookie name and value back to header string.
*
* @return string Header encoded cookie name and value.
*/
public function getHeaderValue()
{
if (empty($this->name) || empty($this->value)) {
return '';
}
return $this->name . '=' . urlencode($this->value);
}
/**
* Retrieve cookie header for usage in the rest of the WordPress HTTP API.
*
* @return string
*/
public function getFullHeader()
{
return 'Cookie: ' . $this->getHeaderValue();
}
}

View File

@ -1,235 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Lifted from http://core.trac.wordpress.org/browser/tags/3.0.4/wp-includes/class-http.php
*
* Implementation for deflate and gzip transfer encodings.
*
* Includes RFC 1950, RFC 1951, and RFC 1952.
*/
class org_tubepress_impl_http_clientimpl_Encoding
{
/**
* Compress raw string using the deflate format.
*
* Supports the RFC 1951 standard.
*
* @param string $raw String to compress.
* @param int $level Optional, default is 9. Compression level, 9 is highest.
* @param string $supports Optional, not used. When implemented it will choose the right compression based on what the server supports.
*
* @return string|bool False on failure.
*/
public static function compress($raw, $level = 9, $supports = null)
{
return gzdeflate($raw, $level);
}
/**
* Decompression of deflated string.
*
* Will attempt to decompress using the RFC 1950 standard, and if that fails
* then the RFC 1951 standard deflate will be attempted. Finally, the RFC
* 1952 standard gzip decode will be attempted. If all fail, then the
* original compressed string will be returned.
*
* @param string $compressed String to decompress.
* @param int $length The optional length of the compressed data.
*
* @return string|bool False on failure.
*/
public static function decompress($compressed, $length = null)
{
if (empty($compressed)) {
return $compressed;
}
if (false !== ($decompressed = @gzinflate($compressed))) {
return $decompressed;
}
if (false !== ($decompressed = self::simulatedGzInflate($compressed))) {
return $decompressed;
}
if (false !== ($decompressed = @gzuncompress($compressed))) {
return $decompressed;
}
if (function_exists('gzdecode')) {
$decompressed = @gzdecode($compressed);
if (false !== $decompressed) {
return $decompressed;
}
}
return $compressed;
}
/**
* Decompression of deflated string while staying compatible with the majority of servers.
*
* Certain Servers will return deflated data with headers which PHP's gziniflate()
* function cannot handle out of the box. The following function lifted from
* http://au2.php.net/manual/en/function.gzinflate.php#77336 will attempt to deflate
* the various return forms used.
*
* See http://au2.php.net/manual/en/function.gzinflate.php#77336
*
* @param string $gzData String to decompress.
*
* @return string|bool False on failure.
*/
public static function simulatedGzInflate($gzData)
{
if (substr($gzData, 0, 3) == "\x1f\x8b\x08") {
$i = 10;
$flg = ord(substr($gzData, 3, 1));
if ($flg > 0) {
if ($flg & 4) {
list($xlen) = unpack('v', substr($gzData, $i, 2));
$i = $i + 2 + $xlen;
}
if ($flg & 8) {
$i = strpos($gzData, "\0", $i) + 1;
}
if ($flg & 16) {
$i = strpos($gzData, "\0", $i) + 1;
}
if ($flg & 2) {
$i = $i + 2;
}
}
return gzinflate(substr($gzData, $i, -8));
} else {
return false;
}
}
/**
* What encoding types to accept and their priority values.
*
* @return string Types of encoding to accept.
*/
public static function getAcceptEncodingString()
{
$type = array();
if (function_exists('gzinflate')) {
$type[] = 'deflate;q=1.0';
}
if (function_exists('gzuncompress')) {
$type[] = 'compress;q=0.5';
}
if (function_exists('gzdecode')) {
$type[] = 'gzip;q=0.5';
}
return implode(', ', $type);
}
/**
* What enconding the content used when it was compressed to send in the headers.
*
* @return string Content-Encoding string to send in the header.
*/
public static function getContentEncodingString()
{
return 'deflate';
}
/**
* Whether the content be decoded based on the headers.
*
* @param array|string $headers All of the available headers.
*
* @return bool
*/
public static function shouldDecode($headers)
{
if (is_array($headers)) {
if (array_key_exists('content-encoding', $headers) && ! empty($headers['content-encoding'])) {
return true;
}
} else if (is_string($headers)) {
return (stripos($headers, 'content-encoding:') !== false);
}
return false;
}
/**
* Whether decompression and compression are supported by the PHP version.
*
* Each function is tested instead of checking for the zlib extension, to
* ensure that the functions all exist in the PHP version and aren't
* disabled.
*
* @return bool
*/
public static function isCompressionAvailable()
{
return (function_exists('gzuncompress') || function_exists('gzdeflate') || function_exists('gzinflate'));
}
/**
* Decodes chunk transfer-encoding, based off the HTTP 1.1 specification.
*
* Based off the HTTP http_encoding_dechunk function. Does not support UTF-8. Does not support
* returning footer headers. Shouldn't be too difficult to support it though.
*
* @param string $body Body content
*
* @return string Chunked decoded body on success or raw body on failure.
*/
public static function chunkTransferDecode($body)
{
$body = str_replace(array("\r\n", "\r"), "\n", $body);
// The body is not chunked encoding or is malformed.
if (! preg_match('/^[0-9a-f]+(\s|\n)+/mi', trim($body))) {
return $body;
}
$parsedBody = '';
while (true) {
$hasChunk = (bool) preg_match('/^([0-9a-f]+)(\s|\n)+/mi', $body, $match);
if (!$hasChunk || empty($match[1])) {
return $body;
}
$length = hexdec($match[1]);
$chunkLength = strlen($match[0]);
$strBody = substr($body, $chunkLength, $length);
$parsedBody .= $strBody;
$body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n");
if ("0" == trim($body)) {
return $parsedBody; // Ignore footer headers.
}
}
}
}

View File

@ -1,202 +0,0 @@
<?php
/**
* Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress 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.
*
* TubePress 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 TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/
function_exists('tubepress_load_classes')
|| require dirname(__FILE__) . '/../../../../../tubepress_classloader.php';
tubepress_load_classes(array('org_tubepress_api_patterns_Strategy',
'org_tubepress_impl_http_clientimpl_Cookie'));
/**
* Lifted from http://core.trac.wordpress.org/browser/tags/3.0.4/wp-includes/class-http.php
*
* Base HTTP strategy.
*/
abstract class org_tubepress_impl_http_clientimpl_strategies_AbstractHttpStrategy implements org_tubepress_api_patterns_Strategy
{
private $_redirectCount;
/**
* Execute an HTTP request.
*
* @return array 'headers', 'body', 'cookies' and 'response' keys.
*/
public function execute()
{
$args = func_get_args();
if (sizeof($args) !== 2) {
throw new Exception("Expected two arguments, only got " . sizeof($args));
}
if (!is_array($args[1])) {
throw new Exception("Second argument must be an array");
}
$result = $this->_doExecute($args[0], $args[1]);
/* check response code */
$code = $result['response']['code'];
if ($code != 200) {
throw new Exception("Request for " . $args[0] . " returned a $code HTTP response: " . $result['response']['message']);
}
return $result['body'];
}
/**
* Called *before* canHandle() and execute() to allow the strategy
* to initialize itself.
*
* @return void
*/
function start()
{
$this->_redirectCount = 0;
}
/**
* Called *after* canHandle() and execute() to allow the strategy
* to tear itself down.
*
* @return void
*/
function stop()
{
$this->_redirectCount = 0;
}
protected abstract function _doExecute($url, $args);
protected function _canRedirect()
{
return ++$this->_redirectCount < 5;
}
/**
* Transform header string into an array.
*
* If an array is given then it is assumed to be raw header data with numeric keys with the
* headers as the values. No headers must be passed that were already processed.
*
* @param string|array $headers The headers.
*
* @return array Processed string headers. If duplicate headers are encountered,
* Then a numbered array is returned as the value of that header-key.
*/
protected static function _getProcessedHeaders($headers)
{
// split headers, one per array element
if (is_string($headers)) {
// tolerate line terminator: CRLF = LF (RFC 2616 19.3)
$headers = str_replace("\r\n", "\n", $headers);
// unfold folded header fields. LWS = [CRLF] 1*(SP | HT) <US-ASCII SP, space (32)>, <US-ASCII HT, horizontal-tab (9)> (RFC 2616 2.2)
$headers = preg_replace('/\n[ \t]/', ' ', $headers);
// create the headers array
$headers = explode("\n", $headers);
}
$response = array('code' => 0, 'message' => '');
// If a redirection has taken place, The headers for each page request may have been passed.
// In this case, determine the final HTTP header and parse from there.
for ($i = count($headers)-1; $i >= 0; $i--) {
if (!empty($headers[$i]) && false === strpos($headers[$i], ':')) {
$headers = array_splice($headers, $i);
break;
}
}
$cookies = array();
$newheaders = array();
foreach ($headers as $tempheader) {
if (empty($tempheader)) {
continue;
}
if (false === strpos($tempheader, ':')) {
list(, $response['code'], $response['message']) = explode(' ', $tempheader, 3);
continue;
}
list($key, $value) = explode(':', $tempheader, 2);
if (!empty($value)) {
$key = strtolower($key);
if (isset($newheaders[$key])) {
if (!is_array($newheaders[$key])) {
$newheaders[$key] = array($newheaders[$key]);
}
$newheaders[$key][] = trim($value);
} else {
$newheaders[$key] = trim($value);
}
if ('set-cookie' == $key) {
$cookies[] = new org_tubepress_impl_http_clientimpl_Cookie($value);
}
}
}
return array('response' => $response, 'headers' => $newheaders, 'cookies' => $cookies);
}
/**
* Parses the responses and splits the parts into headers and body.
*
* @param string $strResponse The full response string
*
* @return array Array with 'headers' and 'body' keys.
*/
protected static function _breakRawStringResponseIntoHeaderAndBody($strResponse)
{
$res = explode("\r\n\r\n", $strResponse, 2);
return array('headers' => isset($res[0]) ? $res[0] : array(), 'body' => isset($res[1]) ? $res[1] : '');
}
/**
* Takes the arguments for a ::request() and checks for the cookie array.
*
* If it's found, then it's assumed to contain org_tubepress_http_FastHttpClient_Cookie objects, which are each parsed
* into strings and added to the Cookie: header (within the arguments array). Edits the array by
* reference.
*
* @param array &$r Full array of args passed into ::request()
*
* @return void
*/
protected static function _buildCookieHeader(&$r)
{
if (! empty($r[self::ARGS_COOKIES])) {
$cookies_header = '';
foreach ((array) $r[self::ARGS_COOKIES] as $cookie) {
$cookies_header .= $cookie->getHeaderValue() . '; ';
}
$cookies_header = substr($cookies_header, 0, -2);
$r[self::ARGS_HEADERS]['cookie'] = $cookies_header;
}
}
}

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