first import
This commit is contained in:
339
sites/all/modules/omega_tools/LICENSE.txt
Normal file
339
sites/all/modules/omega_tools/LICENSE.txt
Normal file
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) 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
|
||||
this service 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 make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. 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.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
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
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the 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 a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE 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.
|
||||
|
||||
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
|
||||
convey 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision 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, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This 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.
|
34
sites/all/modules/omega_tools/README.txt
Normal file
34
sites/all/modules/omega_tools/README.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
##########################################################################################
|
||||
_ _ _ _
|
||||
__| | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ __ _ ___ ___| | _____
|
||||
/ _` |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| / _` |/ _ \/ _ \ |/ / __|
|
||||
| (_| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | (_| | __/ __/ <\__ \
|
||||
\__,_|\___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| \__, |\___|\___|_|\_\___/
|
||||
|_| |___/
|
||||
##########################################################################################
|
||||
|
||||
##########################################################################################
|
||||
##### Omega Tools
|
||||
##########################################################################################
|
||||
Informational: http://himer.us/omega960
|
||||
Project Page: http://drupal.org/project/omega_tools
|
||||
Issue Queue: http://drupal.org/project/issues/omega_tools
|
||||
Usage Stats: http://drupal.org/project/usage/omega_tools
|
||||
Twitter: http://twitter.com/Omeglicon
|
||||
Maintainer(s):
|
||||
Jake Strawn
|
||||
http://himerus.com
|
||||
http://developmentgeeks.com
|
||||
http://facebook.com/developmentgeeks
|
||||
http://drupal.org/user/159141
|
||||
http://twitter.com/himerus
|
||||
Sebastian Siemssen
|
||||
http://twitter.com/thefubhy
|
||||
http://drupal.org/user/761344
|
||||
##########################################################################################
|
||||
|
||||
Omega Tools Information
|
||||
=======================
|
||||
The Omega Tools module is a supplemental helper module for the Omega theme. It allows for
|
||||
creating subthemes via drush or on the admin UI on the fly, and exporting and reverting theme
|
||||
settings that can then be pasted into the .info file for your Omega subtheme.
|
23
sites/all/modules/omega_tools/default/css/README.txt
Normal file
23
sites/all/modules/omega_tools/default/css/README.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
##########################################################################################
|
||||
_ _ _ _
|
||||
__| | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ __ _ ___ ___| | _____
|
||||
/ _` |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| / _` |/ _ \/ _ \ |/ / __|
|
||||
| (_| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | (_| | __/ __/ <\__ \
|
||||
\__,_|\___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| \__, |\___|\___|_|\_\___/
|
||||
|_| |___/
|
||||
##########################################################################################
|
||||
|
||||
##########################################################################################
|
||||
##### Omega Theme
|
||||
##########################################################################################
|
||||
Informational: http://himer.us/omega960
|
||||
Documentation: http://himer.us/omega-docs
|
||||
Project Page: http://drupal.org/project/omega
|
||||
Issue Queue: http://drupal.org/project/issues/omega
|
||||
Usage Stats: http://drupal.org/project/usage/omega
|
||||
Twitter: http://twitter.com/Omeglicon
|
||||
##########################################################################################
|
||||
##### CSS Files
|
||||
##########################################################################################
|
||||
|
||||
Any custom CSS files should be placed in this folder.
|
7
sites/all/modules/omega_tools/default/default.pattern
Normal file
7
sites/all/modules/omega_tools/default/default.pattern
Normal file
@@ -0,0 +1,7 @@
|
||||
name = Default pattern
|
||||
description = This pattern will be used if no starterkit was selected
|
||||
core = 7.x
|
||||
engine = phptemplate
|
||||
screenshot = screenshot.png
|
||||
base theme = omega
|
||||
version = 1.x
|
BIN
sites/all/modules/omega_tools/default/logo.png
Normal file
BIN
sites/all/modules/omega_tools/default/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
39
sites/all/modules/omega_tools/default/preprocess/README.txt
Normal file
39
sites/all/modules/omega_tools/default/preprocess/README.txt
Normal file
@@ -0,0 +1,39 @@
|
||||
##########################################################################################
|
||||
_ _ _ _
|
||||
__| | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ __ _ ___ ___| | _____
|
||||
/ _` |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| / _` |/ _ \/ _ \ |/ / __|
|
||||
| (_| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | (_| | __/ __/ <\__ \
|
||||
\__,_|\___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| \__, |\___|\___|_|\_\___/
|
||||
|_| |___/
|
||||
##########################################################################################
|
||||
|
||||
##########################################################################################
|
||||
##### Omega Theme
|
||||
##########################################################################################
|
||||
Informational: http://himer.us/omega960
|
||||
Documentation: http://himer.us/omega-docs
|
||||
Project Page: http://drupal.org/project/omega
|
||||
Issue Queue: http://drupal.org/project/issues/omega
|
||||
Usage Stats: http://drupal.org/project/usage/omega
|
||||
Twitter: http://twitter.com/Omeglicon
|
||||
##########################################################################################
|
||||
##### Preprocess Hooks
|
||||
##########################################################################################
|
||||
|
||||
Any custom preprocess functionality can (rather than directly in template.php) be placed
|
||||
in this preprocess folder in a file named as such:
|
||||
|
||||
TEMPLATE_preprocess_html() = preprocess-html.inc
|
||||
TEMPLATE_preprocess_page() = preprocess-page.inc
|
||||
TEMPLATE_preprocess_node() = preprocess-node.inc
|
||||
TEMPLATE_preprocess_comment() = preprocess-comment.inc
|
||||
TEMPLATE_preprocess_region() = preprocess-region.inc
|
||||
etc.
|
||||
|
||||
Inside of your preprocess-HOOK.inc files, you can either directly dump the PHP code as it
|
||||
would normally appear INSIDE of a preprocess function, or you can optionally (recommended)
|
||||
wrap the code in a custom hook for Alpha/Omega as such:
|
||||
|
||||
function THEMENAME_alpha_preprocess_HOOK(&$vars) {
|
||||
// custom functionality here
|
||||
}
|
39
sites/all/modules/omega_tools/default/process/README.txt
Normal file
39
sites/all/modules/omega_tools/default/process/README.txt
Normal file
@@ -0,0 +1,39 @@
|
||||
##########################################################################################
|
||||
_ _ _ _
|
||||
__| | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ __ _ ___ ___| | _____
|
||||
/ _` |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| / _` |/ _ \/ _ \ |/ / __|
|
||||
| (_| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | (_| | __/ __/ <\__ \
|
||||
\__,_|\___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| \__, |\___|\___|_|\_\___/
|
||||
|_| |___/
|
||||
##########################################################################################
|
||||
|
||||
##########################################################################################
|
||||
##### Omega Theme
|
||||
##########################################################################################
|
||||
Informational: http://himer.us/omega960
|
||||
Documentation: http://himer.us/omega-docs
|
||||
Project Page: http://drupal.org/project/omega
|
||||
Issue Queue: http://drupal.org/project/issues/omega
|
||||
Usage Stats: http://drupal.org/project/usage/omega
|
||||
Twitter: http://twitter.com/Omeglicon
|
||||
##########################################################################################
|
||||
##### Process Hooks
|
||||
##########################################################################################
|
||||
|
||||
Any custom process functionality can (rather than directly in template.php) be placed
|
||||
in this process folder in a file named as such:
|
||||
|
||||
TEMPLATE_process_html() = process-html.inc
|
||||
TEMPLATE_process_page() = process-page.inc
|
||||
TEMPLATE_process_node() = process-node.inc
|
||||
TEMPLATE_process_comment() = process-comment.inc
|
||||
TEMPLATE_process_region() = process-region.inc
|
||||
etc.
|
||||
|
||||
Inside of your process-HOOK.inc files, you can either directly dump the PHP code as it
|
||||
would normally appear INSIDE of a process function, or you can optionally (recommended)
|
||||
wrap the code in a custom hook for Alpha/Omega as such:
|
||||
|
||||
function THEMENAME_alpha_process_HOOK(&$vars) {
|
||||
// custom functionality here
|
||||
}
|
BIN
sites/all/modules/omega_tools/default/screenshot.png
Normal file
BIN
sites/all/modules/omega_tools/default/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
12
sites/all/modules/omega_tools/default/template.php
Normal file
12
sites/all/modules/omega_tools/default/template.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file is empty by default because the base theme chain (Alpha & Omega) provides
|
||||
* all the basic functionality. However, in case you wish to customize the output that Drupal
|
||||
* generates through Alpha & Omega this file is a good place to do so.
|
||||
*
|
||||
* Alpha comes with a neat solution for keeping this file as clean as possible while the code
|
||||
* for your subtheme grows. Please read the README.txt in the /preprocess and /process subfolders
|
||||
* for more information on this topic.
|
||||
*/
|
26
sites/all/modules/omega_tools/default/templates/README.txt
Normal file
26
sites/all/modules/omega_tools/default/templates/README.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
##########################################################################################
|
||||
_ _ _ _
|
||||
__| | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ __ _ ___ ___| | _____
|
||||
/ _` |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| / _` |/ _ \/ _ \ |/ / __|
|
||||
| (_| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | (_| | __/ __/ <\__ \
|
||||
\__,_|\___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| \__, |\___|\___|_|\_\___/
|
||||
|_| |___/
|
||||
##########################################################################################
|
||||
|
||||
##########################################################################################
|
||||
##### Omega Theme
|
||||
##########################################################################################
|
||||
Informational: http://himer.us/omega960
|
||||
Documentation: http://himer.us/omega-docs
|
||||
Project Page: http://drupal.org/project/omega
|
||||
Issue Queue: http://drupal.org/project/issues/omega
|
||||
Usage Stats: http://drupal.org/project/usage/omega
|
||||
Twitter: http://twitter.com/Omeglicon
|
||||
##########################################################################################
|
||||
|
||||
The templates folder is here to organize any custom templates you have for your subhteme.
|
||||
The HTML5 Starterkit (and subthemes) uses all default templates in the Omega base theme,
|
||||
and is why this directory is empty.
|
||||
|
||||
Any page, node, etc. templates you need to customize can be copied here, and customized
|
||||
accordingly.
|
239
sites/all/modules/omega_tools/includes/omega_tools.admin.inc
Normal file
239
sites/all/modules/omega_tools/includes/omega_tools.admin.inc
Normal file
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_theme_reset_confirm($form, &$form_state, $theme) {
|
||||
$themes = list_themes();
|
||||
$form_state['theme'] = $theme;
|
||||
|
||||
return confirm_form($form,
|
||||
t('Are you sure you want to reset the theme %name?', array('%name' => $themes[$theme]->info['name'])),
|
||||
'admin/appearance/settings/' . $theme,
|
||||
t('<p>You are about to purge the theme settings stored in the database for this theme.</p><p>This will revert to whatever information is set in the .info file, and erase any un-exported customizations.</p>'),
|
||||
t('Reset'),
|
||||
t('Cancel')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_theme_reset_confirm_submit($form, &$form_state) {
|
||||
$themes = list_themes();
|
||||
$theme = $form_state['theme'];
|
||||
|
||||
omega_tools_revert_theme_settings($theme);
|
||||
|
||||
$form_state['redirect'] = 'admin/appearance/settings/' . $theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_theme_download($subtheme) {
|
||||
file_download('temporary', file_uri_target(omega_tools_write_archive(drupal_get_path('theme', $subtheme), $subtheme)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_theme_export($form, &$form_state, $theme) {
|
||||
$form_state['theme'] = $theme;
|
||||
$info = drupal_parse_info_file(drupal_get_path('theme', $theme) . '/' . $theme . '.info');
|
||||
$settings = isset($info['settings']) ? $info['settings'] : array();
|
||||
$settings = variable_get('theme_' . $theme . '_settings', $settings);
|
||||
$editable = _omega_tools_is_editable($theme);
|
||||
|
||||
$form['settings'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('Theme settings'),
|
||||
'#description' => $editable ? t('You may now edit the theme settings before proceeding with the export and eventually saving them to the .info file of your theme. The theme settings provided in this form will be written into the .info file of the %name theme. All settings that are currently present in that file will be overwritten.', array('%name' => $info['name'])) : t("This theme is not editable and therefore you won't be able to export the theme settings automatically."),
|
||||
'#default_value' => omega_tools_build_info_file($settings, 'settings'),
|
||||
'#rows' => 30,
|
||||
'#element_validate' => array('_omega_tools_validate_theme_settings'),
|
||||
);
|
||||
|
||||
$form['revert'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Revert theme settings'),
|
||||
'#description' => t('This will purge the theme settings from the database after exporting them to the .info file of this theme.'),
|
||||
'#default_value' => TRUE,
|
||||
'#access' => $editable,
|
||||
);
|
||||
|
||||
$form['actions']['#type'] = 'actions';
|
||||
$form['actions']['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Export'),
|
||||
'#access' => $editable,
|
||||
);
|
||||
|
||||
$form['actions']['cancel'] = array(
|
||||
'#markup' => l(t('Cancel'), 'admin/appearance/settings/' . $theme),
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_theme_export_submit($form, &$form_state) {
|
||||
$theme = $form_state['theme'];
|
||||
$info = drupal_parse_info_file(drupal_get_path('theme', $theme) . '/' . $theme . '.info');
|
||||
|
||||
unset($info['settings']);
|
||||
|
||||
omega_tools_write_info_file($theme, array_merge($info, drupal_parse_info_format($form_state['values']['settings'])));
|
||||
|
||||
watchdog('theme', t('Theme settings for %theme exported and saved to .info file.', array('%theme' => $info['name'])));
|
||||
drupal_set_message(t('The theme settings for %theme have been exported and saved to the corresponding .info file.', array('%theme' => $info['name'])));
|
||||
|
||||
if ($form_state['values']['revert']) {
|
||||
omega_tools_revert_theme_settings($theme);
|
||||
}
|
||||
|
||||
$form_state['redirect'] = 'admin/appearance/settings/' . $theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_add($form, &$form_state) {
|
||||
system_rebuild_theme_data();
|
||||
|
||||
$themes = omega_tools_base_themes();
|
||||
$starterkits = array();
|
||||
|
||||
if (!empty($themes)) {
|
||||
$base = isset($form_state['values']['base']) ? $form_state['values']['base'] : 'omega';
|
||||
$starterkits = omega_tools_starterkits($base);
|
||||
$starter = isset($form_state['values']['starterkit']) ? $form_state['values']['starterkit'] : key($starterkits);
|
||||
$starter = !empty($starter) ? $starter : '_none';
|
||||
}
|
||||
|
||||
$form['info'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Theme information'),
|
||||
);
|
||||
|
||||
$form['info']['name'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Name'),
|
||||
'#description' => t('The human-readable name for this theme.'),
|
||||
'#default_value' => isset($form_state['values']['name']) ? $form_state['values']['name'] : '',
|
||||
'#size' => 30,
|
||||
'#required' => TRUE,
|
||||
);
|
||||
|
||||
$form['info']['machine_name'] = array(
|
||||
'#type' => 'machine_name',
|
||||
'#default_value' => isset($form_state['values']['machine_name']) ? $form_state['values']['machine_name'] : '',
|
||||
'#maxlength' => 30,
|
||||
'#machine_name' => array(
|
||||
'source' => array('info', 'name'),
|
||||
),
|
||||
'#element_validate' => array('_omega_tools_validate_theme_name'),
|
||||
);
|
||||
|
||||
$form['info']['automated'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Install automatically'),
|
||||
'#description' => t('Please select wether you want to install this theme manually or if it should be automatically placed in the selected destination. This feature requires you to have write permission for the selected destination.'),
|
||||
'#default_value' => TRUE,
|
||||
'#element_validate' => array('omega_tools_subtheme_validate_automation'),
|
||||
);
|
||||
|
||||
$form['info']['destination'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Destination'),
|
||||
'#description' => t('The theme will be place in the path selected here.'),
|
||||
'#options' => omega_tools_sites_options(),
|
||||
'#default_value' => 'all',
|
||||
'#states' => array(
|
||||
'visible' => array(
|
||||
':input[name="automated"]' => array('checked' => TRUE),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$form['info']['base'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Base theme'),
|
||||
'#description' => t('The base theme for this theme.'),
|
||||
'#options' => $themes,
|
||||
'#default_value' => $base,
|
||||
'#ajax' => array(
|
||||
'callback' => '_omega_tools_starterkit_options_callback',
|
||||
'wrapper' => 'starterkit-options-wrapper',
|
||||
'method' => 'replace',
|
||||
'effect' => 'fade',
|
||||
),
|
||||
);
|
||||
|
||||
$form['info']['starterkit_wrapper'] = array(
|
||||
'#prefix' => '<div id="starterkit-options-wrapper">',
|
||||
'#suffix' => '</div>',
|
||||
);
|
||||
|
||||
$form['info']['starterkit_wrapper']['starterkit'] = array(
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Starterkit'),
|
||||
'#options' => array('_none' => t('Proceed without using a starterkit') . '<div class="description">' . t('This is not recommended.') . '</div>') + $starterkits,
|
||||
'#description' => t('Starterkits simplify the process of creating new subthemes by providing a set of pre-defined files and settings. Choose wisely!'),
|
||||
'#default_value' => $starter,
|
||||
'#access' => !empty($starterkits),
|
||||
);
|
||||
|
||||
$form['actions']['#type'] = 'actions';
|
||||
$form['actions']['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Save and continue'),
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function _omega_tools_starterkit_options_callback($form, $form_state) {
|
||||
return $form['info']['starterkit_wrapper'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_validate_automation($element, $form_state) {
|
||||
$path = 'sites/' . $form_state['values']['destination'] . '/themes';
|
||||
|
||||
if ($element['#value'] == TRUE && !file_prepare_directory($path, NULL)) {
|
||||
form_error($element, t('The destination that you selected is not writable. Please choose a different destination, or select the manual installation method.'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_add_submit($form, &$form_state) {
|
||||
$values = $form_state['values'];
|
||||
|
||||
$subtheme = new stdClass;
|
||||
$subtheme->new = TRUE;
|
||||
$subtheme->name = $values['name'];
|
||||
$subtheme->machine_name = $values['machine_name'];
|
||||
$subtheme->starterkit = isset($values['starterkit']) && $values['starterkit'] != '_none' ? $values['starterkit'] : NULL;
|
||||
$subtheme->base = $values['base'];
|
||||
$subtheme->status = FALSE;
|
||||
$subtheme->default = FALSE;
|
||||
$subtheme->automated = $values['automated'];
|
||||
$subtheme->destination = $values['automated'] ? 'sites/' . $values['destination'] . '/themes/' . $subtheme->machine_name : NULL;
|
||||
$subtheme->path = 'temporary://omega-tools/' . $subtheme->machine_name . '-' . substr(hash('sha256', serialize($subtheme) . microtime()), 0, 8);
|
||||
|
||||
if (omega_tools_subtheme_create($subtheme)) {
|
||||
omega_tools_cache_set($subtheme->machine_name, $subtheme);
|
||||
|
||||
$form_state['redirect'] = 'admin/appearance/omega-tools/edit/' . $subtheme->machine_name;
|
||||
}
|
||||
}
|
115
sites/all/modules/omega_tools/includes/omega_tools.drush.inc
Normal file
115
sites/all/modules/omega_tools/includes/omega_tools.drush.inc
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Implements hook_drush_command().
|
||||
*/
|
||||
function omega_tools_drush_command() {
|
||||
$items = array();
|
||||
|
||||
$items['omega-subtheme'] = array(
|
||||
'description' => 'Create a Omega subtheme.',
|
||||
'arguments' => array(
|
||||
'name' => 'The name of your subtheme.',
|
||||
),
|
||||
'options' => array(
|
||||
'destination' => 'The destination of your subtheme. Defaults to "all" (sites/all/themes).',
|
||||
'machine_name' => 'The machine-readable name of your subtheme. This will be auto-generated from the human-readable name if ommited.',
|
||||
'base' => 'The base theme that you want to build on. Defaults to "Omega" or the base theme of the starterkit (if provided).',
|
||||
'starterkit' => 'The starterkit that your subtheme should use. It must have the same base theme as your subtheme. Defaults to "starterkit_omega_html5" if "--base" is not set either.',
|
||||
'enable' => 'Automatically enable the subtheme after creation.',
|
||||
'set-default' => 'Automatically enable the subtheme after creation and make it the default theme.',
|
||||
),
|
||||
'examples' => array(
|
||||
'drush omega-subtheme "My Theme"' => 'Creates a Omega subtheme called "My Theme".',
|
||||
'drush omega-subtheme "My Theme" --destination=example.com' => 'Creates a Omega subtheme called "My Theme" in sites/example.com/themes.',
|
||||
'drush omega-subtheme "My Theme" --starterkit=starterkit_omega_html5' => 'Uses the HTML5 starterkit to create a Omega subtheme called "My Theme" in sites/all/themes (default).',
|
||||
'drush omega-subtheme "My Theme" --base=alpha' => 'Creates a Alpha subtheme called "My Theme" without using a starterkit.',
|
||||
),
|
||||
);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements of hook_drush_help().
|
||||
*/
|
||||
function omega_tools_drush_help($section) {
|
||||
switch ($section) {
|
||||
case 'drush:omega-subtheme':
|
||||
return dt('This command will create a Omega subtheme.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements of drush_hook_COMMAND_validate().
|
||||
*/
|
||||
function drush_omega_tools_omega_subtheme_validate($name) {
|
||||
system_rebuild_theme_data();
|
||||
|
||||
$themes = list_themes();
|
||||
$destination = drush_get_option('destination', 'all');
|
||||
$machine_name = drush_get_option('machine_name', _omega_tools_transform_theme_name($name));
|
||||
$base = drush_get_option('base');
|
||||
$starterkit = drush_get_option('starterkit');
|
||||
|
||||
drush_set_option('machine_name', $machine_name);
|
||||
|
||||
if (!_omega_tools_theme_exists('alpha') || !_omega_tools_theme_exists('omega')) {
|
||||
return drush_set_error('OMEGA_TOOLS_THEME_ERROR', dt('Where is the Omega base theme? I has not found it. :('));
|
||||
}
|
||||
|
||||
if (!$machine_name || !preg_match('/^[a-z][a-z0-9_]*$/', $machine_name)) {
|
||||
return drush_set_error('OMEGA_TOOLS_THEME_ERROR', dt('The machine name is invalid or could not be generated properly. It may only contain lowercase numbers, letters and underscores and must start with a letter. Please provide a proper machine name by using "--machine_name".'));
|
||||
}
|
||||
|
||||
if (_omega_tools_theme_exists($machine_name)) {
|
||||
return drush_set_error('OMEGA_TOOLS_THEME_ERROR', dt('A theme with that name already exists. The machine-readable name must be unique.'));
|
||||
}
|
||||
|
||||
if (!in_array($destination, omega_tools_sites())) {
|
||||
return drush_set_error('OMEGA_TOOLS_THEME_ERROR', dt('The destination is invalid.'));
|
||||
}
|
||||
|
||||
if ($starterkit && (!_omega_tools_theme_exists($starterkit) || !_omega_tools_is_starterkit($starterkit))) {
|
||||
return drush_set_error('OMEGA_TOOLS_THEME_ERROR', dt('There is no valid starterkit with the name !starterkit.', array('!starterkit' => $starterkit)));
|
||||
}
|
||||
|
||||
if (!$base && $starterkit) {
|
||||
$base = $themes[$starterkit]->info['base theme'];
|
||||
drush_set_option('base', $base);
|
||||
}
|
||||
|
||||
if ($base && !array_key_exists($base, omega_tools_base_themes())) {
|
||||
return drush_set_error('OMEGA_TOOLS_THEME_ERROR', dt('There is no base theme with the name !base.', array('!base' => $base)));
|
||||
}
|
||||
|
||||
if ($starterkit && $themes[$starterkit]->info['base theme'] != $base) {
|
||||
return drush_set_error('OMEGA_TOOLS_THEME_ERROR', dt('The base theme of the selected starterkit does not match the selected base theme.'));
|
||||
}
|
||||
|
||||
if (!$base && !$starterkit) {
|
||||
drush_set_option('base', 'omega');
|
||||
drush_set_option('starterkit', 'starterkit_omega_html5');
|
||||
}
|
||||
else if (!$base) {
|
||||
drush_set_option('base', 'omega');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements of drush_hook_COMMAND().
|
||||
*/
|
||||
function drush_omega_tools_omega_subtheme($name) {
|
||||
$subtheme = new stdClass();
|
||||
$subtheme->new = TRUE;
|
||||
$subtheme->name = $name;
|
||||
$subtheme->machine_name = drush_get_option('machine_name');
|
||||
$subtheme->starterkit = drush_get_option('starterkit');
|
||||
$subtheme->path = 'sites/' . drush_get_option('destination', 'all') . '/themes/' . $subtheme->machine_name;
|
||||
$subtheme->base = drush_get_option('base');
|
||||
$subtheme->default = drush_get_option('set-default') !== NULL;
|
||||
$subtheme->status = $subtheme->default || drush_get_option('enable') !== NULL;
|
||||
|
||||
omega_tools_subtheme_create($subtheme);
|
||||
omega_tools_subtheme_process($subtheme);
|
||||
}
|
271
sites/all/modules/omega_tools/includes/omega_tools.wizard.inc
Normal file
271
sites/all/modules/omega_tools/includes/omega_tools.wizard.inc
Normal file
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_wizard($subtheme, $step = NULL) {
|
||||
ctools_include('wizard');
|
||||
|
||||
$info = array(
|
||||
'id' => 'omega_tools_subtheme_wizard',
|
||||
'path' => 'admin/appearance/omega-tools/edit/' . $subtheme->machine_name . '/%step',
|
||||
'free trail' => TRUE,
|
||||
'show trail' => TRUE,
|
||||
'show back' => TRUE,
|
||||
'show cancel' => TRUE,
|
||||
'show return' => FALSE,
|
||||
'next text' => t('Continue'),
|
||||
'next callback' => 'omega_tools_subtheme_wizard_next',
|
||||
'finish callback' => 'omega_tools_subtheme_wizard_finish',
|
||||
'cancel callback' => 'omega_tools_subtheme_wizard_cancel',
|
||||
'finish text' => t('Finish'),
|
||||
'order' => array(
|
||||
'info' => t('Step 1: Theme information'),
|
||||
'finalize' => t('Step 2: Finalize'),
|
||||
),
|
||||
'forms' => array(
|
||||
'info' => array(
|
||||
'form id' => 'omega_tools_subtheme_wizard_info_form',
|
||||
),
|
||||
'finalize' => array(
|
||||
'form id' => 'omega_tools_subtheme_wizard_finalize_form',
|
||||
),
|
||||
'finished' => array(
|
||||
'form id' => 'omega_tools_subtheme_wizard_finished_form',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$form_state = array('subtheme' => $subtheme);
|
||||
|
||||
return ctools_wizard_multistep_form($info, $step, $form_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_wizard_cancel(&$form_state) {
|
||||
$subtheme = &$form_state['subtheme'];
|
||||
|
||||
$form_state['redirect'] = 'admin/appearance';
|
||||
|
||||
omega_tools_cache_clear($subtheme->machine_name);
|
||||
file_unmanaged_delete_recursive($subtheme->path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_wizard_next(&$form_state) {
|
||||
omega_tools_cache_set($form_state['subtheme']->machine_name, $form_state['subtheme']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_wizard_finish(&$form_state) {
|
||||
$subtheme = &$form_state['subtheme'];
|
||||
|
||||
if ($subtheme->automated) {
|
||||
omega_tools_write_info_file($subtheme->machine_name, $subtheme->info, $subtheme->path);
|
||||
|
||||
omega_tools_cache_clear($subtheme->machine_name);
|
||||
file_unmanaged_delete_recursive($subtheme->destination);
|
||||
omega_tools_move($subtheme->path, $subtheme->destination);
|
||||
|
||||
if ((!$subtheme->status || !$subtheme->default) && variable_get('theme_default') == $subtheme->machine_name) {
|
||||
$subtheme->default = FALSE;
|
||||
|
||||
theme_enable(array('bartik'));
|
||||
variable_set('theme_default', 'bartik');
|
||||
drupal_set_message(t('%name is now the default theme.', array('%name' => 'Bartik')));
|
||||
}
|
||||
|
||||
omega_tools_subtheme_process($subtheme);
|
||||
}
|
||||
|
||||
$form_state['redirect'] = $subtheme->automated ? 'admin/appearance' : 'admin/appearance/omega-tools/edit/' . $subtheme->machine_name . '/finished';
|
||||
|
||||
drupal_set_message(t('The configuration options have been saved.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_wizard_info_form($form, &$form_state) {
|
||||
$subtheme = &$form_state['subtheme'];
|
||||
|
||||
$form['info'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Theme information'),
|
||||
);
|
||||
|
||||
$form['info']['name'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Name'),
|
||||
'#description' => t('The human-readable name for this theme.'),
|
||||
'#default_value' => isset($subtheme->info['name']) ? $subtheme->info['name'] : '',
|
||||
'#size' => 30,
|
||||
'#required' => TRUE,
|
||||
);
|
||||
|
||||
$form['info']['description'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('Description'),
|
||||
'#description' => t('The description that will be shown on the theme listing page.'),
|
||||
'#default_value' => isset($subtheme->info['description']) ? $subtheme->info['description'] : '',
|
||||
);
|
||||
|
||||
$form['info']['version'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Version'),
|
||||
'#description' => t('The version of this theme.'),
|
||||
'#default_value' => isset($subtheme->info['version']) ? $subtheme->info['version'] : '1.x',
|
||||
);
|
||||
|
||||
$form['buttons']['next']['#next'] = $form_state['next'];
|
||||
|
||||
return $form;
|
||||
}
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_wizard_info_form_submit($form, &$form_state) {
|
||||
$values = &$form_state['values'];
|
||||
|
||||
$subtheme = &$form_state['subtheme'];
|
||||
$subtheme->info['name'] = $values['name'];
|
||||
$subtheme->info['description'] = $values['description'];
|
||||
$subtheme->info['version'] = $values['version'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_wizard_finalize_form($form, &$form_state) {
|
||||
$subtheme = &$form_state['subtheme'];
|
||||
|
||||
$form['finalize'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Finalize'),
|
||||
);
|
||||
|
||||
$form['finalize']['description'] = array(
|
||||
'#type' => 'item',
|
||||
'#markup' => t('This is the final step for configuring your subtheme. You are now able to alter the final result by changing the <em>Advanced configuration</em>.'),
|
||||
);
|
||||
|
||||
$form['finalize']['enable'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Enabled'),
|
||||
'#description' => t('Decide wether or not this theme should be enabled.'),
|
||||
'#default_value' => $subtheme->status,
|
||||
'#access' => $subtheme->automated,
|
||||
);
|
||||
|
||||
$form['finalize']['default'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Default theme'),
|
||||
'#description' => t('Decide wether or not you want this theme to be your default theme.'),
|
||||
'#default_value' => $subtheme->default,
|
||||
'#access' => $subtheme->automated,
|
||||
'#states' => array(
|
||||
'visible' => array(
|
||||
':input[name="enable"]' => array('checked' => TRUE),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$form['finalize']['advanced'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Advanced configuration'),
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
);
|
||||
|
||||
$form['finalize']['advanced']['manipulate'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Manipulate the content of %file', array('%file' => $subtheme->machine_name . '.info')),
|
||||
'#description' => t('After enabling this option you are able to edit the textarea below.'),
|
||||
'#default_value' => FALSE,
|
||||
);
|
||||
|
||||
$form['finalize']['advanced']['info'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('Content of %file', array('%file' => $subtheme->machine_name . '.info')),
|
||||
'#description' => t('Only change the content of this textarea if you know what you are doing.'),
|
||||
'#default_value' => omega_tools_build_info_file($subtheme->info),
|
||||
'#rows' => 20,
|
||||
'#states' => array(
|
||||
'enabled' => array(
|
||||
':input[name="manipulate"]' => array('checked' => TRUE),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
unset($form['buttons']['next']);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_wizard_finalize_form_submit($form, &$form_state) {
|
||||
$values = $form_state['values'];
|
||||
$subtheme = &$form_state['subtheme'];
|
||||
|
||||
$subtheme->info = $values['manipulate'] ? drupal_parse_info_format($values['info']) : $subtheme->info;
|
||||
$subtheme->status = $values['enable'];
|
||||
$subtheme->default = $values['enable'] && $values['default'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_wizard_finished_form($form, &$form_state) {
|
||||
$subtheme = &$form_state['subtheme'];
|
||||
|
||||
drupal_set_title(t('Your subtheme is ready for download'));
|
||||
|
||||
unset($form['ctools_trail'], $form['buttons']['previous'], $form['buttons']['return']);
|
||||
|
||||
$form['buttons']['cancel']['#value'] = t('Finish');
|
||||
$form['buttons']['next']['#value'] = t('Download');
|
||||
|
||||
$form['message']['#markup'] = t('Please press <strong>Download</strong> to save the theme to your local hard disk. After the download has completed you can either <strong>upload the contained folder manually</strong> or install it by using the <strong>Drupal Update Manager</strong>.');
|
||||
|
||||
$form['details'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Details'),
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
);
|
||||
|
||||
$form['details']['info'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('Content of the .info file'),
|
||||
'#default_value' => omega_tools_build_info_file($subtheme->info),
|
||||
'#disabled' => TRUE,
|
||||
'#rows' => 10,
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_wizard_finished_form_submit($form, &$form_state) {
|
||||
$subtheme = &$form_state['subtheme'];
|
||||
$temporary = 'temporary://omega-tools/' . $subtheme->name;
|
||||
|
||||
file_unmanaged_delete_recursive($temporary);
|
||||
omega_tools_copy_recursive($subtheme->path, $temporary);
|
||||
|
||||
if ($download = omega_tools_write_archive($temporary, $subtheme->name)) {
|
||||
file_transfer($download, omega_tools_file_download($download));
|
||||
}
|
||||
|
||||
file_unmanaged_delete_recursive($temporary);
|
||||
}
|
17
sites/all/modules/omega_tools/omega_tools.info
Normal file
17
sites/all/modules/omega_tools/omega_tools.info
Normal file
@@ -0,0 +1,17 @@
|
||||
name = Omega Tools
|
||||
description = Provides additional functionality for the <a href="http://drupal.org/project/omega">Omega Theme</a>.
|
||||
package = Theme Tools
|
||||
core = 7.x
|
||||
|
||||
dependencies[] = ctools
|
||||
|
||||
files[] = omega_tools.module
|
||||
files[] = includes/omega_tools.admin.inc
|
||||
files[] = includes/omega_tools.drush.inc
|
||||
files[] = includes/omega_tools.wizard.inc
|
||||
; Information added by drupal.org packaging script on 2012-02-17
|
||||
version = "7.x-3.0-rc4"
|
||||
core = "7.x"
|
||||
project = "omega_tools"
|
||||
datestamp = "1329502543"
|
||||
|
646
sites/all/modules/omega_tools/omega_tools.module
Normal file
646
sites/all/modules/omega_tools/omega_tools.module
Normal file
@@ -0,0 +1,646 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function omega_tools_menu() {
|
||||
foreach (list_themes() as $theme) {
|
||||
$items['admin/appearance/settings/' . $theme->name . '/reset'] = array(
|
||||
'title' => $theme->info['name'],
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('omega_tools_theme_reset_confirm', $theme->name),
|
||||
'type' => MENU_CALLBACK,
|
||||
'access callback' => '_system_themes_access',
|
||||
'access arguments' => array($theme),
|
||||
'file' => 'includes/omega_tools.admin.inc',
|
||||
);
|
||||
|
||||
$items['admin/appearance/omega-tools/download/' . $theme->name] = array(
|
||||
'title' => $theme->info['name'],
|
||||
'page callback' => 'omega_tools_theme_download',
|
||||
'page arguments' => array($theme->name),
|
||||
'type' => MENU_CALLBACK,
|
||||
'access callback' => 'user_access',
|
||||
'access arguments' => array('administer themes'),
|
||||
'file' => 'includes/omega_tools.admin.inc',
|
||||
);
|
||||
|
||||
$items['admin/appearance/settings/' . $theme->name . '/export'] = array(
|
||||
'title' => $theme->info['name'],
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('omega_tools_theme_export', $theme->name),
|
||||
'type' => MENU_CALLBACK,
|
||||
'access callback' => '_system_themes_access',
|
||||
'access arguments' => array($theme),
|
||||
'file' => 'includes/omega_tools.admin.inc',
|
||||
);
|
||||
}
|
||||
|
||||
$items['admin/appearance/omega-tools/add'] = array(
|
||||
'title' => 'Create new Omega subtheme',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('omega_tools_subtheme_add'),
|
||||
'type' => MENU_LOCAL_ACTION,
|
||||
'access arguments' => array('administer themes'),
|
||||
'file' => 'includes/omega_tools.admin.inc',
|
||||
'weight' => 100,
|
||||
);
|
||||
|
||||
$items['admin/appearance/omega-tools/edit/%omega_tools_cache'] = array(
|
||||
'title' => 'Configure subtheme',
|
||||
'page callback' => 'omega_tools_subtheme_wizard',
|
||||
'page arguments' => array(4),
|
||||
'type' => MENU_CALLBACK,
|
||||
'access callback' => '_omega_tools_theme_access',
|
||||
'access arguments' => array(4),
|
||||
'file' => 'includes/omega_tools.wizard.inc',
|
||||
);
|
||||
|
||||
$items['admin/appearance/omega-tools/edit/%omega_tools_cache/%'] = $items['admin/appearance/omega-tools/edit/%omega_tools_cache'];
|
||||
$items['admin/appearance/omega-tools/edit/%omega_tools_cache/%']['page arguments'] = array(4, 5);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_file_download().
|
||||
*/
|
||||
function omega_tools_file_download($uri) {
|
||||
if (strpos(file_uri_target($uri), 'omega-tools/') === 0) {
|
||||
return array(
|
||||
'Content-Type' => file_get_mimetype($uri),
|
||||
'Content-Length' => filesize(drupal_realpath($uri)),
|
||||
'Content-Disposition' => 'attachment; filename="' . basename($uri) . '"',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*/
|
||||
function omega_tools_form_system_theme_settings_alter(&$form, &$form_state) {
|
||||
$form['#validate'][] = 'omega_tools_theme_settings_form_validate';
|
||||
|
||||
$form['actions']['omega_tools_reset'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Revert theme settings'),
|
||||
'#submit' => array('omega_tools_theme_settings_form_submit'),
|
||||
);
|
||||
|
||||
$form['actions']['omega_tools_export'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Export theme settings'),
|
||||
'#submit' => array('omega_tools_theme_settings_form_submit'),
|
||||
);
|
||||
|
||||
$form['actions']['omega_tools_download'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Download this theme'),
|
||||
'#submit' => array('omega_tools_theme_settings_form_submit'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_theme_settings_form_validate($form, &$form_state) {
|
||||
unset($form_state['values']['omega_tools_reset'], $form_state['values']['omega_tools_export'], $form_state['values']['omega_tools_download']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_theme_settings_form_submit($form, &$form_state) {
|
||||
$theme = $form_state['build_info']['args'][0];
|
||||
|
||||
unset($form_state['values']['omega_tools_reset'], $form_state['values']['omega_tools_export'], $form_state['values']['omega_tools_download']);
|
||||
|
||||
switch ($form_state['triggering_element']['#value']) {
|
||||
case t('Revert theme settings'):
|
||||
$form_state['redirect'] = 'admin/appearance/settings/' . $theme . '/reset';
|
||||
break;
|
||||
|
||||
case t('Export theme settings'):
|
||||
$form_state['redirect'] = 'admin/appearance/settings/' . $theme . '/export';
|
||||
break;
|
||||
|
||||
case t('Download this theme'):
|
||||
$form_state['redirect'] = 'admin/appearance/omega-tools/download/' . $theme;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_cache_load($name) {
|
||||
return omega_tools_cache_get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_cache_get($name) {
|
||||
ctools_include('object-cache');
|
||||
|
||||
$cache = ctools_object_cache_get('omega_tools', $name);
|
||||
|
||||
if (!$cache) {
|
||||
$themes = list_themes();
|
||||
|
||||
if (isset($themes[$name])) {
|
||||
$path = drupal_get_path('theme', $name);
|
||||
$info = drupal_parse_info_file($path . '/' . $name . '.info');
|
||||
|
||||
$cache = new stdClass();
|
||||
$cache->new = FALSE;
|
||||
$cache->machine_name = $name;
|
||||
$cache->automated = file_prepare_directory($path, NULL) && file_prepare_directory(dirname($path), NULL);
|
||||
$cache->destination = $path;
|
||||
$cache->name = $info['name'];
|
||||
$cache->info = $info;
|
||||
$cache->status = $themes[$name]->status;
|
||||
$cache->default = variable_get('theme_default') == $name;
|
||||
$cache->locked = ctools_object_cache_test('omega_tools', $name);
|
||||
$cache->path = 'temporary://omega-tools/' . $name . '-' . substr(hash('sha256', serialize($cache) . microtime()), 0, 8);
|
||||
|
||||
file_unmanaged_delete_recursive($cache->path);
|
||||
omega_tools_copy_recursive($cache->destination, $cache->path);
|
||||
}
|
||||
}
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store changes to a task handler in the object cache.
|
||||
*/
|
||||
function omega_tools_cache_set($name, $subtheme) {
|
||||
ctools_include('object-cache');
|
||||
ctools_object_cache_set('omega_tools', $name, $subtheme);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an item from the object cache.
|
||||
*/
|
||||
function omega_tools_cache_clear($name) {
|
||||
ctools_include('object-cache');
|
||||
ctools_object_cache_clear('omega_tools', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_system_themes_page_alter(&$info) {
|
||||
foreach (array('enabled', 'disabled') as $status) {
|
||||
if (isset($info[$status])) {
|
||||
foreach ($info[$status] as &$item) {
|
||||
if (_omega_tools_is_editable($item->name)) {
|
||||
$item->operations[] = array(
|
||||
'title' => t('Edit'),
|
||||
'href' => 'admin/appearance/omega-tools/edit/' . $item->name,
|
||||
'attributes' => array('title' => t('This theme belongs to the Omega framework and can be edited.')),
|
||||
);
|
||||
}
|
||||
|
||||
$item->operations[] = array(
|
||||
'title' => t('Download'),
|
||||
'href' => 'admin/appearance/omega-tools/download/' . $item->name,
|
||||
'attributes' => array('title' => t('Download an archive of this theme.')),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_base_themes() {
|
||||
$themes = list_themes();
|
||||
$options = array();
|
||||
|
||||
foreach (array('alpha', 'omega') as $theme) {
|
||||
if (isset($themes[$theme])) {
|
||||
$options[$theme] = $themes[$theme]->info['name'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($themes as $theme) {
|
||||
if (isset($theme->info['base theme']) && empty($theme->info['starterkit'])) {
|
||||
$base = system_find_base_themes($themes, $theme->name);
|
||||
|
||||
if (isset($base['alpha'])) {
|
||||
$options[$theme->name] = $theme->info['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_starterkits($base = NULL) {
|
||||
$bases = omega_tools_base_themes();
|
||||
|
||||
$options = array();
|
||||
foreach (list_themes() as $name => $theme) {
|
||||
$info = $theme->info;
|
||||
|
||||
if (!empty($info['starterkit']) && isset($info['base theme']) && array_key_exists($info['base theme'], $bases) && ($info['base theme'] == $base || !isset($base))) {
|
||||
$options[$name] = $info['name'] . '<div class="description">' . $info['description'] . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_copy_recursive($source, $destination) {
|
||||
if (is_dir($source)) {
|
||||
if (!file_prepare_directory($destination, FILE_CREATE_DIRECTORY)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$directory = dir($source);
|
||||
|
||||
while (FALSE !== ($read = $directory->read())) {
|
||||
if ($read != '.' && $read != '..' ) {
|
||||
if (!omega_tools_copy_recursive($source . '/' . $read, $destination . '/' . $read)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$directory->close();
|
||||
}
|
||||
else {
|
||||
file_unmanaged_copy($source, $destination);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_move($source, $destination) {
|
||||
if (omega_tools_copy_recursive($source, $destination)) {
|
||||
file_unmanaged_delete_recursive($source);
|
||||
|
||||
return $destination;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_rewrite_recursive($path, $search, $replace, $rename) {
|
||||
if ($path !== ($new = str_replace($search, $rename, $path))) {
|
||||
if (!$path = file_unmanaged_move($path, $new, FILE_EXISTS_REPLACE)) {
|
||||
return FALSE;
|
||||
};
|
||||
}
|
||||
|
||||
if (is_dir($path)) {
|
||||
$directory = dir($path);
|
||||
|
||||
while (FALSE !== ($read = $directory->read())) {
|
||||
if ($read != '.' && $read != '..' ) {
|
||||
if (!omega_tools_rewrite_recursive($path . '/' . $read, $search, $replace, $rename)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$directory->close();
|
||||
}
|
||||
else {
|
||||
omega_tools_replace_contents($path, $search, $replace);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_replace_contents($file, $search, $replace) {
|
||||
if (is_file($file) && filesize($file) > 0) {
|
||||
$before = file_get_contents($file);
|
||||
|
||||
if ($before != ($after = str_replace($search, $replace, $before))) {
|
||||
file_unmanaged_save_data($after, $file, FILE_EXISTS_REPLACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_build_info_file($array, $prefix = FALSE) {
|
||||
$info = '';
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$info .= omega_tools_build_info_file($value, (!$prefix ? $key : "{$prefix}[{$key}]"));
|
||||
}
|
||||
else {
|
||||
$info .= $prefix ? ("{$prefix}[" . $key .']') : $key;
|
||||
$info .= " = '" . str_replace("'", "\'", $value) . "'\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_write_info_file($name, $info, $destination = NULL) {
|
||||
$destination = isset($destination) ? $destination : drupal_get_path('theme', $name);
|
||||
|
||||
if (!empty($destination)) {
|
||||
return file_unmanaged_save_data(omega_tools_build_info_file($info), $destination . '/' . $name . '.info', FILE_EXISTS_REPLACE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_create(&$subtheme) {
|
||||
if (is_dir($subtheme->path)) {
|
||||
file_unmanaged_delete_recursive($subtheme->path);
|
||||
}
|
||||
|
||||
if (!file_prepare_directory($subtheme->path, FILE_CREATE_DIRECTORY)) {
|
||||
drupal_set_message(t('Omega Tools could not create the directory %dir.', array('%dir' => $subtheme->path)), 'error');
|
||||
watchdog('Omega Tools', t('Omega Tools could not create the directory %dir.', array('%dir' => $subtheme->path)), array(), WATCHDOG_ERROR);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ($subtheme->starterkit) {
|
||||
if (!omega_tools_copy_recursive(drupal_get_path('theme', $subtheme->starterkit), $subtheme->path)) {
|
||||
$themes = list_themes();
|
||||
|
||||
drupal_set_message(t('Omega Tools could not copy the starterkit %starterkit.', array('%starterkit' => $themes[$subtheme->starterkit]->info['name'])), 'error');
|
||||
watchdog('Omega Tools', t('Omega Tools could not copy the starterkit %starterkit.', array('%starterkit' => $themes[$subtheme->starterkit]->info['name'])), array(), WATCHDOG_ERROR);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$subtheme->info = drupal_parse_info_file($subtheme->path . '/' . $subtheme->starterkit . '.info');
|
||||
|
||||
file_unmanaged_delete($subtheme->path . '/' . $subtheme->starterkit . '.info');
|
||||
}
|
||||
else {
|
||||
if (!omega_tools_copy_recursive(drupal_get_path('module', 'omega_tools') . '/default', $subtheme->path)) {
|
||||
drupal_set_message(t('Omega Tools could not copy the default pattern.'), 'error');
|
||||
watchdog('Omega Tools', t('Omega Tools could not copy the default pattern.'), array(), WATCHDOG_ERROR);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$base = drupal_parse_info_file(drupal_get_path('theme', $subtheme->base) . '/' . $subtheme->base . '.info');
|
||||
$subtheme->info = drupal_parse_info_file($subtheme->path . '/default.pattern');
|
||||
$subtheme->info['regions'] = isset($base['regions']) ? $base['regions'] : array();
|
||||
$subtheme->info['zones'] = isset($base['zones']) ? $base['zones'] : array();
|
||||
$subtheme->info['settings'] = isset($base['settings']) ? $base['settings'] : array();
|
||||
|
||||
file_unmanaged_delete($subtheme->path . '/default.pattern');
|
||||
}
|
||||
|
||||
unset($subtheme->info['starterkit'], $subtheme->info['hidden'], $subtheme->info['locked'], $subtheme->info['project'], $subtheme->info['datestamp']);
|
||||
|
||||
$subtheme->info['name'] = $subtheme->name;
|
||||
$subtheme->info['description'] = '';
|
||||
$subtheme->info['base theme'] = $subtheme->base;
|
||||
$subtheme->info['engine'] = 'phptemplate';
|
||||
$subtheme->info['core'] = DRUPAL_CORE_COMPATIBILITY;
|
||||
$subtheme->info['version'] = '1.x';
|
||||
$subtheme->info['screenshot'] = 'screenshot.png';
|
||||
$subtheme->info['regions'] = array_merge(_omega_tools_core_regions(), $subtheme->info['regions']);
|
||||
$subtheme->info['zones'] = array_merge(_omega_tools_default_zones(), $subtheme->info['zones']);
|
||||
|
||||
omega_tools_write_info_file($subtheme->machine_name, $subtheme->info, $subtheme->path);
|
||||
omega_tools_rewrite_recursive($subtheme->path, 'YOURTHEME', $subtheme->machine_name, str_replace('_', '-', $subtheme->machine_name));
|
||||
|
||||
drupal_set_message(t('You have successfully created the theme %name.', array('%name' => $subtheme->name)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_subtheme_process($subtheme) {
|
||||
drupal_theme_rebuild();
|
||||
system_rebuild_theme_data();
|
||||
|
||||
if ($subtheme->status) {
|
||||
theme_enable(array($subtheme->machine_name));
|
||||
|
||||
if ($subtheme->default) {
|
||||
variable_set('theme_default', $subtheme->machine_name);
|
||||
drupal_set_message(t('%name is now the default theme.', array('%name' => $subtheme->name)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
theme_disable(array($subtheme->machine_name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_sites() {
|
||||
$sites = &drupal_static(__FUNCTION__);
|
||||
|
||||
if (!isset($sites)) {
|
||||
$sites = array();
|
||||
|
||||
if (file_exists(DRUPAL_ROOT . '/sites/sites.php')) {
|
||||
include(DRUPAL_ROOT . '/sites/sites.php');
|
||||
}
|
||||
|
||||
$sites = array('all') + array_values($sites);
|
||||
}
|
||||
|
||||
return $sites;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_sites_options() {
|
||||
$options = array();
|
||||
|
||||
if ($sites = omega_tools_sites()) {
|
||||
$options += array_combine($sites, $sites);
|
||||
}
|
||||
|
||||
$options['all'] = t('Default destination (all)');
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_write_archive($source, $name, $destination = NULL) {
|
||||
$destination = isset($destination) ? $destination : 'temporary://omega-tools';
|
||||
|
||||
if (!file_prepare_directory($destination, FILE_CREATE_DIRECTORY)) {
|
||||
drupal_set_message(t('Omega Tools could not create the directory %dir', array('%dir' => $destination)), 'error');
|
||||
watchdog('Omega Tools', t('Omega Tools could not create the directory %dir', array('%dir' => $destination)), array(), WATCHDOG_ERROR);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$destination = $destination . '/' . $name . '.tar';
|
||||
$current = getcwd();
|
||||
|
||||
chdir(drupal_realpath(dirname($source)));
|
||||
|
||||
$archiver = new Archive_Tar(drupal_realpath($destination));
|
||||
$archiver->create(basename(rtrim($source, '/')));
|
||||
|
||||
chdir($current);
|
||||
|
||||
return $destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function omega_tools_revert_theme_settings($theme) {
|
||||
$themes = list_themes();
|
||||
|
||||
variable_del('theme_' . $theme . '_settings');
|
||||
|
||||
drupal_theme_rebuild();
|
||||
system_rebuild_theme_data();
|
||||
|
||||
watchdog('theme', t('Theme settings for %theme reset to default values.', array('%theme' => $themes[$theme]->info['name'])));
|
||||
drupal_set_message(t('The theme settings for %theme have been purged from the database and are now being loaded from the .info file of this theme.', array('%theme' => $themes[$theme]->info['name'])));
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function _omega_tools_core_regions() {
|
||||
return array(
|
||||
'page_top' => 'Page Top',
|
||||
'page_bottom' => 'Page Bottom',
|
||||
'content' => 'Content',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function _omega_tools_default_zones() {
|
||||
return array(
|
||||
'header' => 'Header',
|
||||
'content' => 'Content',
|
||||
'footer' => 'Footer',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function _omega_tools_theme_exists($theme) {
|
||||
$themes = list_themes();
|
||||
|
||||
return isset($themes[$theme]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function _omega_tools_validate_theme_name($element, &$form_state) {
|
||||
system_rebuild_theme_data();
|
||||
|
||||
if (!preg_match('/^[a-z][a-z0-9_]*$/', $element['#value'])) {
|
||||
form_error($element, t('The theme name is invalid. It may only contain lowercase numbers, letters and underscores and must start with a letter.'));
|
||||
}
|
||||
else if (_omega_tools_theme_exists($element['#value'])) {
|
||||
form_error($element, t('A theme with that name already exists. The machine-readable name must be unique.'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function _omega_tools_validate_theme_settings($element, &$form_state) {
|
||||
$settings = drupal_parse_info_format($element['#value']);
|
||||
|
||||
foreach ($settings as $key => $value) {
|
||||
if ($key !== 'settings') {
|
||||
form_error($element, t('You may only submit theme settings with this form.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function _omega_tools_transform_theme_name($name) {
|
||||
$name = preg_replace('/^[^a-z]+/', '', strtolower($name));
|
||||
$name = preg_replace('/[^a-z0-9_]+/', '_', $name);
|
||||
$name = str_replace('__', '_', $name);
|
||||
$name = trim($name, '_');
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function _omega_tools_theme_access($theme) {
|
||||
if ($theme && user_access('administer themes')) {
|
||||
$themes = list_themes();
|
||||
|
||||
if (!isset($themes[$theme->name]) || _omega_tools_is_editable($theme->name)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function _omega_tools_is_starterkit($theme) {
|
||||
return array_key_exists($theme, omega_tools_starterkits());
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
function _omega_tools_is_editable($theme) {
|
||||
$themes = list_themes();
|
||||
|
||||
if (!in_array($theme, array('omega', 'alpha')) && strpos(drupal_get_path('theme', $theme), 'themes') !== 0) {
|
||||
if (isset($themes[$theme]->info['base theme'])) {
|
||||
$base = system_find_base_themes($themes, $theme);
|
||||
|
||||
if (!empty($base) && isset($base['alpha']) && empty($themes[$theme]->info['locked'])) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
Reference in New Issue
Block a user