Browse Source

Initial commit

Yay! HTMLy was born today.
pull/2/head
Danang Probo Sayekti 12 years ago
commit
643b3be88d
69 changed files with 7950 additions and 0 deletions
  1. +108
    -0
      .htaccess
  2. +1
    -0
      changelog.txt
  3. +6
    -0
      composer.json
  4. +120
    -0
      composer.lock
  5. BIN
      composer.phar
  6. +1
    -0
      content/.htaccess
  7. +3
    -0
      content/blog/2014-01-01_general_welcome.md
  8. +3
    -0
      content/static/about.md
  9. +3
    -0
      content/static/contact.md
  10. +31
    -0
      copyright.txt
  11. BIN
      favicon.ico
  12. +4
    -0
      index.php
  13. +339
    -0
      license.txt
  14. +32
    -0
      robots.txt
  15. +1
    -0
      system/.htaccess
  16. +51
    -0
      system/config.ini
  17. +276
    -0
      system/htmly.php
  18. +499
    -0
      system/includes/dispatch.php
  19. +644
    -0
      system/includes/functions.php
  20. +30
    -0
      themes/default/404-search.html.php
  21. +23
    -0
      themes/default/404.html.php
  22. +625
    -0
      themes/default/css/style.css
  23. BIN
      themes/default/img/facebook.png
  24. BIN
      themes/default/img/googleplus.png
  25. BIN
      themes/default/img/rss.png
  26. BIN
      themes/default/img/tumblr.png
  27. BIN
      themes/default/img/twitter.png
  28. +44
    -0
      themes/default/layout.html.php
  29. +41
    -0
      themes/default/main.html.php
  30. +38
    -0
      themes/default/post.html.php
  31. +1
    -0
      themes/readme.txt
  32. +7
    -0
      vendor/autoload.php
  33. +240
    -0
      vendor/composer/ClassLoader.php
  34. +9
    -0
      vendor/composer/autoload_classmap.php
  35. +11
    -0
      vendor/composer/autoload_namespaces.php
  36. +43
    -0
      vendor/composer/autoload_real.php
  37. +105
    -0
      vendor/composer/installed.json
  38. +2
    -0
      vendor/dflydev/markdown/.gitignore
  39. +7
    -0
      vendor/dflydev/markdown/.travis.yml
  40. +40
    -0
      vendor/dflydev/markdown/LICENSE
  41. +98
    -0
      vendor/dflydev/markdown/README.md
  42. +34
    -0
      vendor/dflydev/markdown/composer.json
  43. +28
    -0
      vendor/dflydev/markdown/phpunit.xml.dist
  44. +23
    -0
      vendor/dflydev/markdown/src/dflydev/markdown/IMarkdownParser.php
  45. +1359
    -0
      vendor/dflydev/markdown/src/dflydev/markdown/MarkdownExtraParser.php
  46. +1529
    -0
      vendor/dflydev/markdown/src/dflydev/markdown/MarkdownParser.php
  47. +12
    -0
      vendor/dflydev/markdown/tests/bootstrap.php
  48. +34
    -0
      vendor/dflydev/markdown/tests/dflydev/tests/markdown/MarkdownExtraParserTest.php
  49. +73
    -0
      vendor/dflydev/markdown/tests/dflydev/tests/markdown/MarkdownParserTest.php
  50. +3
    -0
      vendor/suin/php-rss-writer/.gitignore
  51. +11
    -0
      vendor/suin/php-rss-writer/.travis.yml
  52. +84
    -0
      vendor/suin/php-rss-writer/README.md
  53. +189
    -0
      vendor/suin/php-rss-writer/Source/Suin/RSSWriter/Channel.php
  54. +91
    -0
      vendor/suin/php-rss-writer/Source/Suin/RSSWriter/ChannelInterface.php
  55. +54
    -0
      vendor/suin/php-rss-writer/Source/Suin/RSSWriter/Feed.php
  56. +27
    -0
      vendor/suin/php-rss-writer/Source/Suin/RSSWriter/FeedInterface.php
  57. +142
    -0
      vendor/suin/php-rss-writer/Source/Suin/RSSWriter/Item.php
  58. +66
    -0
      vendor/suin/php-rss-writer/Source/Suin/RSSWriter/ItemInterface.php
  59. +16
    -0
      vendor/suin/php-rss-writer/Source/Suin/RSSWriter/SimpleXMLElement.php
  60. +10
    -0
      vendor/suin/php-rss-writer/Tests/.gitignore
  61. +8
    -0
      vendor/suin/php-rss-writer/Tests/Bootstrap.php
  62. +28
    -0
      vendor/suin/php-rss-writer/Tests/README.md
  63. +252
    -0
      vendor/suin/php-rss-writer/Tests/Suin/RSSWriter/ChannelTest.php
  64. +96
    -0
      vendor/suin/php-rss-writer/Tests/Suin/RSSWriter/FeedTest.php
  65. +186
    -0
      vendor/suin/php-rss-writer/Tests/Suin/RSSWriter/ItemTest.php
  66. +12
    -0
      vendor/suin/php-rss-writer/Tests/composer.json
  67. +42
    -0
      vendor/suin/php-rss-writer/Tests/phpunit.xml.dist
  68. +20
    -0
      vendor/suin/php-rss-writer/composer.json
  69. +35
    -0
      vendor/suin/php-rss-writer/example.php

+ 108
- 0
.htaccess View File

@ -0,0 +1,108 @@
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 year"
# Data interchange
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
# Favicon (cannot be renamed!)
ExpiresByType image/x-icon "access plus 1 week"
# HTML components (HTCs)
ExpiresByType text/x-component "access plus 1 month"
# HTML
ExpiresByType text/html "access plus 0 seconds"
# JavaScript
ExpiresByType application/javascript "access plus 1 year"
# Manifest files
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
ExpiresByType text/cache-manifest "access plus 0 seconds"
# Media
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
# Web feeds
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"
# Web fonts
ExpiresByType application/font-woff "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# Uncomment the following to redirect all visitors to the www version
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Uncomment the following to redirect all visitors to non www version
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
# Pass all requests not referring directly to files in the filesystem to index.php.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
# Enable Gzip compression.
<IfModule mod_deflate.c>
# Force compression for mangled headers.
# http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
# Compress all output labeled with one of the following MIME-types
# (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
# and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
# as `AddOutputFilterByType` is still in the core directives).
AddOutputFilterByType DEFLATE application/atom+xml \
application/javascript \
application/json \
application/rss+xml \
application/vnd.ms-fontobject \
application/x-font-ttf \
application/x-web-app-manifest+json \
application/xhtml+xml \
application/xml \
font/opentype \
image/svg+xml \
image/x-icon \
text/css \
text/html \
text/plain \
text/x-component \
text/xml
</IfModule>

+ 1
- 0
changelog.txt View File

@ -0,0 +1 @@
2014-01-01: Initial release.

+ 6
- 0
composer.json View File

@ -0,0 +1,6 @@
{
"require": {
"dflydev/markdown": "v1.0.2",
"suin/php-rss-writer": ">=1.0"
}
}

+ 120
- 0
composer.lock View File

@ -0,0 +1,120 @@
{
"hash": "cec61b54883fb666202e7af8d3393c29",
"packages": [
{
"name": "dflydev/markdown",
"version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/dflydev/dflydev-markdown.git",
"reference": "v1.0.2"
},
"dist": {
"type": "zip",
"url": "https://github.com/dflydev/dflydev-markdown/zipball/v1.0.2",
"reference": "v1.0.2",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"type": "library",
"autoload": {
"psr-0": {
"dflydev\\markdown": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"New BSD License"
],
"authors": [
{
"name": "Dragonfly Development Inc.",
"email": "info@dflydev.com",
"homepage": "http://dflydev.com"
},
{
"name": "Beau Simensen",
"email": "beau@dflydev.com",
"homepage": "http://beausimensen.com"
},
{
"name": "Michel Fortin",
"homepage": "http://michelf.com"
},
{
"name": "John Gruber",
"homepage": "http://daringfireball.net"
}
],
"description": "PHP Markdown & Extra",
"homepage": "http://github.com/dflydev/dflydev-markdown",
"keywords": [
"markdown"
],
"time": "2012-01-15 19:36:37"
},
{
"name": "suin/php-rss-writer",
"version": "1.2",
"source": {
"type": "git",
"url": "git://github.com/suin/php-rss-writer.git",
"reference": "1.2"
},
"dist": {
"type": "zip",
"url": "https://github.com/suin/php-rss-writer/zipball/1.2",
"reference": "1.2",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Suin\\RSSWriter": "Source"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "suin",
"email": "suinyeze@gmail.com",
"homepage": "https://www.facebook.com/suinyeze",
"role": "Developer, Renaming Specialist"
}
],
"description": "Yet another simple RSS writer library for PHP 5.3 or later.",
"homepage": "https://github.com/suin/php-rss-writer",
"keywords": [
"feed",
"generator",
"rss",
"writer"
],
"time": "2012-08-23 00:45:18"
}
],
"packages-dev": [
],
"aliases": [
],
"minimum-stability": "stable",
"stability-flags": [
],
"platform": [
],
"platform-dev": [
]
}

BIN
composer.phar View File


+ 1
- 0
content/.htaccess View File

@ -0,0 +1 @@
deny from all

+ 3
- 0
content/blog/2014-01-01_general_welcome.md View File

@ -0,0 +1,3 @@
# Welcome #
Welcome Example.com.

+ 3
- 0
content/static/about.md View File

@ -0,0 +1,3 @@
# About
Edit this.

+ 3
- 0
content/static/contact.md View File

@ -0,0 +1,3 @@
# Contact
Edit this.

+ 31
- 0
copyright.txt View File

@ -0,0 +1,31 @@
Copyright (c) 2014 Danang Probo Sayekti.
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 as the file LICENSE.txt; if not, please see
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
HTMLy includes works under other copyright notices and distributed
according to the terms of the GNU General Public License or a compatible
license, including:
Dispatch - Copyright (c) 2014 Jesus A. Domingo <jesus.domingo@gmail.com>
Composer - Copyright (c) 2011 Nils Adermann, Jordi Boggiano
PHP Markdown & Extra - Copyright (c) 2011 Dragonfly Development Inc.
Based on PHP Markdown & Extra - Copyright (c) 2004-2009 Michel Fortin
Based on Markdown - Copyright (c) 2003-2006 John Gruber
\Suin\RSSWriter - Copyright (c) Suin <https://github.com/suin>

BIN
favicon.ico View File

Before After
Width: 16  |  Height: 16  |  Size: 1.3 KiB

+ 4
- 0
index.php View File

@ -0,0 +1,4 @@
<?php
require 'vendor/autoload.php';
require 'system/htmly.php';

+ 339
- 0
license.txt View 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.

+ 32
- 0
robots.txt View File

@ -0,0 +1,32 @@
#
# robots.txt
#
# This file is to prevent the crawling and indexing of certain parts
# of your site by web crawlers and spiders run by sites like Yahoo!
# and Google. By telling these "robots" where not to go on your site,
# you save bandwidth and server resources.
#
# This file will be ignored unless it is at the root of your host:
# Used: http://example.com/robots.txt
# Ignored: http://example.com/site/robots.txt
#
# For more information about the robots.txt standard, see:
# http://www.robotstxt.org/wc/robots.html
#
# For syntax checking, see:
# http://www.sxw.org.uk/computing/robots/check.html
User-agent: *
Crawl-delay: 10
# Directories
Disallow: /content/
Disallow: /system/
Disallow: /themes/
Disallow: /vendor/
# Files
Disallow: /changelog.txt
Disallow: /composer.json
Disallow: /composer.lock
Disallow: /composer.phar
# Paths
Disallow: /search/

+ 1
- 0
system/.htaccess View File

@ -0,0 +1 @@
deny from all

+ 51
- 0
system/config.ini View File

@ -0,0 +1,51 @@
; The URL of your blog
site.url = ""
; Blog info
blog.title = "HTMLy"
blog.description = "Databaseless Blogging Platform."
; Author info
blog.author = "Admin"
blog.authorid = "admin"
blog.authorbio = "<p>I'm this blog admin.</p>"
blog.copyright = "(c) Your name."
; Social account
social.twitter = "https://twitter.com"
social.facebook = "https://www.facebook.com"
social.google = "https://plus.google.com"
social.tumblr = "http://www.tumblr.com"
; Menu link
blog.menu = ""
; Disqus
disqus.shortname = ""
; Google publisher
google.publisher = ""
; Pagination, RSS, and JSON
posts.perpage = "5"
tag.perpage = "10"
archive.perpage = "10"
search.perpage = "10"
rss.count = "30"
json.count = "10"
; Teaser char count
teaser.char = "200"
; Description char count
description.char = "150"
; Enable image thumbnail on teaser, the options is "true" and "false". If set to "true", you can specify the default thumbnail also.
img.thumbnail = "true"
default.thumbnail = ""
; Set the theme here
views.root = "themes/default"
; Framework config. No need to edit.
views.layout = "layout"

+ 276
- 0
system/htmly.php View File

@ -0,0 +1,276 @@
<?php
// Change this to your timezone
date_default_timezone_set('Asia/Jakarta');
// Explicitly including the dispatch framework,
// and our functions.php file
require 'system/includes/dispatch.php';
require 'system/includes/functions.php';
// Load the configuration file
config('source', 'system/config.ini');
// The front page of the blog.
// This will match the root url
get('/index', function () {
$page = from($_GET, 'page');
$page = $page ? (int)$page : 1;
$perpage = config('posts.perpage');
$posts = get_posts($page);
$total = '';
if(empty($posts) || $page < 1){
// a non-existing page
not_found();
}
render('main',array(
'page' => $page,
'posts' => $posts,
'canonical' => config('site.url'),
'description' => config('blog.description'),
'bodyclass' => 'infront',
'breadcrumb' => '',
'pagination' => has_pagination($total, $perpage, $page)
));
});
// The tag page
get('/tag/:tag',function($tag){
$page = from($_GET, 'page');
$page = $page ? (int)$page : 1;
$perpage = config('tag.perpage');
$posts = get_tag($tag);
$total = count($posts);
// Extract a specific page with results
$posts = array_slice($posts, ($page-1) * $perpage, $perpage);
if(empty($posts) || $page < 1){
// a non-existing page
not_found();
}
render('main',array(
'title' => ucfirst($tag) .' - ' . config('blog.title'),
'page' => $page,
'posts' => $posts,
'canonical' => config('site.url') . '/tag/' . $tag,
'description' => 'All posts tagged ' . ucfirst($tag) . ' on '. config('blog.title') . '.',
'bodyclass' => 'intag',
'breadcrumb' => '<a href="' . config('site.url') . '">Home</a> &#187; Posts tagged ' . ucfirst($tag),
'pagination' => has_pagination($total, $perpage, $page)
));
});
// The archive page
get('/archive/:req',function($req){
$page = from($_GET, 'page');
$page = $page ? (int)$page : 1;
$perpage = config('archive.perpage');
$posts = get_archive($req);
$total = count($posts);
// Extract a specific page with results
$posts = array_slice($posts, ($page-1) * $perpage, $perpage);
if(empty($posts) || $page < 1){
// a non-existing page
not_found();
}
$time = explode('-', $req);
if (isset($time[0]))
{
$y = 'Y';
}
else {
$y = '';
}
if (isset($time[1]))
{
$m = 'F ';
}
else {
$m = '';
}
if (isset($time[2]))
{
$d = 'd ';
}
else {
$d = '';
}
$date = strtotime($req);
if(!$date){
// a non-existing page
not_found();
}
render('main',array(
'title' => 'Archive - ' . date($d . $m . $y, $date) .' - ' . config('blog.title'),
'page' => $page,
'posts' => $posts,
'canonical' => config('site.url') . '/archive/' . $req,
'description' => 'Archive page for ' . date($d . $m . $y, $date) . ' on ' . config('blog.title') . '.',
'bodyclass' => 'inarchive',
'breadcrumb' => '<a href="' . config('site.url') . '">Home</a> &#187; Archive for ' . date($d . $m . $y, $date),
'pagination' => has_pagination($total, $perpage, $page)
));
});
// The blog post page
get('/:year/:month/:name', function($year, $month, $name){
$post = find_post($year, $month, $name);
$current = $post['current'];
if(!$current){
not_found();
}
if (array_key_exists('prev', $post)) {
$prev = $post['prev'];
}
else {
$prev = array();
}
if (array_key_exists('next', $post)) {
$next= $post['next'];
}
else {
$next = array();
}
render('post',array(
'title' => $current->title .' - ' . config('blog.title'),
'p' => $current,
'canonical' => $current->url,
'description' => $description = get_description($current->body),
'bodyclass' => 'inpost',
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . config('site.url') . '">Home</a></span> &#187; <span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . $current->tagurl .'">' . ucfirst($current->tag) . '</a></span> &#187; ' . $current->title,
'prev' => has_prev($prev),
'next' => has_next($next),
'type' => 'blogpost',
));
});
// The static page
get('/search/:keyword', function($keyword){
$page = from($_GET, 'page');
$page = $page ? (int)$page : 1;
$perpage = config('search.perpage');
$posts = get_keyword($keyword);
$total = count($posts);
// Extract a specific page with results
$posts = array_slice($posts, ($page-1) * $perpage, $perpage);
if(empty($posts) || $page < 1){
// a non-existing page
render('404-search', null, false);
die;
}
render('main',array(
'title' => 'Search results for: ' . $keyword . ' - ' . config('blog.title'),
'page' => $page,
'posts' => $posts,
'canonical' => config('site.url') . '/search/' . $keyword,
'description' => 'Search results for: ' . $keyword . ' on '. config('blog.title') . '.',
'bodyclass' => 'insearch',
'breadcrumb' => '<a href="' . config('site.url') . '">Home</a> &#187; Search results for: ' . $keyword,
'pagination' => has_pagination($total, $perpage, $page)
));
});
// The static page
get('/:spage', function($spage){
$post = find_spage($spage);
if(!$post){
not_found();
}
render('post',array(
'title' => $post->title .' - ' . config('blog.title'),
'canonical' => $post->url,
'description' => $description = get_description($post->body),
'bodyclass' => 'inpage',
'breadcrumb' => '<a href="' . config('site.url') . '">Home</a> &#187; ' . $post->title,
'p' => $post,
'type' => 'staticpage',
));
});
// The author page
get('/author/' . config('blog.authorid'), function(){
$user= new stdClass;
$user->body = config('blog.authorbio');
$user->title = config('blog.author');
$user->authorurl = config('site.url') . '/author/' . config('blog.authorid');
render('post',array(
'title' => $user->title .' - ' . config('blog.title'),
'canonical' => $user->authorurl,
'description' => $description = get_description($user->body),
'bodyclass' => 'inprofile',
'breadcrumb' => '<a href="' . config('site.url') . '">Home</a> &#187; ' . $user->title,
'p' => $user,
'type' => 'profile',
));
});
// The JSON API
get('/api/json',function(){
header('Content-type: application/json');
// Print the 10 latest posts as JSON
echo generate_json(get_posts(1, config('json.count')));
});
// Show the RSS feed
get('/feed/rss',function(){
header('Content-Type: application/rss+xml');
// Show an RSS feed with the 30 latest posts
echo generate_rss(get_posts(1, config('rss.count')));
});
// If we get here, it means that
// nothing has been matched above
get('.*',function(){
not_found();
});
// Serve the blog
dispatch();

+ 499
- 0
system/includes/dispatch.php View File

@ -0,0 +1,499 @@
<?php
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300) {
error(500, 'dispatch requires at least PHP 5.3 to run.');
}
function _log($message) {
if (config('debug.enable') == true && php_sapi_name() !== 'cli') {
$file = config('debug.log');
$type = $file ? 3 : 0;
error_log("{$message}\n", $type, $file);
}
}
function site_url(){
if (config('site.url') == null)
error(500, '[site.url] is not set');
// Forcing the forward slash
return rtrim(config('site.url'),'/').'/';
}
function site_path(){
static $_path;
if (config('site.url') == null)
error(500, '[site.url] is not set');
if (!$_path)
$_path = rtrim(parse_url(config('site.url'), PHP_URL_PATH),'/');
return $_path;
}
function error($code, $message) {
@header("HTTP/1.0 {$code} {$message}", true, $code);
die($message);
}
function config($key, $value = null) {
static $_config = array();
if ($key === 'source' && file_exists($value))
$_config = parse_ini_file($value, true);
else if ($value == null)
return (isset($_config[$key]) ? $_config[$key] : null);
else
$_config[$key] = $value;
}
function to_b64($str) {
$str = base64_encode($str);
$str = preg_replace('/\//', '_', $str);
$str = preg_replace('/\+/', '.', $str);
$str = preg_replace('/\=/', '-', $str);
return trim($str, '-');
}
function from_b64($str) {
$str = preg_replace('/\_/', '/', $str);
$str = preg_replace('/\./', '+', $str);
$str = preg_replace('/\-/', '=', $str);
$str = base64_decode($str);
return $str;
}
if (extension_loaded('mcrypt')) {
function encrypt($decoded, $algo = MCRYPT_RIJNDAEL_256, $mode = MCRYPT_MODE_CBC) {
if (($secret = config('cookies.secret')) == null)
error(500, '[cookies.secret] is not set');
$secret = mb_substr($secret, 0, mcrypt_get_key_size($algo, $mode));
$iv_size = mcrypt_get_iv_size($algo, $mode);
$iv_code = mcrypt_create_iv($iv_size, MCRYPT_DEV_URANDOM);
$encrypted = to_b64(mcrypt_encrypt($algo, $secret, $decoded, $mode, $iv_code));
return sprintf('%s|%s', $encrypted, to_b64($iv_code));
}
function decrypt($encoded, $algo = MCRYPT_RIJNDAEL_256, $mode = MCRYPT_MODE_CBC) {
if (($secret = config('cookies.secret')) == null)
error(500, '[cookies.secret] is not set');
$secret = mb_substr($secret, 0, mcrypt_get_key_size($algo, $mode));
list($enc_str, $iv_code) = explode('|', $encoded);
$enc_str = from_b64($enc_str);
$iv_code = from_b64($iv_code);
$enc_str = mcrypt_decrypt($algo, $secret, $enc_str, $mode, $iv_code);
return rtrim($enc_str, "\0");
}
}
function set_cookie($name, $value, $expire = 31536000, $path = '/') {
$value = (function_exists('encrypt') ? encrypt($value) : $value);
setcookie($name, $value, time() + $expire, $path);
}
function get_cookie($name) {
$value = from($_COOKIE, $name);
if ($value)
$value = (function_exists('decrypt') ? decrypt($value) : $value);
return $value;
}
function delete_cookie() {
$cookies = func_get_args();
foreach ($cookies as $ck)
setcookie($ck, '', -10, '/');
}
// if we have APC loaded, enable cache functions
if (extension_loaded('apc')) {
function cache($key, $func, $ttl = 0) {
if (($data = apc_fetch($key)) === false) {
$data = call_user_func($func);
if ($data !== null) {
apc_store($key, $data, $ttl);
}
}
return $data;
}
function cache_invalidate() {
foreach (func_get_args() as $key) {
apc_delete($key);
}
}
}
function warn($name = null, $message = null) {
static $warnings = array();
if ($name == '*')
return $warnings;
if (!$name)
return count(array_keys($warnings));
if (!$message)
return isset($warnings[$name]) ? $warnings[$name] : null ;
$warnings[$name] = $message;
}
function _u($str) {
return urlencode($str);
}
function _h($str, $enc = 'UTF-8', $flags = ENT_QUOTES) {
return htmlentities($str, $flags, $enc);
}
function from($source, $name) {
if (is_array($name)) {
$data = array();
foreach ($name as $k)
$data[$k] = isset($source[$k]) ? $source[$k] : null ;
return $data;
}
return isset($source[$name]) ? $source[$name] : null ;
}
function stash($name, $value = null) {
static $_stash = array();
if ($value === null)
return isset($_stash[$name]) ? $_stash[$name] : null;
$_stash[$name] = $value;
return $value;
}
function method($verb = null) {
if ($verb == null || (strtoupper($verb) == strtoupper($_SERVER['REQUEST_METHOD'])))
return strtoupper($_SERVER['REQUEST_METHOD']);
error(400, 'bad request');
}
function client_ip() {
if (isset($_SERVER['HTTP_CLIENT_IP']))
return $_SERVER['HTTP_CLIENT_IP'];
else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
return $_SERVER['HTTP_X_FORWARDED_FOR'];
return $_SERVER['REMOTE_ADDR'];
}
function redirect(/* $code_or_path, $path_or_cond, $cond */) {
$argv = func_get_args();
$argc = count($argv);
$path = null;
$code = 302;
$cond = true;
switch ($argc) {
case 3:
list($code, $path, $cond) = $argv;
break;
case 2:
if (is_string($argv[0]) ? $argv[0] : $argv[1]) {
$code = 302;
$path = $argv[0];
$cond = $argv[1];
} else {
$code = $argv[0];
$path = $argv[1];
}
break;
case 1:
if (!is_string($argv[0]))
error(500, 'bad call to redirect()');
$path = $argv[0];
break;
default:
error(500, 'bad call to redirect()');
}
$cond = (is_callable($cond) ? !!call_user_func($cond) : !!$cond);
if (!$cond)
return;
header('Location: '.$path, true, $code);
exit;
}
function partial($view, $locals = null) {
if (is_array($locals) && count($locals)) {
extract($locals, EXTR_SKIP);
}
if (($view_root = config('views.root')) == null)
error(500, "[views.root] is not set");
$path = basename($view);
$view = preg_replace('/'.$path.'$/', "_{$path}", $view);
$view = "{$view_root}/{$view}.html.php";
if (file_exists($view)) {
ob_start();
require $view;
return ob_get_clean();
} else {
error(500, "partial [{$view}] not found");
}
return '';
}
function content($value = null) {
return stash('$content$', $value);
}
function render($view, $locals = null, $layout = null) {
if (is_array($locals) && count($locals)) {
extract($locals, EXTR_SKIP);
}
if (($view_root = config('views.root')) == null)
error(500, "[views.root] is not set");
ob_start();
include "{$view_root}/{$view}.html.php";
content(trim(ob_get_clean()));
if ($layout !== false) {
if ($layout == null) {
$layout = config('views.layout');
$layout = ($layout == null) ? 'layout' : $layout;
}
$layout = "{$view_root}/{$layout}.html.php";
header('Content-type: text/html; charset=utf-8');
ob_start();
require $layout;
echo trim(ob_get_clean());
} else {
echo content();
}
}
function json($obj, $code = 200) {
header('Content-type: application/json', true, $code);
echo json_encode($obj);
exit;
}
function condition() {
static $cb_map = array();
$argv = func_get_args();
$argc = count($argv);
if (!$argc)
error(500, 'bad call to condition()');
$name = array_shift($argv);
$argc = $argc - 1;
if (!$argc && is_callable($cb_map[$name]))
return call_user_func($cb_map[$name]);
if (is_callable($argv[0]))
return ($cb_map[$name] = $argv[0]);
if (is_callable($cb_map[$name]))
return call_user_func_array($cb_map[$name], $argv);
error(500, 'condition ['.$name.'] is undefined');
}
function middleware($cb_or_path = null) {
static $cb_map = array();
if ($cb_or_path == null || is_string($cb_or_path)) {
foreach ($cb_map as $cb) {
call_user_func($cb, $cb_or_path);
}
} else {
array_push($cb_map, $cb_or_path);
}
}
function filter($sym, $cb_or_val = null) {
static $cb_map = array();
if (is_callable($cb_or_val)) {
$cb_map[$sym] = $cb_or_val;
return;
}
if (is_array($sym) && count($sym) > 0) {
foreach ($sym as $s) {
$s = substr($s, 1);
if (isset($cb_map[$s]) && isset($cb_or_val[$s]))
call_user_func($cb_map[$s], $cb_or_val[$s]);
}
return;
}
error(500, 'bad call to filter()');
}
function route_to_regex($route) {
$route = preg_replace_callback('@:[\w]+@i', function ($matches) {
$token = str_replace(':', '', $matches[0]);
return '(?P<'.$token.'>[a-z0-9_\0-\.]+)';
}, $route);
return '@^'.rtrim($route, '/').'$@i';
}
function route($method, $pattern, $callback = null) {
// callback map by request type
static $route_map = array(
'GET' => array(),
'POST' => array()
);
$method = strtoupper($method);
if (!in_array($method, array('GET', 'POST')))
error(500, 'Only GET and POST are supported');
// a callback was passed, so we create a route defiition
if ($callback !== null) {
// create a route entry for this pattern
$route_map[$method][$pattern] = array(
'xp' => route_to_regex($pattern),
'cb' => $callback
);
} else {
// callback is null, so this is a route invokation. look up the callback.
foreach ($route_map[$method] as $pat => $obj) {
// if the requested uri ($pat) has a matching route, let's invoke the cb
if (!preg_match($obj['xp'], $pattern, $vals))
continue;
// call middleware
middleware($pattern);
// construct the params for the callback
array_shift($vals);
preg_match_all('@:([\w]+)@', $pat, $keys, PREG_PATTERN_ORDER);
$keys = array_shift($keys);
$argv = array();
foreach ($keys as $index => $id) {
$id = substr($id, 1);
if (isset($vals[$id])) {
array_push($argv, trim(urldecode($vals[$id])));
}
}
// call filters if we have symbols
if (count($keys)) {
filter(array_values($keys), $vals);
}
// if cb found, invoke it
if (is_callable($obj['cb'])) {
call_user_func_array($obj['cb'], $argv);
}
// leave after first match
break;
}
}
}
function get($path, $cb) {
route('GET', $path, $cb);
}
function post($path, $cb) {
route('POST', $path, $cb);
}
function flash($key, $msg = null, $now = false) {
static $x = array(),
$f = null;
$f = (config('cookies.flash') ? config('cookies.flash') : '_F');
if ($c = get_cookie($f))
$c = json_decode($c, true);
else
$c = array();
if ($msg == null) {
if (isset($c[$key])) {
$x[$key] = $c[$key];
unset($c[$key]);
set_cookie($f, json_encode($c));
}
return (isset($x[$key]) ? $x[$key] : null);
}
if (!$now) {
$c[$key] = $msg;
set_cookie($f, json_encode($c));
}
$x[$key] = $msg;
}
function dispatch() {
$path = $_SERVER['REQUEST_URI'];
if (config('site.url') !== null)
$path = preg_replace('@^'.preg_quote(site_path()).'@', '', $path);
$parts = preg_split('/\?/', $path, -1, PREG_SPLIT_NO_EMPTY);
$uri = trim($parts[0], '/');
$uri = strlen($uri) ? $uri : 'index';
route(method(), "/{$uri}");
}
?>

+ 644
- 0
system/includes/functions.php View File

@ -0,0 +1,644 @@
<?php
// Change this to your timezone
date_default_timezone_set('Asia/Jakarta');
use dflydev\markdown\MarkdownParser;
use \Suin\RSSWriter\Feed;
use \Suin\RSSWriter\Channel;
use \Suin\RSSWriter\Item;
// Get blog post
function get_post_names(){
static $_cache = array();
if(empty($_cache)){
// Get the names of all the
// posts (newest first):
$_cache = array_reverse(glob('content/blog/*.md'));
}
return $_cache;
}
// Get static page
function get_spage_names(){
static $_cache = array();
if(empty($_cache)){
// Get the names of all the
// static page (newest first):
$_cache = array_reverse(glob('content/static/*.md'));
}
return $_cache;
}
// Return blog post
function get_posts($page = 1, $perpage = 0){
if($perpage == 0){
$perpage = config('posts.perpage');
}
$posts = get_post_names();
// Extract a specific page with results
$posts = array_slice($posts, ($page-1) * $perpage, $perpage);
$tmp = array();
// Create a new instance of the markdown parser
$md = new MarkdownParser();
foreach($posts as $k=>$v){
$post = new stdClass;
// Extract the date
$arr = explode('_', $v);
// The post author + author url
$post->author = config('blog.author');
$post->authorurl = site_url() . 'author/' . config('blog.authorid');
// The post date
$post->date = strtotime(str_replace('content/blog/','',$arr[0]));
// The archive per day
$post->archive = site_url(). str_replace('content/blog/','archive/',$arr[0]);
// The post URL
$post->url = site_url().date('Y/m', $post->date).'/'.str_replace('.md','',$arr[2]);
// The post tag
$post->tag = str_replace('content/blog/','',$arr[1]);
// The post tag url
$post->tagurl = site_url(). 'tag/' . $arr[1];
// Get the contents and convert it to HTML
$content = $md->transformMarkdown(file_get_contents($v));
// Extract the title and body
$arr = explode('</h1>', $content);
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
$tmp[] = $post;
}
return $tmp;
}
// Find post by year, month and name, previous, and next.
function find_post($year, $month, $name){
$posts = get_post_names();
foreach($posts as $index => $v){
if( strpos($v, "$year-$month") !== false && strpos($v, $name.'.md') !== false){
// Use the get_posts method to return
// a properly parsed object
$ar = get_posts($index+1,1);
$nx = get_posts($index,1);
$pr = get_posts($index+2,1);
if ($index == 0) {
if(isset($pr[0])) {
return array(
'current'=> $ar[0],
'prev'=> $pr[0]
);
}
else {
return array(
'current'=> $ar[0],
'prev'=> null
);
}
}
elseif (count($posts) == $index+1) {
return array(
'current'=> $ar[0],
'next'=> $nx[0]
);
}
else {
return array(
'current'=> $ar[0],
'next'=> $nx[0],
'prev'=> $pr[0]
);
}
}
}
return false;
}
// Return tag page
function get_tag($tag){
$posts = get_post_names();
$tmp = array();
// Create a new instance of the markdown parser
$md = new MarkdownParser();
foreach($posts as $index => $v){
if( strpos($v, "$tag") !== false){
$post = new stdClass;
// Extract the date
$arr = explode('_', $v);
// Make sure the tag request available
if ($tag === $arr[1]) {
// The post author + author url
$post->author = config('blog.author');
$post->authorurl = site_url() . 'author/' . config('blog.authorid');
// The post date
$post->date = strtotime(str_replace('content/blog/','',$arr[0]));
// The post URL
$post->url = site_url().date('Y/m', $post->date).'/'.str_replace('.md','',$arr[2]);
// The post tag
$post->tag = str_replace('content/blog/','',$arr[1]);
// The post tag URL
$post->tagurl = site_url(). 'tag/' . $arr[1];
// Get the contents and convert it to HTML
$content = $md->transformMarkdown(file_get_contents($v));
// Extract the title and body
$arr = explode('</h1>', $content);
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
$tmp[] = $post;
}
else {
not_found();
}
}
}
return $tmp;
}
// Return an archive page
function get_archive($req){
$posts = get_post_names();
$tmp = array();
// Create a new instance of the markdown parser
$md = new MarkdownParser();
foreach($posts as $index => $v){
if( strpos($v, "$req") !== false){
$post = new stdClass;
// Extract the date
$arr = explode('_', $v);
// The post author + author url
$post->author = config('blog.author');
$post->authorurl = site_url() . 'author/' . config('blog.authorid');
// The post date
$post->date = strtotime(str_replace('content/blog/','',$arr[0]));
// The post URL
$post->url = site_url().date('Y/m', $post->date).'/'.str_replace('.md','',$arr[2]);
// The post tag
$post->tag = str_replace('content/blog/','',$arr[1]);
// The post tag URL
$post->tagurl = site_url(). 'tag/' . $arr[1];
// Get the contents and convert it to HTML
$content = $md->transformMarkdown(file_get_contents($v));
// Extract the title and body
$arr = explode('</h1>', $content);
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
$tmp[] = $post;
}
}
return $tmp;
}
// Return an archive list, categorized by year and month
function archive_list() {
$posts = get_post_names();
$by_year = array();
$col = array();
foreach($posts as $index => $v){
$arr = explode('_', $v);
$date = str_replace('content/blog/','',$arr[0]);
$data = explode('-', $date);
$col[] = $data;
}
foreach ($col as $row){
$y = $row['0'];
$m = $row['1'];
$by_year[$y][] = $m;
}
# Most recent year first
krsort($by_year);
# Iterate for display
foreach ($by_year as $year => $months){
echo '<span class="year"><a href="' . site_url() . 'archive/' . $year . '">' . $year . '</a></span> ';
echo '(' . count($months) . ')';
echo '<ul class="month">';
# Sort the months
ksort($months);
$by_month = array_count_values($months);
foreach ($by_month as $month => $count){
$name = date('F', mktime(0,0,0,$month,1,2010));
echo '<li class="item"><a href="' . site_url() . 'archive/' . $year . '-' . $month . '">' . $name . '</a>';
echo ' (' . $count . ')</li>';
echo '</li>';
}
echo '</ul>';
}
}
// Return static page
function get_spage($posts, $spage){
$tmp = array();
// Create a new instance of the markdown parser
$md = new MarkdownParser();
foreach($posts as $index => $v){
if( strpos($v, "$spage") !== false && strpos($v, $spage.'.md') !== false){
$post = new stdClass;
// Extract the array
$arr = explode('_', $v);
// The static page URL
$url = str_replace('content/static/','',$arr[0]);
$post->url = site_url() . str_replace('.md','',$url);
// Get the contents and convert it to HTML
$content = $md->transformMarkdown(file_get_contents($v));
// Extract the title and body
$arr = explode('</h1>', $content);
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
$tmp[] = $post;
}
}
return $tmp;
}
// Find static page
function find_spage($spage){
$posts = get_spage_names();
foreach($posts as $index => $v){
if( strpos($v, "$spage") !== false && strpos($v, $spage.'.md') !== false){
// Use the get_spage method to return
// a properly parsed object
$arr = get_spage($posts, $spage);
return $arr[0];
}
}
return false;
}
// Return search page
function get_keyword($keyword){
$posts = get_post_names();
$tmp = array();
// Create a new instance of the markdown parser
$md = new MarkdownParser();
foreach($posts as $index => $v){
$content = $md->transformMarkdown(file_get_contents($v));
if(strpos(strtolower(strip_tags($content)), strtolower($keyword)) !== false){
$post = new stdClass;
// Extract the date
$arr = explode('_', $v);
// Make sure the tag request available
// The post author + author url
$post->author = config('blog.author');
$post->authorurl = site_url() . 'author/' . config('blog.authorid');
// The post date
$post->date = strtotime(str_replace('content/blog/','',$arr[0]));
// The post URL
$post->url = site_url().date('Y/m', $post->date).'/'.str_replace('.md','',$arr[2]);
// The post tag
$post->tag = str_replace('content/blog/','',$arr[1]);
// The post tag URL
$post->tagurl = site_url(). 'tag/' . $arr[1];
// Extract the title and body
$arr = explode('</h1>', $content);
$post->title = str_replace('<h1>','',$arr[0]);
$post->body = $arr[1];
$tmp[] = $post;
}
}
return $tmp;
}
// Helper function to determine whether
// to show the previous buttons
function has_prev($prev){
if(!empty($prev)) {
return array(
'url'=> $prev->url,
'title'=> $prev->title
);
}
}
// Helper function to determine whether
// to show the next buttons
function has_next($next){
if(!empty($next)) {
return array(
'url'=> $next->url,
'title'=> $next->title
);
}
}
// Helper function to determine whether
// to show the pagination buttons
function has_pagination($total, $perpage, $page = 1){
if(!$total) {
$total = count(get_post_names());
}
return array(
'prev'=> $page > 1,
'next'=> $total > $page*$perpage
);
}
// Get the meta description
function get_description($text) {
$string = explode('</p>', $text);
$string = preg_replace('@[\s]{2,}@',' ', strip_tags($string[0] . '</p>'));
if (strlen($string) > 1) {
return $string;
}
else {
$string = preg_replace('@[\s]{2,}@',' ', strip_tags($text));
if (strlen($string) < config('description.char')) {
return $string;
}
else {
return $string = substr($string, 0, strpos($string, ' ', config('description.char')));
}
}
}
// Get the teaser
function get_teaser($text, $url) {
if (strlen(strip_tags($text)) < config('teaser.char')) {
$string = preg_replace('@[\s]{2,}@',' ', strip_tags($text));
$body = $string . '...' . ' <a class="readmore" href="' . $url . '#more">more</a>' ;
echo '<p>' . $body . '</p>';
}
else {
$string = preg_replace('@[\s]{2,}@',' ', strip_tags($text));
$string = substr($string, 0, strpos($string, ' ', config('teaser.char')));
$body = $string . '...' . ' <a class="readmore" href="' . $url . '#more">more</a>' ;
echo '<p>' . $body . '</p>';
}
}
// Get thumbnail from image and Youtube.
function get_thumbnail($text) {
$default = config('default.thumbnail');
$dom = new DOMDocument();
$dom->loadHtml($text);
$imgTags = $dom->getElementsByTagName('img');
$vidTags = $dom->getElementsByTagName('iframe');
if ($imgTags->length > 0) {
$imgElement = $imgTags->item(0);
$imgSource = $imgElement->getAttribute('src');
return '<div class="thumbnail" style="background-image:url(' . $imgSource . ');"></div>';
}
elseif ($vidTags->length > 0) {
$vidElement = $vidTags->item(0);
$vidSource = $vidElement->getAttribute('src');
$fetch = explode("embed/", $vidSource);
if(isset($fetch[1])) {
$vidThumb = '//img.youtube.com/vi/' . $fetch[1] . '/default.jpg';
return '<div class="thumbnail" style="background-image:url(' . $vidThumb . ');"></div>';
}
}
else {
if (!empty($default)) {
return '<div class="thumbnail" style="background-image:url(' . $default . ');"></div>';
}
}
}
// Use base64 encode image to speed up page load time.
function base64_encode_image($filename=string,$filetype=string) {
if ($filename) {
$imgbinary = fread(fopen($filename, "r"), filesize($filename));
return 'data:image/' . $filetype . ';base64,' . base64_encode($imgbinary);
}
}
// Social links
function social(){
$twitter = config('social.twitter');
$facebook = config('social.facebook');
$google = config('social.google');
$tumblr = config('social.tumblr');
$rss = site_url() . 'feed/rss';
if (!empty($twitter)) {
echo '<a href="' . $twitter . '" target="_blank"><img src="' . site_url() . 'themes/default/img/twitter.png" width="32" height="32" alt="Twitter"/></a>';
}
if (!empty($facebook)) {
echo '<a href="' . $facebook . '" target="_blank"><img src="' . site_url() . 'themes/default/img/facebook.png" width="32" height="32" alt="Facebook"/></a>';
}
if (!empty($google)) {
echo '<a href="' . $google . '" target="_blank" rel="author"><img src="' . site_url() . 'themes/default/img/googleplus.png" width="32" height="32" alt="Google+"/></a>';
}
if (!empty($tumblr)) {
echo '<a href="' . $tumblr . '" target="_blank"><img src="' . site_url() . 'themes/default/img/tumblr.png" width="32" height="32" alt="Tumblr"/></a>';
}
echo '<a href="' . site_url() . 'feed/rss" target="_blank"><img src="' . site_url() . 'themes/default/img/rss.png" width="32" height="32" alt="RSS Feed"/></a>';
}
// Copyright
function copyright(){
$blogcp = config('blog.copyright');
$credit = 'Proudly powered by <a href="http://www.htmly.com" target="_blank">HTMLy</a>.';
if (!empty($blogcp)) {
return $copyright = '<p>' . $blogcp . '</p><p>' . $credit . '</p>';
}
else {
return $credit = '<p>' . $credit . '</p>';
}
}
// Disqus
function disqus($title, $url){
$disqus = config('disqus.shortname');
$script = <<<EOF
<script type="text/javascript">
var disqus_shortname = '{$disqus}';
var disqus_title = '{$title}';
var disqus_url = '{$url}';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
EOF;
if (!empty($disqus)) {
return $script;
}
}
// Disqus
function disqus_count(){
$disqus = config('disqus.shortname');
$script = <<<EOF
<script type="text/javascript">
var disqus_shortname = '{$disqus}';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
EOF;
if (!empty($disqus)) {
return $script;
}
}
// Google Publisher
function publisher(){
$publisher = config('google.publisher');
if (!empty($publisher)) {
return $publisher;
}
}
// Menu
function menu(){
$menu = config('blog.menu');
if (!empty($menu)) {
return $menu;
}
}
// The not found error
function not_found(){
error(404, render('404', null, false));
}
// Turn an array of posts into an RSS feed
function generate_rss($posts){
$feed = new Feed();
$channel = new Channel();
$channel
->title(config('blog.title'))
->description(config('blog.description'))
->url(site_url())
->appendTo($feed);
foreach($posts as $p){
$item = new Item();
$item
->title($p->title)
->description($p->body)
->url($p->url)
->appendTo($channel);
}
echo $feed;
}
// Turn an array of posts into a JSON
function generate_json($posts){
return json_encode($posts);
}

+ 30
- 0
themes/default/404-search.html.php View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<link href='<?php echo site_url() ?>favicon.ico' rel='icon' type='image/x-icon'/>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" />
<title>Search results not found! - <?php echo config('blog.title') ?></title>
<link href="<?php echo site_url() ?>themes/default/css/style.css" rel="stylesheet" />
<!-- Include the Open Sans font -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700&subset=latin,cyrillic-ext" rel="stylesheet" />
</head>
<body>
<div class="center message">
<h1>Search results not found!</h1>
<div class="search">
<form id="search-form" method="get">
<input type="text" class="search-input" name="keyword" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}">
<input type="submit" value="Search" class="search-button">
</form>
<?php if(isset($_GET['keyword'])) {$url = site_url() . 'search/' . $_GET['keyword']; header ("Location: $url");} ?>
</div>
<p>Please search again, or would you like to try our <a href="<?php echo site_url() ?>">homepage</a> instead?</p>
</div>
</body>
</html>

+ 23
- 0
themes/default/404.html.php View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<link href='<?php echo site_url() ?>favicon.ico' rel='icon' type='image/x-icon'/>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" />
<title>404 Not Found - <?php echo config('blog.title') ?></title>
<link href="<?php echo site_url() ?>themes/default/css/style.css" rel="stylesheet" />
<!-- Include the Open Sans font -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700&subset=latin,cyrillic-ext" rel="stylesheet" />
</head>
<body>
<div class="center message">
<h1>This page doesn't exist!</h1>
<p>Would you like to try our <a href="<?php echo site_url() ?>">homepage</a> instead?</p>
</div>
</body>
</html>

+ 625
- 0
themes/default/css/style.css View File

@ -0,0 +1,625 @@
/*-------------------------
Simple reset
--------------------------*/
*{
margin:0;
padding:0;
}
/*-------------------------
General Styles
--------------------------*/
html{
}
body{
font:16px/1.6 Georgia, Arial, sans-serif;
color: #4f4f4f;
}
a, a:visited {
outline:none;
color:#389dc1;
text-decoration:none;
}
a:hover{
text-decoration:underline;
}
section, footer, header, aside{
display: block;
}
img {
border: 0 none;
height: auto;
max-width: 100%;
outline: 0 none;
}
/*----------------------------
Headings
-----------------------------*/
h1{
font: 20px 'Open Sans Condensed', sans-serif;
margin-bottom: 1em;
line-height: 1.3;
}
h1.blog-title {
text-transform:uppercase;
}
h1.blog-title a {
color:#4f4f4f;
text-decoration: none;
}
h1.blog-title a:hover {
color: #389dc1;
}
h2{
font: 22px 'Open Sans Condensed', sans-serif;
line-height: 1.2;
margin-bottom: 0.5em;
}
h1.title-post, h2.title-index{
font: 28px 'Open Sans Condensed', sans-serif;
line-height: 1.2;
text-transform:normal;
margin:0 0 20px 0;
}
h1.title-post a, h2.title-index a{
color:#4f4f4f;
text-decoration: none;
}
h1.title-post a:hover, h2.title-index a:hover {
color: #389dc1;
}
/*----------------------------
Content & Posts
-----------------------------*/
#content{
position: absolute;
width: 580px;
left: 50%;
margin-left: -100px;
}
#content p,
#content ul{
margin:1em 0;
}
#content ul{
padding-left:20px;
}
#content li{
margin-bottom:5px;
}
#content div.actions{
margin-top:25px;
font-size:14px;
font-family:'Open Sans Condensed', sans-serif;
}
#content div.actions .readmore{
text-decoration: none !important;
padding:0 2px;
}
#content div.actions .readmore:hover{
background-color:#389dc1;
color:#fff;
}
#content div.actions .comments{
color:#ccc;
margin-left:10px;
text-decoration:none;
}
.infront .post, .intag .post, .inarchive .post, .insearch .post{
border-bottom: 1px solid #dfdfdf;
padding: 30px 0 10px 0;
}
.infront .post.first {
padding-top:50px;
}
.intag .post.first, .inarchive .post.first, .insearch .post.first {
padding-top: 0px;
}
.post .date{
font: bold 12px 'Open Sans Condensed', sans-serif;
text-transform: uppercase;
color: #a7a7a7;
margin: 0 0 20px 20px;
position: relative;
}
.post .date:before{
width:18px;
height:18px;
position:absolute;
content:'';
left: -22px;
top: -1px;
background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2RpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoyNjZDQjA1OTM1ODZFMjExQUUwM0IwQzQwMjlEOTczMyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpENjYzQjI4QjhCNDYxMUUyQjNENkFGQ0NCRUExRDM1NSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpENjYzQjI4QThCNDYxMUUyQjNENkFGQ0NCRUExRDM1NSIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IFdpbmRvd3MiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4NjA1NUJCNzUzOEFFMjExQUUwM0IwQzQwMjlEOTczMyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoyNjZDQjA1OTM1ODZFMjExQUUwM0IwQzQwMjlEOTczMyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PhTXJRoAAADXSURBVHjaYvz//z8DNQDL7t27sYmDTGfEoQdDztXVlYEJyg4B4rdA/AGLJhjGJgfS4wfiwAyaCcRCQMwGxMxQMTY0jdjkQHqmwQzihwqAACcQ50CdXoRmEC45aXAYYQmDCVDMQIocskGMZEbYB+QwQokBEAaCzch8dDF0wMRAJcC4a9cufqjzYF7bTKReX5jXgC4UYMHiNbACYEJ9AaQkkL2BLIaekIeA15AUbEZiM+ARo67XQAZ9BOJ3eFxGSOwFcspOBOLnoBgh0SEgQ+LAgU2tgg0gwACqTkAIjemp4gAAAABJRU5ErkJggg==')
}
pre {
margin: 1em 0;
overflow: auto;
background: #F1F1FF;
}
pre code {
color: #333333;
display: block;
font-family: Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif;
font-size: 14px;
padding: 5px 10px;
}
.comments {
position:relative;
display:block;
font-size:16px;
float:left;
width:100%;
}
.border {
border-top: 1px solid #DFDFDF;
padding-bottom: 15px;
margin-bottom: 15px;
margin-top: 10px;
}
.border #disqus_thread {
padding-top: 1.2em;
}
#disqus_thread {
font-family: Georgia, Times, Cambria, serif;
float:left;
width:100%;
}
.breadcrumb {
padding-top: 50px;
padding-bottom: 10px;
font: normal 14px 'Open Sans Condensed', sans-serif;
}
.thumbnail {
float: left;
height: 80px;
width: 80px;
margin: 5px 15px 0 0;
overflow: hidden;
display: block;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
blockquote:before {
color: #BBBBBB;
content: "“";
font-size: 3em;
line-height: 0.1em;
margin-right: 0.2em;
vertical-align: -0.4em;
}
blockquote:after {
color: #BBBBBB;
content: "”";
font-size: 3em;
line-height: 0.1em;
vertical-align: -0.45em;
}
blockquote {
font-style: italic;
margin-left: 1em;
}
.credit {
font-size:12px;
text-align:center;
padding: 10px 0;
}
/*----------------------------
The left bar
-----------------------------*/
aside{
position: fixed;
width: 250px;
height: auto;
top: 0;
left: 50%;
bottom: 0;
margin-left: -460px;
padding-top: 65px;
}
aside .description p{
font-size: 14px;
margin-bottom: 1.2em;
color:#787878;
}
aside .social {
margin-bottom: 1.2em;
}
.gsc-control-searchbox-only {
width:220px;
}
aside .menu {
margin-bottom: 1.2em;
}
aside .menu ul{
font: bold 18px 'Open Sans Condensed', sans-serif;
text-transform: uppercase;
list-style:none;
}
aside .menu ul li a{
text-decoration:none !important;
display:inline-block;
padding:0 3px;
margin:2px 0 2px 10px;
}
aside .archive {
font-size: 15px;
font-family: 'Open Sans Condensed', sans-serif;
margin-bottom: 1.2em;
margin-left: 10px;
}
aside .archive ul li {
margin-left:30px;
}
aside .menu ul li a:hover{
background-color:#389dc1;
color:#fff;
}
aside .copyright {
position: absolute;
bottom: 20px;
color: #888;
font: 11px Georgia, sans-serif;
font-weight: normal;
font-style: italic;
}
aside .copyright p{
margin: 5px 0;
}
/*----------------------------
Pagination buttons
-----------------------------*/
.postnav{
width:100%;
float:left;
padding: 0 0 30px 0;
}
.postnav .pagination-arrow{
display: inline-block;
font: bold 12px/1 'Open Sans Condensed', sans-serif;
border: 1px solid #ccc;
border-radius: 3px;
color: #555 !important;
padding: 8px 12px;
text-decoration: none !important;
text-transform: none;
position: relative;
}
.postnav .pagination-arrow.newer{
padding-left: 20px;
}
.postnav .pagination-arrow.older{
padding-right: 20px;
float:right;
}
.postnav .pagination-arrow.newer:before,
.postnav .pagination-arrow.older:before{
content: '';
border: 5px solid #555;
border-color: transparent #555 transparent transparent;
width: 0;
height: 0;
position: absolute;
left: 3px;
top: 10px;
}
.postnav .pagination-arrow.older:before{
left:auto;
right:3px;
border-color: transparent transparent transparent #555;
}
.pager {
width:100%;
float:left;
padding: 30px 0 30px 0;
}
.pager .pagination-arrow{
display: inline-block;
font: bold 16px/1 'Open Sans Condensed', sans-serif;
border: 1px solid #ccc;
border-radius: 3px;
color: #555 !important;
padding: 8px 12px;
text-decoration: none !important;
text-transform: uppercase;
position: relative;
}
.pager .pagination-arrow.newer{
padding-left: 20px;
}
.pager .pagination-arrow.older{
padding-right: 20px;
float:right;
}
.pager .pagination-arrow.newer:before,
.pager .pagination-arrow.older:before{
content: '';
border: 5px solid #555;
border-color: transparent #555 transparent transparent;
width: 0;
height: 0;
position: absolute;
left: 3px;
top: 12px;
}
.pager .pagination-arrow.older:before{
left:auto;
right:3px;
border-color: transparent transparent transparent #555;
}
/*----------------------------
The 404 page
-----------------------------*/
.message{
padding-top:50px;
}
.message h1{
font-size:36px;
margin-bottom: 18px;
}
.message p{
font-size:13px;
}
.center{
text-align:center;
}
/*----------------------------
Search form
-----------------------------*/
.search {
position:relative;
float:left;
width:100%;
margin-bottom: 1.2em;
}
.search-input{
margin: 0;
padding: 5px 15px;
font-family: Arial, Helvetica, sans-serif;
font-size:14px;
border:1px solid #0076a3;
border-top-left-radius: 5px 5px;
border-bottom-left-radius: 5px 5px;
width: 120px;
color: #888888;
}
.search-button {
margin: 0;
padding: 5px;
font-family: Arial, Helvetica, sans-serif;
font-size:14px;
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
color: #ffffff;
border: solid 1px #0076a3;
border-right:0px;
background: #0095cd;
background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5));
background: -moz-linear-gradient(top, #00adee, #0078a5);
border-top-right-radius: 5px 5px;
border-bottom-right-radius: 5px 5px;
width: 60px;
}
.search-button:hover {
text-decoration: none;
background: #007ead;
background: -webkit-gradient(linear, left top, left bottom, from(#0095cc), to(#00678e));
background: -moz-linear-gradient(top, #0095cc, #00678e);
}
/* Fixes submit button height problem in Firefox */
.search-button::-moz-focus-inner {
border: 0;
}
/*----------------------------
Media queries
-----------------------------*/
@media all and (max-width: 1024px) {
aside{
left: 5%;
margin-left: 0;
width: 25%;
}
#content{
left: 35%;
margin-left: 0;
width: 60%;
}
}
@media all and (max-width: 840px) {
h2{
font-size:22px;
}
h1.title-post, h2.title-index{
font-size:26px;
}
aside{
margin-left: 0;
position: static;
width: 90%;
padding: 5% 5% 0 5%;
text-align: center;
}
aside .description{
margin-bottom: 25px;
}
aside li {
display: inline-block;
}
aside ul{
text-align: center;
}
aside .archive, aside .copyright{
display: none;
}
#content{
position: static;
padding: 5%;
padding-top: 0;
width: 90%;
}
.gsc-control-searchbox-only {
width:auto;
}
.infront .post.first {
padding-top:0px;
}
.breadcrumb {
padding-top: 0px;
}
.infront .post, .intag .post, .inarchive .post, .insearch .post{
padding: 30px 0 20px 0;
}
.search {
text-align:center;
}
}
/*----------------------------
Video
-----------------------------*/
.video-wrapper {
margin-bottom:1em;
}
@media all and (min-width: 420px) {
.video-wrapper {
padding-top:315px!important;
position:relative;
width:100%;
max-width:420px!important;
max-height:315px!important;
}
.video-wrapper iframe, .video-wrapper object, .video-wrapper embed {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
max-width:420px!important;
max-height:315px!important;
}
}
@media all and (max-width: 420px) {
.postnav .pagination-arrow.newer{
padding-left: 20px;
float:none;
margin-bottom: 20px;
}
.postnav .pagination-arrow.older{
padding-right: 20px;
float:none;
}
.video-wrapper {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-wrapper iframe, .video-wrapper object, .video-wrapper embed {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
}

BIN
themes/default/img/facebook.png View File

Before After
Width: 72  |  Height: 72  |  Size: 2.4 KiB

BIN
themes/default/img/googleplus.png View File

Before After
Width: 72  |  Height: 72  |  Size: 2.7 KiB

BIN
themes/default/img/rss.png View File

Before After
Width: 72  |  Height: 72  |  Size: 2.7 KiB

BIN
themes/default/img/tumblr.png View File

Before After
Width: 72  |  Height: 72  |  Size: 2.6 KiB

BIN
themes/default/img/twitter.png View File

Before After
Width: 72  |  Height: 72  |  Size: 2.7 KiB

+ 44
- 0
themes/default/layout.html.php View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<title><?php echo isset($title) ? _h($title) : config('blog.title') ?></title>
<link href='<?php echo site_url() ?>favicon.ico' rel='icon' type='image/x-icon'/>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" />
<meta name="description" content="<?php echo $description; ?>" />
<link rel="canonical" href="<?php echo $canonical; ?>" />
<link rel="alternate" type="application/rss+xml" title="<?php echo config('blog.title')?> Feed" href="<?php echo site_url()?>feed/rss" />
<link href="<?php echo site_url() ?>themes/default/css/style.css" rel="stylesheet" />
<link href="http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700&subset=latin,cyrillic-ext" rel="stylesheet" />
<?php if (publisher() == true):?><link href="<?php echo publisher() ?>" rel="publisher" /><?php endif;?>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body class="<?php echo $bodyclass; ?>">
<div itemscope="itemscope" itemtype="http://schema.org/Blog" style="display: none;">
<meta content="<?php echo config('blog.title') ?>" itemprop="name"/>
<meta content="<?php echo config('blog.description')?>" itemprop="description"/>
</div>
<aside>
<h1 class="blog-title"><a href="<?php echo site_url() ?>"><?php echo config('blog.title') ?></a></h1>
<div class="description"><p><?php echo config('blog.description')?></p></div>
<div class="search">
<form id="search-form" method="get">
<input type="text" class="search-input" name="keyword" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}">
<input type="submit" value="Search" class="search-button">
</form>
<?php if(isset($_GET['keyword'])) {$url = site_url() . 'search/' . $_GET['keyword']; header ("Location: $url");} ?>
</div>
<div class="social"><?php echo social() ?></div>
<?php if (menu() == true):?><div class="menu"><?php echo menu() ?></div><?php endif;?>
<div class="archive"><?php echo archive_list()?></div>
<div class="copyright"><?php echo copyright() ?></div>
</aside>
<section id="content">
<?php echo content()?>
</section>
</body>
</html>

+ 41
- 0
themes/default/main.html.php View File

@ -0,0 +1,41 @@
<?php if (!empty($breadcrumb)):?><div class="breadcrumb"><?php echo $breadcrumb ?></div><?php endif;?>
<?php $i = 0; $len = count($posts);?>
<?php foreach($posts as $p):?>
<?php
if ($i == 0) {
$class = 'first';
}
elseif ($i == $len - 1) {
$class = 'last';
}
else {
$class = '';
}
$i++;
?>
<div class="post <?php echo $class ?>" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<div class="main">
<h2 class="title-index" itemprop="name"><a href="<?php echo $p->url?>"><?php echo $p->title ?></a></h2>
<div class="date"><span itemprop="datePublished"><?php echo date('d F Y', $p->date)?></span> - Posted in <span itemprop="articleSection"><a href="<?php echo $p->tagurl ?>"><?php echo ucfirst($p->tag) ?></a></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span><?php if (disqus_count() == true):?> - <span><a href="<?php echo $p->url?>#disqus_thread">Komentar</a></span><?php endif;?></div>
<div itemprop="articleBody">
<?php if (config('img.thumbnail') == 'true'):?>
<?php echo get_thumbnail($p->body)?>
<?php endif;?>
<?php echo get_teaser($p->body, $p->url)?>
</div>
</div>
</div>
<?php endforeach;?>
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])):?>
<div class="pager">
<?php if (!empty($pagination['prev'])):?>
<span><a href="?page=<?php echo $page-1?>" class="pagination-arrow newer" rel="prev">Newer</a></span>
<?php endif;?>
<?php if (!empty($pagination['next'])):?>
<span><a href="?page=<?php echo $page+1?>" class="pagination-arrow older" rel="next">Older</a></span>
<?php endif;?>
</div>
<?php endif;?>
<?php if (disqus_count() == true):?>
<?php echo disqus_count() ?>
<?php endif;?>

+ 38
- 0
themes/default/post.html.php View File

@ -0,0 +1,38 @@
<?php if (!empty($breadcrumb)):?><div class="breadcrumb" xmlns:v="http://rdf.data-vocabulary.org/#"><?php echo $breadcrumb ?></div><?php endif;?>
<div class="post" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<div class="main">
<?php if ($type == 'blogpost'):?>
<a name="more"></a>
<?php endif;?>
<h1 class="title-post" itemprop="name"><?php echo $p->title ?></h1>
<?php if ($type == 'blogpost'):?>
<div class="date"><span itemprop="datePublished"><a href="<?php echo $p->archive ?>" title="Show all posts made on this day"><?php echo date('d F Y', $p->date)?></a></span> - Posted in <span itemprop="articleSection"><a href="<?php echo $p->tagurl ?>"><?php echo ucfirst($p->tag) ?></a></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span> - <span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span></div>
<?php endif;?>
<div itemprop="articleBody">
<?php echo $p->body; ?>
</div>
</div>
<div class="comments border">
<?php if ($type == 'blogpost'):?>
<?php if (disqus(null, null) == true):?>
<div id="disqus_thread"></div>
<?php endif;?>
<?php endif;?>
</div>
<?php if ($type == 'blogpost'):?>
<div class="postnav">
<?php if (!empty($next)):?>
<span><a href="<?php echo ($next['url']);?>" class="pagination-arrow newer" rel="next"><?php echo ($next['title']);?></a></span>
<?php endif;?>
<?php if (!empty($prev)):?>
<span><a href="<?php echo ($prev['url']); ?>" class="pagination-arrow older" rel="prev"><?php echo ($prev['title']); ?></a></span>
<?php endif;?>
</div>
<?php endif;?>
<?php if ($type == 'blogpost'):?>
<?php if (disqus(null, null) == true):?>
<?php echo disqus($p->title, $p->url) ?>
<?php endif;?>
<?php endif;?>
</div>

+ 1
- 0
themes/readme.txt View File

@ -0,0 +1 @@
Put your theme folder here but don't modify the default theme.

+ 7
- 0
vendor/autoload.php View File

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

+ 240
- 0
vendor/composer/ClassLoader.php View File

@ -0,0 +1,240 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0 class loader
*
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class ClassLoader
{
private $prefixes = array();
private $fallbackDirs = array();
private $useIncludePath = false;
private $classMap = array();
public function getPrefixes()
{
return $this->prefixes;
}
public function getFallbackDirs()
{
return $this->fallbackDirs;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of classes, merging with any others previously set.
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
* @param bool $prepend Prepend the location(s)
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirs = array_merge(
(array) $paths,
$this->fallbackDirs
);
} else {
$this->fallbackDirs = array_merge(
$this->fallbackDirs,
(array) $paths
);
}
return;
}
if (!isset($this->prefixes[$prefix])) {
$this->prefixes[$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixes[$prefix] = array_merge(
(array) $paths,
$this->prefixes[$prefix]
);
} else {
$this->prefixes[$prefix] = array_merge(
$this->prefixes[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of classes, replacing any others previously set.
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirs = (array) $paths;
return;
}
$this->prefixes[$prefix] = (array) $paths;
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True, if loaded
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
include $file;
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|null The path, if found
*/
public function findFile($class)
{
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR;
$className = substr($class, $pos + 1);
} else {
// PEAR-like class name
$classPath = null;
$className = $class;
}
$classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
foreach ($this->prefixes as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
}
}
foreach ($this->fallbackDirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
return $file;
}
return $this->classMap[$class] = false;
}
}

+ 9
- 0
vendor/composer/autoload_classmap.php View File

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

+ 11
- 0
vendor/composer/autoload_namespaces.php View File

@ -0,0 +1,11 @@
<?php
// autoload_namespaces.php generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'dflydev\\markdown' => $vendorDir . '/dflydev/markdown/src',
'Suin\\RSSWriter' => $vendorDir . '/suin/php-rss-writer/Source',
);

+ 43
- 0
vendor/composer/autoload_real.php View File

@ -0,0 +1,43 @@
<?php
// autoload_real.php generated by Composer
class ComposerAutoloaderInit352930101c1dc3fb72305f7934017105
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit352930101c1dc3fb72305f7934017105', 'loadClassLoader'));
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit352930101c1dc3fb72305f7934017105', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->add($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
return $loader;
}
}

+ 105
- 0
vendor/composer/installed.json View File

@ -0,0 +1,105 @@
[
{
"name": "dflydev/markdown",
"version": "v1.0.2",
"version_normalized": "1.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/dflydev/dflydev-markdown.git",
"reference": "v1.0.2"
},
"dist": {
"type": "zip",
"url": "https://github.com/dflydev/dflydev-markdown/zipball/v1.0.2",
"reference": "v1.0.2",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"time": "2012-01-15 19:36:37",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"dflydev\\markdown": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"New BSD License"
],
"authors": [
{
"name": "Dragonfly Development Inc.",
"email": "info@dflydev.com",
"homepage": "http://dflydev.com"
},
{
"name": "Beau Simensen",
"email": "beau@dflydev.com",
"homepage": "http://beausimensen.com"
},
{
"name": "Michel Fortin",
"homepage": "http://michelf.com"
},
{
"name": "John Gruber",
"homepage": "http://daringfireball.net"
}
],
"description": "PHP Markdown & Extra",
"homepage": "http://github.com/dflydev/dflydev-markdown",
"keywords": [
"markdown"
]
},
{
"name": "suin/php-rss-writer",
"version": "1.2",
"version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "git://github.com/suin/php-rss-writer.git",
"reference": "1.2"
},
"dist": {
"type": "zip",
"url": "https://github.com/suin/php-rss-writer/zipball/1.2",
"reference": "1.2",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"time": "2012-08-23 00:45:18",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"Suin\\RSSWriter": "Source"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "suin",
"email": "suinyeze@gmail.com",
"homepage": "https://www.facebook.com/suinyeze",
"role": "Developer, Renaming Specialist"
}
],
"description": "Yet another simple RSS writer library for PHP 5.3 or later.",
"homepage": "https://github.com/suin/php-rss-writer",
"keywords": [
"feed",
"generator",
"rss",
"writer"
]
}
]

+ 2
- 0
vendor/dflydev/markdown/.gitignore View File

@ -0,0 +1,2 @@
vendor
composer.lock

+ 7
- 0
vendor/dflydev/markdown/.travis.yml View File

@ -0,0 +1,7 @@
language: php
php:
- 5.3
- 5.4
before_script:
- wget -nc http://getcomposer.org/composer.phar
- php composer.phar update

+ 40
- 0
vendor/dflydev/markdown/LICENSE View File

@ -0,0 +1,40 @@
PHP Markdown & Extra
Copyright (c) 2011, Dragonfly Development Inc
All rights reserved.
Based on PHP Markdown & Extra
Copyright (c) 2004-2009 Michel Fortin
<http://michelf.com/>
All rights reserved.
Based on Markdown
Copyright (c) 2003-2006 John Gruber
<http://daringfireball.net/>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name "Markdown" nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
This software is provided by the copyright holders and contributors "as
is" and any express or implied warranties, including, but not limited
to, the implied warranties of merchantability and fitness for a
particular purpose are disclaimed. In no event shall the copyright owner
or contributors be liable for any direct, indirect, incidental, special,
exemplary, or consequential damages (including, but not limited to,
procurement of substitute goods or services; loss of use, data, or
profits; or business interruption) however caused and on any theory of
liability, whether in contract, strict liability, or tort (including
negligence or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.

+ 98
- 0
vendor/dflydev/markdown/README.md View File

@ -0,0 +1,98 @@
PHP Markdown & Extra
====================
An updated and stripped version of the original [PHP Markdown](http://michelf.com/projects/php-markdown/)
by [Michel Fortin](http://michelf.com/). Works quite well with PSR-0
autoloaders and is [Composer](http://packagist.org/) friendly.
Changes from the official PHP Markdown & Extra
----------------------------------------------
The initial pass at updating PHP Markdown & Extra left the core of
the code more or less intact but the changes to the organization
and naming were quite substantial. This effectively makes this package
a hard fork from Markdown 1.0.1n and MarkdownExtra 1.2.4.
Updated in the following ways:
* Moved parser classes into their own files
* Using PHP 5.3 namespaces
* Following [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) standards
* Replaced `@define` configuration variables with class `const` variables
* Integrated with [Travis CI](http://travis-ci.org/)
* Made [Composer](http://packagist.org/) friendly
Stripped in the following ways:
* No more embedded plugin code (WordPress, bBlog, etc.)
* No more top level function calls (`Markdown()`, etc.)
Last synced with:
* PHP Markdown v1.0.1o
* PHP Markdown Extra v1.2.5
Requirements
------------
* PHP 5.3+
Usage
-----
Simple usage for the standard Markdown ([details](http://michelf.com/projects/php-markdown/)) parser:
<?php
use dflydev\markdown\Markdown;
$markdownParser = new MarkdownParser();
// Will return <h1>Hello World</h1>
$markdownParser->transformMarkdown("#Hello World");
Simple usage for the Markdown Extra ([details](http://michelf.com/projects/php-markdown/extra/)) parser:
<?php
use dflydev\markdown\MarkdownExtra;
$markdownParser = new MarkdownExtraParser();
// Will return <h1>Hello World</h1>
$markdownParser->transformMarkdown("#Hello World");
License
-------
This library is licensed under the New BSD License - see the LICENSE file for details.
Community
---------
If you have questions or want to help out, join us in the
[#dflydev](irc://irc.freenode.net/#dflydev) channel on irc.freenode.net.
Not Invented Here
-----------------
The original [PHP Markdown](http://michelf.com/projects/php-markdown/) was
quite excellent but was not as easy to use as it could be in more modern PHP
applications. Having started to use [Composer](http://packagist.org/) for a
few newer applications that needed to transform Markdown, I decided to strip
and update the original PHP Markdown so that it could be more easily managed
by the likes of Composer.
All of the initial work done for this library (which I can only assume
was quite substantial after having looked at the code) was done by
[Michel Fortin](http://michelf.com/) during the original port from Perl to
PHP.
If you do not need to install PHP Markdown by way of Composer or need to
leverage PSR-0 autoloading, I suggest you continue to use the official and
likely more stable and well used original version of
[PHP Markdown](http://michelf.com/projects/php-markdown/)

+ 34
- 0
vendor/dflydev/markdown/composer.json View File

@ -0,0 +1,34 @@
{
"name": "dflydev/markdown",
"type": "library",
"description": "PHP Markdown & Extra",
"homepage": "http://github.com/dflydev/dflydev-markdown",
"keywords": ["markdown"],
"license": "New BSD License",
"authors": [
{
"name": "Dragonfly Development Inc.",
"email": "info@dflydev.com",
"homepage": "http://dflydev.com"
},
{
"name": "Beau Simensen",
"email": "beau@dflydev.com",
"homepage": "http://beausimensen.com"
},
{
"name": "Michel Fortin",
"homepage": "http://michelf.com"
},
{
"name": "John Gruber",
"homepage": "http://daringfireball.net"
}
],
"require": {
"php": ">=5.3"
},
"autoload": {
"psr-0": { "dflydev\\markdown": "src" }
}
}

+ 28
- 0
vendor/dflydev/markdown/phpunit.xml.dist View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="dflydev-markdown Test Suite">
<directory>./tests/dflydev/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/dflydev/</directory>
<exclude>
<directory>./src/dflydev/*/resources</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

+ 23
- 0
vendor/dflydev/markdown/src/dflydev/markdown/IMarkdownParser.php View File

@ -0,0 +1,23 @@
<?php
/*
* This file is a part of the PHP Markdown library.
*
* (c) Dragonfly Development Inc.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace dflydev\markdown;
interface IMarkdownParser {
/**
* Transform Markdown text to HTML.
* @param string $text
* @return string
*/
public function transformMarkdown($text);
}

+ 1359
- 0
vendor/dflydev/markdown/src/dflydev/markdown/MarkdownExtraParser.php
File diff suppressed because it is too large
View File


+ 1529
- 0
vendor/dflydev/markdown/src/dflydev/markdown/MarkdownParser.php
File diff suppressed because it is too large
View File


+ 12
- 0
vendor/dflydev/markdown/tests/bootstrap.php View File

@ -0,0 +1,12 @@
<?php
/*
* This file is a part of the PHP Markdown library.
*
* (c) Dragonfly Development Inc.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$loader = require dirname(__DIR__).'/vendor/.composer/autoload.php';
$loader->add('dflydev\\tests\\markdown', 'tests');

+ 34
- 0
vendor/dflydev/markdown/tests/dflydev/tests/markdown/MarkdownExtraParserTest.php View File

@ -0,0 +1,34 @@
<?php
/*
* This file is a part of the PHP Markdown library.
*
* (c) Dragonfly Development Inc.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace dflydev\tests\markdown;
use dflydev\markdown\MarkdownExtraParser;
class MarkdownExtraParserTest extends MarkdownParserTest
{
protected $configKeyTabWidth = \dflydev\markdown\MarkdownExtraParser::CONFIG_TAB_WIDTH;
/**
* Create a markdown parser.
* @param array $configuration Optional configuration
* @return \dflydev\markdown\IMarkdownParser
*/
public function createParser($configuration = null)
{
if ($configuration !== null) {
return new \dflydev\markdown\MarkdownExtraParser($configuration);
}
return new \dflydev\markdown\MarkdownExtraParser();
}
}

+ 73
- 0
vendor/dflydev/markdown/tests/dflydev/tests/markdown/MarkdownParserTest.php View File

@ -0,0 +1,73 @@
<?php
/*
* This file is a part of the PHP Markdown library.
*
* (c) Dragonfly Development Inc.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace dflydev\tests\markdown;
use dflydev\markdown\MarkdownParser;
class MarkdownParserTest extends \PHPUnit_Framework_TestCase
{
protected $configKeyTabWidth = \dflydev\markdown\MarkdownParser::CONFIG_TAB_WIDTH;
/**
* Create a markdown parser.
* @param array $configuration Optional configuration
* @return \dflydev\markdown\IMarkdownParser
*/
public function createParser($configuration = null)
{
if ( $configuration !== null ) {
return new \dflydev\markdown\MarkdownParser($configuration);
}
return new \dflydev\markdown\MarkdownParser();
}
/**
* Simple test to ensure that parser can be created and most basic of
* Markdown can be transformed.
*/
public function testCreate()
{
$markdownParser = $this->createParser();
$html = $markdownParser->transformMarkdown('#Hello World');
$this->assertEquals("<h1>Hello World</h1>\n", $html, 'Simple H1 works');
}
/**
* Test tab width for code blocks
*/
public function testTabWidth()
{
$markdownParser = $this->createParser();
$html = $markdownParser->transformMarkdown(' Hello World');
$this->assertEquals("<pre><code>Hello World\n</code></pre>\n", $html, 'Default 4 space tab code block works');
$this->configureTabWidth($markdownParser, 6);
$html = $markdownParser->transformMarkdown(' Hello World');
$this->assertEquals("<p>Hello World</p>\n", $html, 'Default 4 space tab code block not triggered when tab width set to 6');
$html = $markdownParser->transformMarkdown(' Hello World');
$this->assertEquals("<pre><code>Hello World\n</code></pre>\n", $html, 'Setting 6 space tab code block (via method) works');
$markdownParser = $this->createParser(array($this->configKeyTabWidth => 8));
$html = $markdownParser->transformMarkdown(' Hello World');
$this->assertEquals("<pre><code>Hello World\n</code></pre>\n", $html, 'Setting 8 space tab code block (via constructor) works');
}
/**
* Configure a Markdown parser for a specific tab width
* @param \dflydev\markdown\MarkdownParser $markdownParser
* @param integer $width
*/
protected function configureTabWidth(MarkdownParser $markdownParser, $width)
{
$markdownParser->configureMarkdownParser($this->configKeyTabWidth, $width);
}
}

+ 3
- 0
vendor/suin/php-rss-writer/.gitignore View File

@ -0,0 +1,3 @@
.idea/
.phpmake
.DS_Store

+ 11
- 0
vendor/suin/php-rss-writer/.travis.yml View File

@ -0,0 +1,11 @@
language: php
php:
- 5.3
- 5.4
before_script:
- cd Tests
- wget http://getcomposer.org/composer.phar
- php composer.phar install
script: ./phpunit --coverage-text --configuration phpunit.xml.dist

+ 84
- 0
vendor/suin/php-rss-writer/README.md View File

@ -0,0 +1,84 @@
# \Suin\RSSWriter
`\Suin\RSSWriter` is yet another simple RSS writer library for PHP 5.3 or later. This component is Licensed under MIT license.
The build status of the current master branch is tracked by Travis CI: [![Build Status](https://secure.travis-ci.org/suin/php-rss-writer.png?branch=master)](http://travis-ci.org/suin/php-rss-writer)
Implementation:
```php
<?php
$feed = new Feed();
$channel = new Channel();
$channel
->title("Channel Title")
->description("Channel Description")
->url('http://blog.example.com')
->appendTo($feed);
$item = new Item();
$item
->title("Blog Entry Title")
->description("<div>Blog body</div>")
->url('http://blog.example.com/2012/08/21/blog-entry/')
->appendTo($channel);
echo $feed;
```
Output:
```xml
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Channel Title</title>
<link>http://blog.example.com</link>
<description>Channel Description</description>
<item>
<title>Blog Entry Title</title>
<link>http://blog.example.com/2012/08/21/blog-entry/</link>
<description>&lt;div&gt;Blog body&lt;/div&gt;</description>
</item>
</channel>
</rss>
```
## Installation
You can install via Composer.
At first create `composer.json` file:
```json
{
"require": {
"suin/php-rss-writer": ">=1.0"
}
}
```
Run composer to install.
```
$ composer install
```
Finally, include `vendor/autoload.php` in your product.
```
require_once 'vendor/autoload.php';
```
## How to Use
`example.php` is an example usage of RSSWriter.
If you want to know APIs, please see `FeedInterface`, `ChannelInterface` and `ItemInterface`.
## License
MIT license

+ 189
- 0
vendor/suin/php-rss-writer/Source/Suin/RSSWriter/Channel.php View File

@ -0,0 +1,189 @@
<?php
namespace Suin\RSSWriter;
use \Suin\RSSWriter\SimpleXMLElement;
class Channel implements \Suin\RSSWriter\ChannelInterface
{
/** @var string */
protected $title;
/** @var string */
protected $url;
/** @var string */
protected $description;
/** @var string */
protected $language;
/** @var string */
protected $copyright;
/** @var int */
protected $pubDate;
/** @var int */
protected $lastBuildDate;
/** @var int */
protected $ttl;
/** @var \Suin\RSSWriter\ItemInterface[] */
protected $items = array();
/**
* Set channel title
* @param string $title
* @return $this
*/
public function title($title)
{
$this->title = $title;
return $this;
}
/**
* Set channel URL
* @param string $url
* @return $this
*/
public function url($url)
{
$this->url = $url;
return $this;
}
/**
* Set channel description
* @param string $description
* @return $this
*/
public function description($description)
{
$this->description = $description;
return $this;
}
/**
* Set ISO639 language code
*
* The language the channel is written in. This allows aggregators to group all
* Italian language sites, for example, on a single page. A list of allowable
* values for this element, as provided by Netscape, is here. You may also use
* values defined by the W3C.
*
* @param string $language
* @return $this
*/
public function language($language)
{
$this->language = $language;
return $this;
}
/**
* Set channel copyright
* @param string $copyright
* @return $this
*/
public function copyright($copyright)
{
$this->copyright = $copyright;
return $this;
}
/**
* Set channel published date
* @param int $pubDate Unix timestamp
* @return $this
*/
public function pubDate($pubDate)
{
$this->pubDate = $pubDate;
return $this;
}
/**
* Set channel last build date
* @param int $lastBuildDate Unix timestamp
* @return $this
*/
public function lastBuildDate($lastBuildDate)
{
$this->lastBuildDate = $lastBuildDate;
return $this;
}
/**
* Set channel ttl (minutes)
* @param int $ttl
* @return $this
*/
public function ttl($ttl)
{
$this->ttl = $ttl;
return $this;
}
/**
* Add item object
* @param \Suin\RSSWriter\ItemInterface $item
* @return $this
*/
public function addItem(ItemInterface $item)
{
$this->items[] = $item;
return $this;
}
/**
* Append to feed
* @param \Suin\RSSWriter\FeedInterface $feed
* @return $this
*/
public function appendTo(FeedInterface $feed)
{
$feed->addChannel($this);
return $this;
}
/**
* Return XML object
* @return \Suin\RSSWriter\SimpleXMLElement
*/
public function asXML()
{
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel></channel>', LIBXML_NOERROR|LIBXML_ERR_NONE|LIBXML_ERR_FATAL);
$xml->addChild('title', $this->title);
$xml->addChild('link', $this->url);
$xml->addChild('description', $this->description);
if ( $this->language !== null )
{
$xml->addChild('language', $this->language);
}
if ( $this->copyright !== null )
{
$xml->addChild('copyright', $this->copyright);
}
if ( $this->pubDate !== null )
{
$xml->addChild('pubDate', date(DATE_RSS, $this->pubDate));
}
if ( $this->lastBuildDate !== null )
{
$xml->addChild('lastBuildDate', date(DATE_RSS, $this->lastBuildDate));
}
if ( $this->ttl !== null )
{
$xml->addChild('ttl', $this->ttl);
}
foreach ( $this->items as $item )
{
$toDom = dom_import_simplexml($xml);
$fromDom = dom_import_simplexml($item->asXML());
$toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true));
}
return $xml;
}
}

+ 91
- 0
vendor/suin/php-rss-writer/Source/Suin/RSSWriter/ChannelInterface.php View File

@ -0,0 +1,91 @@
<?php
namespace Suin\RSSWriter;
use \Suin\RSSWriter\FeedInterface;
use \Suin\RSSWriter\ItemInterface;
interface ChannelInterface
{
/**
* Set channel title
* @param string $title
* @return $this
*/
public function title($title);
/**
* Set channel URL
* @param string $url
* @return $this
*/
public function url($url);
/**
* Set channel description
* @param string $description
* @return $this
*/
public function description($description);
/**
* Set ISO639 language code
*
* The language the channel is written in. This allows aggregators to group all
* Italian language sites, for example, on a single page. A list of allowable
* values for this element, as provided by Netscape, is here. You may also use
* values defined by the W3C.
*
* @param string $language
* @return $this
*/
public function language($language);
/**
* Set channel copyright
* @param string $copyright
* @return $this
*/
public function copyright($copyright);
/**
* Set channel published date
* @param int $pubDate Unix timestamp
* @return $this
*/
public function pubDate($pubDate);
/**
* Set channel last build date
* @param int $lastBuildDate Unix timestamp
* @return $this
*/
public function lastBuildDate($lastBuildDate);
/**
* Set channel ttl (minutes)
* @param int $ttl
* @return $this
*/
public function ttl($ttl);
/**
* Add item object
* @param \Suin\RSSWriter\ItemInterface $item
* @return $this
*/
public function addItem(ItemInterface $item);
/**
* Append to feed
* @param \Suin\RSSWriter\FeedInterface $feed
* @return $this
*/
public function appendTo(FeedInterface $feed);
/**
* Return XML object
* @return \Suin\RSSWriter\SimpleXMLElement
*/
public function asXML();
}

+ 54
- 0
vendor/suin/php-rss-writer/Source/Suin/RSSWriter/Feed.php View File

@ -0,0 +1,54 @@
<?php
namespace Suin\RSSWriter;
use \DOMDocument;
use \Suin\RSSWriter\ChannelInterface;
use \Suin\RSSWriter\SimpleXMLElement;
class Feed implements \Suin\RSSWriter\FeedInterface
{
/** @var \Suin\RSSWriter\ChannelInterface[] */
protected $channels = array();
/**
* Add channel
* @param \Suin\RSSWriter\ChannelInterface $channel
* @return $this
*/
public function addChannel(ChannelInterface $channel)
{
$this->channels[] = $channel;
return $this;
}
/**
* Render XML
* @return string
*/
public function render()
{
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0" />', LIBXML_NOERROR|LIBXML_ERR_NONE|LIBXML_ERR_FATAL);
foreach ( $this->channels as $channel )
{
$toDom = dom_import_simplexml($xml);
$fromDom = dom_import_simplexml($channel->asXML());
$toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true));
}
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->appendChild($dom->importNode(dom_import_simplexml($xml), true));
$dom->formatOutput = true;
return $dom->saveXML();
}
/**
* Render XML
* @return string
*/
public function __toString()
{
return $this->render();
}
}

+ 27
- 0
vendor/suin/php-rss-writer/Source/Suin/RSSWriter/FeedInterface.php View File

@ -0,0 +1,27 @@
<?php
namespace Suin\RSSWriter;
use \Suin\RSSWriter\ChannelInterface;
interface FeedInterface
{
/**
* Add channel
* @param \Suin\RSSWriter\ChannelInterface $channel
* @return $thisJ
*/
public function addChannel(ChannelInterface $channel);
/**
* Render XML
* @return string
*/
public function render();
/**
* Render XML
* @return string
*/
public function __toString();
}

+ 142
- 0
vendor/suin/php-rss-writer/Source/Suin/RSSWriter/Item.php View File

@ -0,0 +1,142 @@
<?php
namespace Suin\RSSWriter;
use \Suin\RSSWriter\SimpleXMLElement;
class Item implements \Suin\RSSWriter\ItemInterface
{
/** @var string */
protected $title;
/** @var string */
protected $url;
/** @var string */
protected $description;
/** @var array */
protected $categories = array();
/** @var string */
protected $guid;
/** @var bool */
protected $isPermalink;
/** @var int */
protected $pubDate;
/**
* Set item title
* @param string $title
* @return $this
*/
public function title($title)
{
$this->title = $title;
return $this;
}
/**
* Set item URL
* @param string $url
* @return $this
*/
public function url($url)
{
$this->url = $url;
return $this;
}
/**
* Set item description
* @param string $description
* @return $this
*/
public function description($description)
{
$this->description = $description;
return $this;
}
/**
* Set item category
* @param string $name Category name
* @param string $domain Category URL
* @return $this
*/
public function category($name, $domain = null)
{
$this->categories[] = array($name, $domain);
return $this;
}
/**
* Set GUID
* @param string $guid
* @param bool $isPermalink
* @return $this
*/
public function guid($guid, $isPermalink = false)
{
$this->guid = $guid;
$this->isPermalink = $isPermalink;
return $this;
}
/**
* Set published date
* @param int $pubDate Unix timestamp
* @return $this
*/
public function pubDate($pubDate)
{
$this->pubDate = $pubDate;
return $this;
}
/**
* Append item to the channel
* @param \Suin\RSSWriter\ChannelInterface $channel
* @return $this
*/
public function appendTo(ChannelInterface $channel)
{
$channel->addItem($this);
return $this;
}
/**
* Return XML object
* @return \Suin\RSSWriter\SimpleXMLElement
*/
public function asXML()
{
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item></item>', LIBXML_NOERROR|LIBXML_ERR_NONE|LIBXML_ERR_FATAL);
$xml->addChild('title', $this->title);
$xml->addChild('link', $this->url);
$xml->addChild('description', $this->description);
foreach ( $this->categories as $category )
{
$element = $xml->addChild('category', $category[0]);
if ( isset($category[1]) )
{
$element->addAttribute('domain', $category[1]);
}
}
if ( $this->guid )
{
$guid = $xml->addChild('guid', $this->guid);
if ( $this->isPermalink )
{
$guid->addAttribute('isPermaLink', 'true');
}
}
if ( $this->pubDate !== null )
{
$xml->addChild('pubDate', date(DATE_RSS, $this->pubDate));
}
return $xml;
}
}

+ 66
- 0
vendor/suin/php-rss-writer/Source/Suin/RSSWriter/ItemInterface.php View File

@ -0,0 +1,66 @@
<?php
namespace Suin\RSSWriter;
use \Suin\RSSWriter\ChannelInterface;
use \Suin\RSSWriter\SimpleXMLElement;
interface ItemInterface
{
/**
* Set item title
* @param string $title
* @return $this
*/
public function title($title);
/**
* Set item URL
* @param string $url
* @return $this
*/
public function url($url);
/**
* Set item description
* @param string $description
* @return $this
*/
public function description($description);
/**
* Set item category
* @param string $name Category name
* @param string $domain Category URL
* @return $this
*/
public function category($name, $domain = null);
/**
* Set GUID
* @param string $guid
* @param bool $isPermalink
* @return $this
*/
public function guid($guid, $isPermalink = false);
/**
* Set published date
* @param int $pubDate Unix timestamp
* @return $this
*/
public function pubDate($pubDate);
/**
* Append item to the channel
* @param \Suin\RSSWriter\ChannelInterface $channel
* @return $this
*/
public function appendTo(ChannelInterface $channel);
/**
* Return XML object
* @return \Suin\RSSWriter\SimpleXMLElement
*/
public function asXML();
}

+ 16
- 0
vendor/suin/php-rss-writer/Source/Suin/RSSWriter/SimpleXMLElement.php View File

@ -0,0 +1,16 @@
<?php
namespace Suin\RSSWriter;
class SimpleXMLElement extends \SimpleXMLElement
{
public function addChild($name, $value = null, $namespace = null)
{
if ( $value !== null and is_string($value) === true )
{
$value = str_replace('&', '&amp;', $value);
}
return parent::addChild($name, $value, $namespace);
}
}

+ 10
- 0
vendor/suin/php-rss-writer/Tests/.gitignore View File

@ -0,0 +1,10 @@
Coverage/
Vendor/*
/composer.lock
/dbunit
/phpcov
/phpcpd
/phpdcd
/phploc
/phpunit
/phpunit-skelgen

+ 8
- 0
vendor/suin/php-rss-writer/Tests/Bootstrap.php View File

@ -0,0 +1,8 @@
<?php
// For composer
require_once 'Vendor/autoload.php';
// Load test target classes
spl_autoload_register(function($c) { @include_once strtr($c, '\\_', '//').'.php'; });
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__DIR__).'/Source');

+ 28
- 0
vendor/suin/php-rss-writer/Tests/README.md View File

@ -0,0 +1,28 @@
# How to Test
## Installation
Install [composer](https://github.com/composer/composer) to your ~/bin:
```sh
$ curl -s http://getcomposer.org/installer | php
```
Run composer and install depending packages:
```sh
$ composer.phar install
```
## Executing Tests
Run phpunit:
```sh
$ ./phpunit
```
## View Reports
If you want to see code coverages, open Coverage/index.html.

+ 252
- 0
vendor/suin/php-rss-writer/Tests/Suin/RSSWriter/ChannelTest.php View File

@ -0,0 +1,252 @@
<?php
namespace Suin\RSSWriter;
class ChannelTest extends \XoopsUnit\TestCase
{
private $itemInterface = '\Suin\RSSWriter\ItemInterface';
private $feedInterface = '\Suin\RSSWriter\FeedInterface';
public function testTitle()
{
$title = uniqid();
$channel = new Channel();
$this->assertSame($channel, $channel->title($title));
$this->assertAttributeSame($title, 'title', $channel);
}
public function testUrl()
{
$url = uniqid();
$channel = new Channel();
$this->assertSame($channel, $channel->url($url));
$this->assertAttributeSame($url, 'url', $channel);
}
public function testDescription()
{
$description = uniqid();
$channel = new Channel();
$this->assertSame($channel, $channel->description($description));
$this->assertAttributeSame($description, 'description', $channel);
}
public function testLanguage()
{
$language = uniqid();
$channel = new Channel();
$this->assertSame($channel, $channel->language($language));
$this->assertAttributeSame($language, 'language', $channel);
}
public function testCopyright()
{
$copyright = uniqid();
$channel = new Channel();
$this->assertSame($channel, $channel->copyright($copyright));
$this->assertAttributeSame($copyright, 'copyright', $channel);
}
public function testPubDate()
{
$pubDate = mt_rand(0, 9999999);
$channel = new Channel();
$this->assertSame($channel, $channel->pubDate($pubDate));
$this->assertAttributeSame($pubDate, 'pubDate', $channel);
}
public function testLastBuildDate()
{
$lastBuildDate = mt_rand(0, 9999999);
$channel = new Channel();
$this->assertSame($channel, $channel->lastBuildDate($lastBuildDate));
$this->assertAttributeSame($lastBuildDate, 'lastBuildDate', $channel);
}
public function testTtl()
{
$ttl = mt_rand(0, 99999999);
$channel = new Channel();
$this->assertSame($channel, $channel->ttl($ttl));
$this->assertAttributeSame($ttl, 'ttl', $channel);
}
public function testAddItem()
{
$item = $this->getMock($this->itemInterface);
$channel = new Channel();
$this->assertSame($channel, $channel->addItem($item));
$this->assertAttributeSame(array($item), 'items', $channel);
}
public function testAppendTo()
{
$channel = new Channel();
$feed = $this->getMock($this->feedInterface);
$feed->expects($this->once())->method('addChannel')->with($channel);
$this->assertSame($channel, $channel->appendTo($feed));
}
/**
* @param $expect
* @param array $data
* @dataProvider dataForAsXML
*/
public function testAsXML($expect, array $data)
{
$data = (object) $data;
$channel = new Channel();
foreach ( $data as $key => $value )
{
$this->reveal($channel)->attr($key, $value);
}
$this->assertXmlStringEqualsXmlString($expect, $channel->asXML()->asXML());
}
public static function dataForAsXML()
{
$now = time();
$nowString = date(DATE_RSS, $now);
return array(
array(
"
<channel>
<title>GoUpstate.com News Headlines</title>
<link>http://www.goupstate.com/</link>
<description>The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.</description>
</channel>
",
array(
'title' => "GoUpstate.com News Headlines",
'url' => 'http://www.goupstate.com/',
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
)
),
array(
"
<channel>
<title>GoUpstate.com News Headlines</title>
<link>http://www.goupstate.com/</link>
<description>The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.</description>
<language>en-us</language>
</channel>
",
array(
'title' => "GoUpstate.com News Headlines",
'url' => 'http://www.goupstate.com/',
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
'language' => 'en-us',
)
),
array(
"
<channel>
<title>GoUpstate.com News Headlines</title>
<link>http://www.goupstate.com/</link>
<description>The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.</description>
<pubDate>{$nowString}</pubDate>
</channel>
",
array(
'title' => "GoUpstate.com News Headlines",
'url' => 'http://www.goupstate.com/',
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
'pubDate' => $now,
)
),
array(
"
<channel>
<title>GoUpstate.com News Headlines</title>
<link>http://www.goupstate.com/</link>
<description>The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.</description>
<lastBuildDate>{$nowString}</lastBuildDate>
</channel>
",
array(
'title' => "GoUpstate.com News Headlines",
'url' => 'http://www.goupstate.com/',
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
'lastBuildDate' => $now,
)
),
array(
"
<channel>
<title>GoUpstate.com News Headlines</title>
<link>http://www.goupstate.com/</link>
<description>The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.</description>
<ttl>60</ttl>
</channel>
",
array(
'title' => "GoUpstate.com News Headlines",
'url' => 'http://www.goupstate.com/',
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
'ttl' => 60,
)
),
array(
"
<channel>
<title>GoUpstate.com News Headlines</title>
<link>http://www.goupstate.com/</link>
<description>The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.</description>
<copyright>Copyright 2002, Spartanburg Herald-Journal</copyright>
</channel>
",
array(
'title' => "GoUpstate.com News Headlines",
'url' => 'http://www.goupstate.com/',
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
'copyright' => "Copyright 2002, Spartanburg Herald-Journal",
)
),
);
}
public function testAppendTo_with_items()
{
$channel = new Channel();
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item><title>item1</title></item>');
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item><title>item2</title></item>');
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item><title>item3</title></item>');
$item1 = $this->getMock($this->itemInterface);
$item1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
$item2= $this->getMock($this->itemInterface);
$item2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
$item3 = $this->getMock($this->itemInterface);
$item3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
$this->reveal($channel)
->attr('title', "GoUpstate.com News Headlines")
->attr('url', 'http://www.goupstate.com/')
->attr('description', "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.")
->attr('items', array($item1, $item2, $item3));
$expect = '<?xml version="1.0" encoding="UTF-8" ?>
<channel>
<title>GoUpstate.com News Headlines</title>
<link>http://www.goupstate.com/</link>
<description>The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.</description>
<item>
<title>item1</title>
</item>
<item>
<title>item2</title>
</item>
<item>
<title>item3</title>
</item>
</channel>
';
$this->assertXmlStringEqualsXmlString($expect, $channel->asXML()->asXML());
}
}

+ 96
- 0
vendor/suin/php-rss-writer/Tests/Suin/RSSWriter/FeedTest.php View File

@ -0,0 +1,96 @@
<?php
namespace Suin\RSSWriter;
use \Mockery;
class FeedTest extends \XoopsUnit\TestCase
{
private $channelInterface = '\Suin\RSSWriter\ChannelInterface';
public function testAddChannel()
{
$channel = Mockery::mock($this->channelInterface);
$feed = new Feed();
$this->assertSame($feed, $feed->addChannel($channel));
$this->assertAttributeSame(array($channel), 'channels', $feed);
}
public function testRender()
{
$feed = new Feed();
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel1</title></channel>');
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel2</title></channel>');
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel3</title></channel>');
$channel1 = $this->getMock($this->channelInterface);
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
$channel2 = $this->getMock($this->channelInterface);
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
$channel3 = $this->getMock($this->channelInterface);
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
$this->reveal($feed)->attr('channels', array($channel1, $channel2, $channel3));
$expect = '<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel><title>channel1</title></channel>
<channel><title>channel2</title></channel>
<channel><title>channel3</title></channel>
</rss>
';
$this->assertXmlStringEqualsXmlString($expect, $feed->render());
}
public function testRender_with_japanese()
{
$feed = new Feed();
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語1</title></channel>');
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語2</title></channel>');
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語3</title></channel>');
$channel1 = $this->getMock($this->channelInterface);
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
$channel2 = $this->getMock($this->channelInterface);
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
$channel3 = $this->getMock($this->channelInterface);
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
$this->reveal($feed)->attr('channels', array($channel1, $channel2, $channel3));
$expect = <<< 'XML'
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>日本語1</title>
</channel>
<channel>
<title>日本語2</title>
</channel>
<channel>
<title>日本語3</title>
</channel>
</rss>
XML;
$this->assertSame($expect, $feed->render());
}
public function test__toString()
{
$feed = new Feed();
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel1</title></channel>');
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel2</title></channel>');
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel3</title></channel>');
$channel1 = $this->getMock($this->channelInterface);
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
$channel2 = $this->getMock($this->channelInterface);
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
$channel3 = $this->getMock($this->channelInterface);
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
$this->reveal($feed)->attr('channels', array($channel1, $channel2, $channel3));
$expect = '<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel><title>channel1</title></channel>
<channel><title>channel2</title></channel>
<channel><title>channel3</title></channel>
</rss>
';
$this->assertXmlStringEqualsXmlString($expect, $feed);
}
}

+ 186
- 0
vendor/suin/php-rss-writer/Tests/Suin/RSSWriter/ItemTest.php View File

@ -0,0 +1,186 @@
<?php
namespace Suin\RSSWriter;
class ItemTest extends \XoopsUnit\TestCase
{
private $channelInterface = '\Suin\RSSWriter\ChannelInterface';
public function testTitle()
{
$title = uniqid();
$item = new Item();
$this->assertSame($item, $item->title($title));
$this->assertAttributeSame($title, 'title', $item);
}
public function testUrl()
{
$url = uniqid();
$item = new Item();
$this->assertSame($item, $item->url($url));
$this->assertAttributeSame($url, 'url', $item);
}
public function testDescription()
{
$description = uniqid();
$item = new Item();
$this->assertSame($item, $item->description($description));
$this->assertAttributeSame($description, 'description', $item);
}
public function testCategory()
{
$category = uniqid();
$item = new Item();
$this->assertSame($item, $item->category($category));
$this->assertAttributeSame(array(
array($category, null),
), 'categories', $item);
}
public function testCategory_with_domain()
{
$category = uniqid();
$domain = uniqid();
$item = new Item();
$this->assertSame($item, $item->category($category, $domain));
$this->assertAttributeSame(array(
array($category, $domain),
), 'categories', $item);
}
public function testGuid()
{
$guid = uniqid();
$item = new Item();
$this->assertSame($item, $item->guid($guid));
$this->assertAttributeSame($guid, 'guid', $item);
}
public function testGuid_with_permalink()
{
$item = new Item();
$item->guid('guid', true);
$this->assertAttributeSame(true, 'isPermalink', $item);
$item->guid('guid', false);
$this->assertAttributeSame(false, 'isPermalink', $item);
$item->guid('guid'); // default
$this->assertAttributeSame(false, 'isPermalink', $item);
}
public function testPubDate()
{
$pubDate = mt_rand(1000000, 9999999);
$item = new Item();
$this->assertSame($item, $item->pubDate($pubDate));
$this->assertAttributeSame($pubDate, 'pubDate', $item);
}
public function testAppendTo()
{
$item = new Item();
$channel = $this->getMock($this->channelInterface);
$channel->expects($this->once())->method('addItem')->with($item);
$this->assertSame($item, $item->appendTo($channel));
}
public function testAsXML()
{
$now = time();
$nowString = date(DATE_RSS, $now);
$data = array(
'title' => "Venice Film Festival Tries to Quit Sinking",
'url' => 'http://nytimes.com/2004/12/07FEST.html',
'description' => "Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.",
'categories' => array(
array("Grateful Dead", null),
array("MSFT", 'http://www.fool.com/cusips'),
),
'guid' => "http://inessential.com/2002/09/01.php#a2",
'isPermalink' => true,
'pubDate' => $now,
);
$item = new Item();
foreach ( $data as $key => $value )
{
$this->reveal($item)->attr($key, $value);
}
$expect ="
<item>
<title>{$data['title']}</title>
<link>{$data['url']}</link>
<description>{$data['description']}</description>
<category>{$data['categories'][0][0]}</category>
<category domain=\"{$data['categories'][1][1]}\">{$data['categories'][1][0]}</category>
<guid isPermaLink=\"true\">{$data['guid']}</guid>
<pubDate>{$nowString}</pubDate>
</item>
";
$this->assertXmlStringEqualsXmlString($expect, $item->asXML()->asXML());
}
public function testAsXML_test_Japanese()
{
$now = time();
$nowString = date(DATE_RSS, $now);
$data = array(
'title' => "日本語",
'url' => 'http://nytimes.com/2004/12/07FEST.html',
'description' => "Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.",
);
$item = new Item();
foreach ( $data as $key => $value )
{
$this->reveal($item)->attr($key, $value);
}
$expect = "
<item>
<title>{$data['title']}</title>
<link>{$data['url']}</link>
<description>{$data['description']}</description>
</item>
";
$this->assertXmlStringEqualsXmlString($expect, $item->asXML()->asXML());
}
public function test_with_amp()
{
$item = new Item();
$item
->title('test&test')
->url('url&url')
->description('desc&desc');
$expect = '<?xml version="1.0" encoding="UTF-8"?>
<item><title>test&amp;test</title><link>url&amp;url</link><description>desc&amp;desc</description></item>
';
$this->assertSame($expect, $item->asXML()->asXML());
}
public function test_fail_safe_against_invalid_string()
{
$item = new Item();
$item
->title("test\0test")
->url("url\0test")
->description("desc\0desc");
$expect = '<?xml version="1.0" encoding="UTF-8"?>
<item><title>test</title><link>url</link><description>desc</description></item>
';
$this->assertSame($expect, $item->asXML()->asXML());
}
}

+ 12
- 0
vendor/suin/php-rss-writer/Tests/composer.json View File

@ -0,0 +1,12 @@
{
"config": {
"bin-dir": ".",
"vendor-dir": "Vendor"
},
"require": {
"php": ">=5.3.2",
"EHER/PHPUnit": ">=1.6",
"suin/xoopsunit": ">=1.2",
"mockery/mockery": ">=0.7.2"
}
}

+ 42
- 0
vendor/suin/php-rss-writer/Tests/phpunit.xml.dist View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="Bootstrap.php"
processIsolation="false"
verbose="true"
strict="false"
colors="true">
<testsuites>
<testsuite name="PHPUnit">
<directory>Suin</directory>
</testsuite>
</testsuites>
<logging>
<log
type="coverage-html"
target="Coverage"
charset="UTF-8"
yui="true"
highlight="false"
lowUpperBound="35"
highLowerBound="70" />
<!-- <log type="coverage-text" target="php://stdout" lowUpperBound="35" highLowerBound="70" /> -->
</logging>
<filter>
<whitelist>
<directory suffix=".php">../Source</directory>
<!-- <file>/path/to/file</file> -->
<exclude>
<file>../Public/index.php</file>
<directory suffix="Interface.php">../Source</directory>
</exclude>
</whitelist>
<blacklist>
<directory suffix=".php" group="PHPUNIT">../Vendor</directory>
</blacklist>
</filter>
<listeners>
<listener class="\Mockery\Adapter\Phpunit\TestListener" file="Vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php" />
</listeners>
</phpunit>

+ 20
- 0
vendor/suin/php-rss-writer/composer.json View File

@ -0,0 +1,20 @@
{
"name": "suin/php-rss-writer",
"type": "library",
"description": "Yet another simple RSS writer library for PHP 5.3 or later.",
"keywords": ["rss", "generator", "writer", "feed"],
"homepage": "https://github.com/suin/php-rss-writer",
"license": "MIT",
"authors": [
{
"name": "Hidehito Nozawa aka Suin",
"email": "suinyeze@gmail.com"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-0": { "Suin\\RSSWriter": "Source" }
}
}

+ 35
- 0
vendor/suin/php-rss-writer/example.php View File

@ -0,0 +1,35 @@
<?php
// Load test target classes
spl_autoload_register(function($c) { @include_once strtr($c, '\\_', '//').'.php'; });
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__.'/Source');
use \Suin\RSSWriter\Feed;
use \Suin\RSSWriter\Channel;
use \Suin\RSSWriter\Item;
$feed = new Feed();
$channel = new Channel();
$channel
->title("Channel Title")
->description("Channel Description")
->url('http://blog.example.com')
->language('en-US')
->copyright('Copyright 2012, Foo Bar')
->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
->lastBuildDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
->ttl(60)
->appendTo($feed);
$item = new Item();
$item
->title("Blog Entry Title")
->description("<div>Blog body</div>")
->url('http://blog.example.com/2012/08/21/blog-entry/')
->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
->guid('http://blog.example.com/2012/08/21/blog-entry/', true)
->appendTo($channel);
echo $feed; // or echo $feed->render();

Loading…
Cancel
Save