commit 6f2f38ad551bb788d62c5091a634c3ed4d33245c Author: Aaron Lindsay Date: Thu Feb 24 12:25:26 2011 -0700 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7fa9830 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +#wordpress directory +home/ + +cgi-bin/ + +#lots of binaries, don't need those in the repo +chronos/ + +#kept elsewhere +Resume.pdf +Resume.tex diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..ab5ca6a --- /dev/null +++ b/.htaccess @@ -0,0 +1,9 @@ +# Use PHP5 Single php.ini as default +AddHandler application/x-httpd-php5s .php + +#Custom error pages +ErrorDocument 400 /errors/400.php +ErrorDocument 401 /errors/401.php +ErrorDocument 403 /errors/403.php +ErrorDocument 404 /errors/404.php +ErrorDocument 500 /errors/500.php diff --git a/about/index.php b/about/index.php new file mode 100644 index 0000000..c1a5b58 --- /dev/null +++ b/about/index.php @@ -0,0 +1,21 @@ + +About Me - aclindsay.com + + +
+
+

About Me

+ +

I am a Lutheran, an Eagle Scout, and am currently pursuing a masters degree in Computer Science at Virginia Tech.

+
+ +
+ + diff --git a/acal/.htaccess b/acal/.htaccess new file mode 100644 index 0000000..b3970c1 --- /dev/null +++ b/acal/.htaccess @@ -0,0 +1,2 @@ +# Use PHP5 as default +AddHandler application/x-httpd-php5 .php diff --git a/acal/favicon.ico b/acal/favicon.ico new file mode 100644 index 0000000..85a4d9f Binary files /dev/null and b/acal/favicon.ico differ diff --git a/acal/index.php b/acal/index.php new file mode 100644 index 0000000..6a39611 --- /dev/null +++ b/acal/index.php @@ -0,0 +1,37 @@ + +aCal - aclindsay.com + + +
+
+

aCal Project

+ +

aCal is very much still a work in progress. I have not yet posted any code.

+ +

Aim

+ +

The eventual goal of this project is to provide an AJAX/Web 2.0 calendar application with a PHP back-end, with many supported databases. + This will provide much flexibility and hopefully make this calendar application useful to many people who need a calendar implementation.

+ +

Proposed Features

+

+

    +
  • PHP REST web service back-end
  • +
  • Ability to export/import/update events and todos with multiple formats (XML, JSON, iCalendar, possibly CSV/Outlook)
  • +
  • Calendar access controls (control access by ability to read, write, and view free-busy information on a calendar basis.
  • +
  • Well-documented API, making it possible to build other possible UI implementations on top of the same calendaring back-end.)
  • +
  • Released under an open-source license to make sure it is able to benefit everyone.
  • +
+

+
+ +
+ + diff --git a/aclindsa-wordpress-theme/404.php b/aclindsa-wordpress-theme/404.php new file mode 100644 index 0000000..da331e8 --- /dev/null +++ b/aclindsa-wordpress-theme/404.php @@ -0,0 +1,22 @@ + + +
+ +
+

Error 404 - Page Not Found

+

Oops, the page you are looking for does not exist. You may search using the search box, or visit the homepage to get back on track.

+
+ + + + +
+ + diff --git a/aclindsa-wordpress-theme/archive.php b/aclindsa-wordpress-theme/archive.php new file mode 100644 index 0000000..3ca8fff --- /dev/null +++ b/aclindsa-wordpress-theme/archive.php @@ -0,0 +1,80 @@ + + +
+
+ + + + + +

Archive for the ‘’ Category

+ +

Posts Tagged ‘

+ +

Archive for

+ +

Archive for

+ +

Archive for

+ +

Author Archive

+ +

Blog Archives

+ + + + + + +
> +

+ + +
+ +
+ + + +
+ + + + + Sorry, but there aren't any posts in the %s category yet.", single_cat_title('',false)); + } else if ( is_date() ) { // If this is a date archive + echo("

Sorry, but there aren't any posts with this date.

"); + } else if ( is_author() ) { // If this is a category archive + $userdata = get_userdatabylogin(get_query_var('author_name')); + printf("

Sorry, but there aren't any posts by %s yet.

", $userdata->display_name); + } else { + echo("

No posts found.

"); + } + get_search_form(); + + endif; +?> + +
+ + + +
+ + diff --git a/aclindsa-wordpress-theme/archives.php b/aclindsa-wordpress-theme/archives.php new file mode 100644 index 0000000..2042805 --- /dev/null +++ b/aclindsa-wordpress-theme/archives.php @@ -0,0 +1,29 @@ + + + + +
+ + + +

Archives by Month:

+ + +

Archives by Subject:

+ + +
+ + diff --git a/aclindsa-wordpress-theme/comments-popup.php b/aclindsa-wordpress-theme/comments-popup.php new file mode 100644 index 0000000..49fe744 --- /dev/null +++ b/aclindsa-wordpress-theme/comments-popup.php @@ -0,0 +1,124 @@ + + + + <?php echo get_option('blogname'); ?> - Comments on <?php the_title(); ?> + + + + + + + +

+ + +

Comments

+ +

RSS feed for comments on this post.

+ + +

The URL to TrackBack this entry is:

+ + + + + +
    + +
  1. + +

    by @

    +
  2. + + +
+ +

No comments yet.

+ + + +

Leave a comment

+

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed:

+ +
+ +

Logged in as . Log out »

+ +

+ + +

+ +

+ + +

+ +

+ + +

+ + +

+ +
+ +

+ +

+ + " /> + +

+ ID); ?> +
+ +

Sorry, the comment form is closed at this time.

+ + +
Close this window.
+ + +

Sorry, no posts matched your criteria.

+ + + +

Powered by WordPress

+ + + + diff --git a/aclindsa-wordpress-theme/comments.php b/aclindsa-wordpress-theme/comments.php new file mode 100644 index 0000000..7e81cdb --- /dev/null +++ b/aclindsa-wordpress-theme/comments.php @@ -0,0 +1,96 @@ + +

This post is password protected. Enter the password to view comments.

+ + + + + +

to “

+ + + +
    + +
+ + + + + + + + + +

Comments are closed.

+ + + + + + + +
+ +

+ +
+ +
+ + +

You must be logged in to post a comment.

+ + +
+ + + +

Logged in as . Log out »

+ + + +

/> +

+ +

/> +

+ +

+

+ + + + + +

+ +

+ +

+ID); ?> + +
+ + +
+ + diff --git a/aclindsa-wordpress-theme/footer.php b/aclindsa-wordpress-theme/footer.php new file mode 100644 index 0000000..b6f56cb --- /dev/null +++ b/aclindsa-wordpress-theme/footer.php @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/aclindsa-wordpress-theme/functions.php b/aclindsa-wordpress-theme/functions.php new file mode 100644 index 0000000..9ad4ef2 --- /dev/null +++ b/aclindsa-wordpress-theme/functions.php @@ -0,0 +1,425 @@ + '
  • ', + 'after_widget' => '
  • ', + 'before_title' => '

    ', + 'after_title' => '

    ', + )); +} + +/** @ignore */ +function kubrick_head() { + $head = "\n"; + if ( '' != $output ) + echo $head . $output . $foot; +} + +add_action('wp_head', 'kubrick_head'); + +function kubrick_header_image() { + return apply_filters('kubrick_header_image', get_option('kubrick_header_image')); +} + +function kubrick_upper_color() { + if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) { + parse_str(substr($url, strpos($url, '?') + 1), $q); + return $q['upper']; + } else + return '69aee7'; +} + +function kubrick_lower_color() { + if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) { + parse_str(substr($url, strpos($url, '?') + 1), $q); + return $q['lower']; + } else + return '4180b6'; +} + +function kubrick_header_image_url() { + if ( $image = kubrick_header_image() ) + $url = get_template_directory_uri() . '/images/' . $image; + else + $url = get_template_directory_uri() . '/images/kubrickheader.jpg'; + + return $url; +} + +function kubrick_header_color() { + return apply_filters('kubrick_header_color', get_option('kubrick_header_color')); +} + +function kubrick_header_color_string() { + $color = kubrick_header_color(); + if ( false === $color ) + return 'white'; + + return $color; +} + +function kubrick_header_display() { + return apply_filters('kubrick_header_display', get_option('kubrick_header_display')); +} + +function kubrick_header_display_string() { + $display = kubrick_header_display(); + return $display ? $display : 'inline'; +} + +add_action('admin_menu', 'kubrick_add_theme_page'); + +function kubrick_add_theme_page() { + if ( isset( $_GET['page'] ) && $_GET['page'] == basename(__FILE__) ) { + if ( isset( $_REQUEST['action'] ) && 'save' == $_REQUEST['action'] ) { + check_admin_referer('kubrick-header'); + if ( isset($_REQUEST['njform']) ) { + if ( isset($_REQUEST['defaults']) ) { + delete_option('kubrick_header_image'); + delete_option('kubrick_header_color'); + delete_option('kubrick_header_display'); + } else { + if ( '' == $_REQUEST['njfontcolor'] ) + delete_option('kubrick_header_color'); + else { + $fontcolor = preg_replace('/^.*(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['njfontcolor']); + update_option('kubrick_header_color', $fontcolor); + } + if ( preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njuppercolor'], $uc) && preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njlowercolor'], $lc) ) { + $uc = ( strlen($uc[0]) == 3 ) ? $uc[0]{0}.$uc[0]{0}.$uc[0]{1}.$uc[0]{1}.$uc[0]{2}.$uc[0]{2} : $uc[0]; + $lc = ( strlen($lc[0]) == 3 ) ? $lc[0]{0}.$lc[0]{0}.$lc[0]{1}.$lc[0]{1}.$lc[0]{2}.$lc[0]{2} : $lc[0]; + update_option('kubrick_header_image', "header-img.php?upper=$uc&lower=$lc"); + } + + if ( isset($_REQUEST['toggledisplay']) ) { + if ( false === get_option('kubrick_header_display') ) + update_option('kubrick_header_display', 'none'); + else + delete_option('kubrick_header_display'); + } + } + } else { + + if ( isset($_REQUEST['headerimage']) ) { + check_admin_referer('kubrick-header'); + if ( '' == $_REQUEST['headerimage'] ) + delete_option('kubrick_header_image'); + else { + $headerimage = preg_replace('/^.*?(header-img.php\?upper=[0-9a-fA-F]{6}&lower=[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['headerimage']); + update_option('kubrick_header_image', $headerimage); + } + } + + if ( isset($_REQUEST['fontcolor']) ) { + check_admin_referer('kubrick-header'); + if ( '' == $_REQUEST['fontcolor'] ) + delete_option('kubrick_header_color'); + else { + $fontcolor = preg_replace('/^.*?(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['fontcolor']); + update_option('kubrick_header_color', $fontcolor); + } + } + + if ( isset($_REQUEST['fontdisplay']) ) { + check_admin_referer('kubrick-header'); + if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] ) + delete_option('kubrick_header_display'); + else + update_option('kubrick_header_display', 'none'); + } + } + //print_r($_REQUEST); + wp_redirect("themes.php?page=functions.php&saved=true"); + die; + } + add_action('admin_head', 'kubrick_theme_page_head'); + } + add_theme_page(__('Custom Header'), __('Custom Header'), 'edit_themes', basename(__FILE__), 'kubrick_theme_page'); +} + +function kubrick_theme_page_head() { +?> + + + +

    '.__('Options saved.').'

    '; +?> +
    +

    +
    +
    + +
    +
    +
    +
    + +
    + red', '#FF0000', 'rgb(255, 0, 0)'); ?>
    + #FF0000', '#F00'); ?>
    + #FF0000', '#F00'); ?>
    + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + +

    +
    + +
    + +
    +
    +
    +
    + diff --git a/aclindsa-wordpress-theme/header.php b/aclindsa-wordpress-theme/header.php new file mode 100644 index 0000000..b9a7b9e --- /dev/null +++ b/aclindsa-wordpress-theme/header.php @@ -0,0 +1,38 @@ + + +> + + + + +<?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?> + + + + + + + + +> + + diff --git a/aclindsa-wordpress-theme/image.php b/aclindsa-wordpress-theme/image.php new file mode 100644 index 0000000..4312630 --- /dev/null +++ b/aclindsa-wordpress-theme/image.php @@ -0,0 +1,70 @@ + + +
    + + + +
    +

    post_parent); ?> »

    +
    +

    ID, 'medium' ); ?>

    +
    post_excerpt) ) the_excerpt(); // this is the "caption" ?>
    + + Read the rest of this entry »

    '); ?> + + +
    + + + +
    + +
    + + + + + +

    Sorry, no attachments matched your criteria.

    + + + +
    + + diff --git a/aclindsa-wordpress-theme/index.php b/aclindsa-wordpress-theme/index.php new file mode 100644 index 0000000..5b8a0cd --- /dev/null +++ b/aclindsa-wordpress-theme/index.php @@ -0,0 +1,47 @@ + + +
    + +
    + + + + + +
    id="post-"> +

    + + +
    + +
    + + +
    + + + + + + + +

    Not Found

    +

    Sorry, but you are looking for something that isn't here.

    + + + +
    + + + +
    + diff --git a/aclindsa-wordpress-theme/links.php b/aclindsa-wordpress-theme/links.php new file mode 100644 index 0000000..81fdc00 --- /dev/null +++ b/aclindsa-wordpress-theme/links.php @@ -0,0 +1,23 @@ + + + + +
    + +

    Links:

    + + +
    + + diff --git a/aclindsa-wordpress-theme/page.php b/aclindsa-wordpress-theme/page.php new file mode 100644 index 0000000..660e477 --- /dev/null +++ b/aclindsa-wordpress-theme/page.php @@ -0,0 +1,27 @@ + + +
    + + +
    +

    +
    + Read the rest of this page »

    '); ?> + + '

    Pages: ', 'after' => '

    ', 'next_or_number' => 'number')); ?> + +
    +
    + + ', '

    '); ?> +
    + + + + diff --git a/aclindsa-wordpress-theme/screenshot.png b/aclindsa-wordpress-theme/screenshot.png new file mode 100644 index 0000000..e0b1d48 Binary files /dev/null and b/aclindsa-wordpress-theme/screenshot.png differ diff --git a/aclindsa-wordpress-theme/search.php b/aclindsa-wordpress-theme/search.php new file mode 100644 index 0000000..e01bc03 --- /dev/null +++ b/aclindsa-wordpress-theme/search.php @@ -0,0 +1,51 @@ + + +
    +
    + + + +

    Search Results

    + + + + + + +
    > +

    + + + +
    + + + + + + + +

    No posts found. Try a different search?

    + + + + +
    + + + +
    + + diff --git a/aclindsa-wordpress-theme/sidebar.php b/aclindsa-wordpress-theme/sidebar.php new file mode 100644 index 0000000..d73b632 --- /dev/null +++ b/aclindsa-wordpress-theme/sidebar.php @@ -0,0 +1,83 @@ + + + diff --git a/aclindsa-wordpress-theme/single.php b/aclindsa-wordpress-theme/single.php new file mode 100644 index 0000000..c9cb4d8 --- /dev/null +++ b/aclindsa-wordpress-theme/single.php @@ -0,0 +1,73 @@ + + +
    + + + + + +
    id="post-"> +

    + +
    + Read the rest of this entry »

    '); ?> + + '

    Pages: ', 'after' => '

    ', 'next_or_number' => 'number')); ?> + Tags: ', ', ', '

    '); ?> + + + +
    +
    + + + + + +

    Sorry, no posts matched your criteria.

    + + + +
    + + diff --git a/calendar/index.php b/calendar/index.php new file mode 100644 index 0000000..c0d5628 --- /dev/null +++ b/calendar/index.php @@ -0,0 +1,12 @@ + +Aaron's Calendar - aclindsay.com + + +
    +
    +

    Aaron's Calendar

    + +
    +
    + + diff --git a/contact/index.php b/contact/index.php new file mode 100644 index 0000000..14d2d0d --- /dev/null +++ b/contact/index.php @@ -0,0 +1,28 @@ + +Contact Information - aclindsay.com + + + +
    +
    +

    Contact Page

    + + +

    e-mail: aaron @hotmail.comDOT lindsay AT...2@.$97^4 vt DOT

    + +

    voice: + +

    +
    + +
    + + diff --git a/errors/400.php b/errors/400.php new file mode 100644 index 0000000..6fb6bae --- /dev/null +++ b/errors/400.php @@ -0,0 +1,12 @@ + +Bad Request - aclindsay.com + + +
    +
    +

    Error 400 - Bad Request

    +

    This HTTP request was malformed, and could not be processed. You may attempt to reload this page, but the software you are using (your browser) may be at fault.

    +
    +
    + + diff --git a/errors/401.php b/errors/401.php new file mode 100644 index 0000000..20b030d --- /dev/null +++ b/errors/401.php @@ -0,0 +1,12 @@ + +Authorization Required - aclindsay.com + + +
    +
    +

    Error 401 - Authorization Required

    +

    The page you are requesting requires authorization to view. Please provide your login credentials, if you have them, or continue browsing with our homepage.

    +
    +
    + + diff --git a/errors/403.php b/errors/403.php new file mode 100644 index 0000000..2b3cbbe --- /dev/null +++ b/errors/403.php @@ -0,0 +1,12 @@ + +Forbidden - aclindsay.com + + +
    +
    +

    Error 403 - Forbidden

    +

    The page you are requesting will not be returned. Refreshing the page won't help either. Please use your browser's back buttons to return to the page you came from, or continue browsing with our homepage.

    +
    +
    + + diff --git a/errors/404.php b/errors/404.php new file mode 100644 index 0000000..7ffe644 --- /dev/null +++ b/errors/404.php @@ -0,0 +1,12 @@ + +Page Not Found - aclindsay.com + + +
    +
    +

    Error 404 - Page Not Found

    +

    Oops, the page you are looking for does not exist. You may use your browsers back button to return to the page from which you came, or visit the homepage to get back on track.

    +
    +
    + + diff --git a/errors/500.php b/errors/500.php new file mode 100644 index 0000000..51fbe6e --- /dev/null +++ b/errors/500.php @@ -0,0 +1,12 @@ + +Internal Server Error - aclindsay.com + + +
    +
    +

    Error 500 - Internal Server Error

    +

    Oops, the server encountered an error while processing your request for this page. Please refresh the page and try again. If the error persists, please contact me.

    +
    +
    + + diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..a5b9d7a Binary files /dev/null and b/favicon.ico differ diff --git a/fonts/Cardo99s.ttf b/fonts/Cardo99s.ttf new file mode 100644 index 0000000..4eb90ba Binary files /dev/null and b/fonts/Cardo99s.ttf differ diff --git a/fonts/IMFePIrm28P.ttf b/fonts/IMFePIrm28P.ttf new file mode 100644 index 0000000..ab4c10f Binary files /dev/null and b/fonts/IMFePIrm28P.ttf differ diff --git a/fonts/ReenieBeanie.ttf b/fonts/ReenieBeanie.ttf new file mode 100644 index 0000000..2d5a45a Binary files /dev/null and b/fonts/ReenieBeanie.ttf differ diff --git a/fonts/Tangerine_Bold.ttf b/fonts/Tangerine_Bold.ttf new file mode 100644 index 0000000..d891238 Binary files /dev/null and b/fonts/Tangerine_Bold.ttf differ diff --git a/fonts/Tangerine_Regular.ttf b/fonts/Tangerine_Regular.ttf new file mode 100644 index 0000000..2a2a9e1 Binary files /dev/null and b/fonts/Tangerine_Regular.ttf differ diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..a818722 --- /dev/null +++ b/footer.php @@ -0,0 +1,8 @@ + + + + diff --git a/graphics/cornerStripedLeft.png b/graphics/cornerStripedLeft.png new file mode 100644 index 0000000..f112a1b Binary files /dev/null and b/graphics/cornerStripedLeft.png differ diff --git a/graphics/cornerStripedRight.png b/graphics/cornerStripedRight.png new file mode 100644 index 0000000..226a195 Binary files /dev/null and b/graphics/cornerStripedRight.png differ diff --git a/graphics/stripedTree.png b/graphics/stripedTree.png new file mode 100644 index 0000000..007aea6 Binary files /dev/null and b/graphics/stripedTree.png differ diff --git a/header_bottom.php b/header_bottom.php new file mode 100644 index 0000000..55ebd6b --- /dev/null +++ b/header_bottom.php @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/header_top.php b/header_top.php new file mode 100644 index 0000000..a1194ca --- /dev/null +++ b/header_top.php @@ -0,0 +1,3 @@ + + + diff --git a/index.php b/index.php new file mode 100644 index 0000000..6df479c --- /dev/null +++ b/index.php @@ -0,0 +1,3 @@ + diff --git a/php.ini b/php.ini new file mode 100644 index 0000000..8b4bca5 --- /dev/null +++ b/php.ini @@ -0,0 +1,1065 @@ +[PHP] + +;;;;;;;;;;;;;;;;;;; +; About php.ini ; +;;;;;;;;;;;;;;;;;;; +; This file controls many aspects of PHP's behavior. In order for PHP to +; read it, it must be named 'php.ini'. PHP looks for it in the current +; working directory, in the path designated by the environment variable +; PHPRC, and in the path that was defined in compile time (in that order). +; Under Windows, the compile-time path is the Windows directory. The +; path in which the php.ini file is looked for can be overridden using +; the -c argument in command line mode. +; +; The syntax of the file is extremely simple. Whitespace and Lines +; beginning with a semicolon are silently ignored (as you probably guessed). +; Section headers (e.g. [Foo]) are also silently ignored, even though +; they might mean something in the future. +; +; Directives are specified using the following syntax: +; directive = value +; Directive names are *case sensitive* - foo=bar is different from FOO=bar. +; +; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one +; of the INI constants (On, Off, True, False, Yes, No and None) or an expression +; (e.g. E_ALL & ~E_NOTICE), or a quoted string ("foo"). +; +; Expressions in the INI file are limited to bitwise operators and parentheses: +; | bitwise OR +; & bitwise AND +; ~ bitwise NOT +; ! boolean NOT +; +; Boolean flags can be turned on using the values 1, On, True or Yes. +; They can be turned off using the values 0, Off, False or No. +; +; An empty string can be denoted by simply not writing anything after the equal +; sign, or by using the None keyword: +; +; foo = ; sets foo to an empty string +; foo = none ; sets foo to an empty string +; foo = "none" ; sets foo to the string 'none' +; +; If you use constants in your value, and these constants belong to a +; dynamically loaded extension (either a PHP extension or a Zend extension), +; you may only use these constants *after* the line that loads the extension. +; +; +;;;;;;;;;;;;;;;;;;; +; About this file ; +;;;;;;;;;;;;;;;;;;; +; This is the recommended, PHP 5-style version of the php.ini-dist file. It +; sets some non standard settings, that make PHP more efficient, more secure, +; and encourage cleaner coding. +; +; The price is that with these settings, PHP may be incompatible with some +; applications, and sometimes, more difficult to develop with. Using this +; file is warmly recommended for production sites. As all of the changes from +; the standard settings are thoroughly documented, you can go over each one, +; and decide whether you want to use it or not. +; +; For general information about the php.ini file, please consult the php.ini-dist +; file, included in your PHP distribution. +; +; This file is different from the php.ini-dist file in the fact that it features +; different values for several directives, in order to improve performance, while +; possibly breaking compatibility with the standard out-of-the-box behavior of +; PHP. Please make sure you read what's different, and modify your scripts +; accordingly, if you decide to use this file instead. +; +; - register_long_arrays = Off [Performance] +; Disables registration of the older (and deprecated) long predefined array +; variables ($HTTP_*_VARS). Instead, use the superglobals that were +; introduced in PHP 4.1.0 +; - display_errors = Off [Security] +; With this directive set to off, errors that occur during the execution of +; scripts will no longer be displayed as a part of the script output, and thus, +; will no longer be exposed to remote users. With some errors, the error message +; content may expose information about your script, web server, or database +; server that may be exploitable for hacking. Production sites should have this +; directive set to off. +; - log_errors = On [Security] +; This directive complements the above one. Any errors that occur during the +; execution of your script will be logged (typically, to your server's error log, +; but can be configured in several ways). Along with setting display_errors to off, +; this setup gives you the ability to fully understand what may have gone wrong, +; without exposing any sensitive information to remote users. +; - output_buffering = 4096 [Performance] +; Set a 4KB output buffer. Enabling output buffering typically results in less +; writes, and sometimes less packets sent on the wire, which can often lead to +; better performance. The gain this directive actually yields greatly depends +; on which Web server you're working with, and what kind of scripts you're using. +; - register_argc_argv = Off [Performance] +; Disables registration of the somewhat redundant $argv and $argc global +; variables. +; - magic_quotes_gpc = Off [Performance] +; Input data is no longer escaped with slashes so that it can be sent into +; SQL databases without further manipulation. Instead, you should use the +; function addslashes() on each input element you wish to send to a database. +; - variables_order = "GPCS" [Performance] +; The environment variables are not hashed into the $_ENV. To access +; environment variables, you can use getenv() instead. +; - error_reporting = E_ALL [Code Cleanliness, Security(?)] +; By default, PHP suppresses errors of type E_NOTICE. These error messages +; are emitted for non-critical errors, but that could be a symptom of a bigger +; problem. Most notably, this will cause error messages about the use +; of uninitialized variables to be displayed. +; - allow_call_time_pass_reference = Off [Code cleanliness] +; It's not possible to decide to force a variable to be passed by reference +; when calling a function. The PHP 4 style to do this is by making the +; function require the relevant argument by reference. + +;;;;;;;;;;;;;;;;;;;; +; Language Options ; +;;;;;;;;;;;;;;;;;;;; + +; Enable the PHP scripting language engine under Apache. +engine = On + +; Enable compatibility mode with Zend Engine 1 (PHP 4.x) +zend.ze1_compatibility_mode = Off + +; Allow the tags are recognized. +; NOTE: Using short tags should be avoided when developing applications or +; libraries that are meant for redistribution, or deployment on PHP +; servers which are not under your control, because short tags may not +; be supported on the target server. For portable, redistributable code, +; be sure not to use short tags. +short_open_tag = On + +; Allow ASP-style <% %> tags. +asp_tags = Off + +; The number of significant digits displayed in floating point numbers. +precision = 12 + +; Enforce year 2000 compliance (will cause problems with non-compliant browsers) +y2k_compliance = On + +; Output buffering allows you to send header lines (including cookies) even +; after you send body content, at the price of slowing PHP's output layer a +; bit. You can enable output buffering during runtime by calling the output +; buffering functions. You can also enable output buffering for all files by +; setting this directive to On. If you wish to limit the size of the buffer +; to a certain size - you can use a maximum number of bytes instead of 'On', as +; a value for this directive (e.g., output_buffering=4096). +output_buffering = Off + +; You can redirect all of the output of your scripts to a function. For +; example, if you set output_handler to "mb_output_handler", character +; encoding will be transparently converted to the specified encoding. +; Setting any output handler automatically turns on output buffering. +; Note: People who wrote portable scripts should not depend on this ini +; directive. Instead, explicitly set the output handler using ob_start(). +; Using this ini directive may cause problems unless you know what script +; is doing. +; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler" +; and you cannot use both "ob_gzhandler" and "zlib.output_compression". +; Note: output_handler must be empty if this is set 'On' !!!! +; Instead you must use zlib.output_handler. +;output_handler = + +; Transparent output compression using the zlib library +; Valid values for this option are 'off', 'on', or a specific buffer size +; to be used for compression (default is 4KB) +; Note: Resulting chunk size may vary due to nature of compression. PHP +; outputs chunks that are few hundreds bytes each as a result of +; compression. If you prefer a larger chunk size for better +; performance, enable output_buffering in addition. +; Note: You need to use zlib.output_handler instead of the standard +; output_handler, or otherwise the output will be corrupted. +zlib.output_compression = Off +;zlib.output_compression_level = -1 + +; You cannot specify additional output handlers if zlib.output_compression +; is activated here. This setting does the same as output_handler but in +; a different order. +;zlib.output_handler = + +; Implicit flush tells PHP to tell the output layer to flush itself +; automatically after every output block. This is equivalent to calling the +; PHP function flush() after each and every call to print() or echo() and each +; and every HTML block. Turning this option on has serious performance +; implications and is generally recommended for debugging purposes only. +implicit_flush = Off + +; The unserialize callback function will be called (with the undefined class' +; name as parameter), if the unserializer finds an undefined class +; which should be instantiated. +; A warning appears if the specified function is not defined, or if the +; function doesn't include/implement the missing class. +; So only set this entry, if you really want to implement such a +; callback-function. +unserialize_callback_func= + +; When floats & doubles are serialized store serialize_precision significant +; digits after the floating point. The default value ensures that when floats +; are decoded with unserialize, the data will remain the same. +serialize_precision = 100 + +; Whether to enable the ability to force arguments to be passed by reference +; at function call time. This method is deprecated and is likely to be +; unsupported in future versions of PHP/Zend. The encouraged method of +; specifying which arguments should be passed by reference is in the function +; declaration. You're encouraged to try and turn this option Off and make +; sure your scripts work properly with it in order to ensure they will work +; with future versions of the language (you will receive a warning each time +; you use this feature, and the argument will be passed by value instead of by +; reference). +allow_call_time_pass_reference = On + +; +; Safe Mode +; +safe_mode = Off + +; By default, Safe Mode does a UID compare check when +; opening files. If you want to relax this to a GID compare, +; then turn on safe_mode_gid. +safe_mode_gid = Off + +; When safe_mode is on, UID/GID checks are bypassed when +; including files from this directory and its subdirectories. +; (directory must also be in include_path or full path must +; be used when including) +safe_mode_include_dir = + +; When safe_mode is on, only executables located in the safe_mode_exec_dir +; will be allowed to be executed via the exec family of functions. +safe_mode_exec_dir = + +; Setting certain environment variables may be a potential security breach. +; This directive contains a comma-delimited list of prefixes. In Safe Mode, +; the user may only alter environment variables whose names begin with the +; prefixes supplied here. By default, users will only be able to set +; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR). +; +; Note: If this directive is empty, PHP will let the user modify ANY +; environment variable! +safe_mode_allowed_env_vars = PHP_ + +; This directive contains a comma-delimited list of environment variables that +; the end user won't be able to change using putenv(). These variables will be +; protected even if safe_mode_allowed_env_vars is set to allow to change them. +safe_mode_protected_env_vars = LD_LIBRARY_PATH + +; open_basedir, if set, limits all file operations to the defined directory +; and below. This directive makes most sense if used in a per-directory +; or per-virtualhost web server configuration file. This directive is +; *NOT* affected by whether Safe Mode is turned On or Off. +;open_basedir = + +; This directive allows you to disable certain functions for security reasons. +; It receives a comma-delimited list of function names. This directive is +; *NOT* affected by whether Safe Mode is turned On or Off. +disable_functions = + +; This directive allows you to disable certain classes for security reasons. +; It receives a comma-delimited list of class names. This directive is +; *NOT* affected by whether Safe Mode is turned On or Off. +disable_classes = + +; Colors for Syntax Highlighting mode. Anything that's acceptable in +; would work. +;highlight.string = #DD0000 +;highlight.comment = #FF9900 +;highlight.keyword = #007700 +;highlight.bg = #FFFFFF +;highlight.default = #0000BB +;highlight.html = #000000 + +; If enabled, the request will be allowed to complete even if the user aborts +; the request. Consider enabling it if executing long request, which may end up +; being interrupted by the user or a browser timing out. +; ignore_user_abort = On + +; Determines the size of the realpath cache to be used by PHP. This value should +; be increased on systems where PHP opens many files to reflect the quantity of +; the file operations performed. +; realpath_cache_size=16k + +; Duration of time, in seconds for which to cache realpath information for a given +; file or directory. For systems with rarely changing files, consider increasing this +; value. +; realpath_cache_ttl=120 + +; +; Misc +; +; Decides whether PHP may expose the fact that it is installed on the server +; (e.g. by adding its signature to the Web server header). It is no security +; threat in any way, but it makes it possible to determine whether you use PHP +; on your server or not. +expose_php = On + + +;;;;;;;;;;;;;;;;;;; +; Resource Limits ; +;;;;;;;;;;;;;;;;;;; + +max_execution_time = 30 ; Maximum execution time of each script, in seconds +max_input_time = 60 ; Maximum amount of time each script may spend parsing request data +memory_limit = 64M ; Maximum amount of memory a script may consume (16MB) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Error handling and logging ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; error_reporting is a bit-field. Or each number up to get desired error +; reporting level +; E_ALL - All errors and warnings (doesn't include E_STRICT) +; E_ERROR - fatal run-time errors +; E_RECOVERABLE_ERROR - almost fatal run-time errors +; E_WARNING - run-time warnings (non-fatal errors) +; E_PARSE - compile-time parse errors +; E_NOTICE - run-time notices (these are warnings which often result +; from a bug in your code, but it's possible that it was +; intentional (e.g., using an uninitialized variable and +; relying on the fact it's automatically initialized to an +; empty string) +; E_STRICT - run-time notices, enable to have PHP suggest changes +; to your code which will ensure the best interoperability +; and forward compatibility of your code +; E_CORE_ERROR - fatal errors that occur during PHP's initial startup +; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's +; initial startup +; E_COMPILE_ERROR - fatal compile-time errors +; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) +; E_USER_ERROR - user-generated error message +; E_USER_WARNING - user-generated warning message +; E_USER_NOTICE - user-generated notice message +; +; Examples: +; +; - Show all errors, except for notices and coding standards warnings +; +error_reporting = E_ALL & ~E_NOTICE +; +; - Show all errors, except for notices +; +;error_reporting = E_ALL & ~E_NOTICE | E_STRICT +; +; - Show only errors +; +;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR +; +; - Show all errors, except coding standards warnings +; +;error_reporting = E_ALL + +; Print out errors (as a part of the output). For production web sites, +; you're strongly encouraged to turn this feature off, and use error logging +; instead (see below). Keeping display_errors enabled on a production web site +; may reveal security information to end users, such as file paths on your Web +; server, your database schema or other information. +display_errors = Off + +; Even when display_errors is on, errors that occur during PHP's startup +; sequence are not displayed. It's strongly recommended to keep +; display_startup_errors off, except for when debugging. +display_startup_errors = Off + +; Log errors into a log file (server-specific log, stderr, or error_log (below)) +; As stated above, you're strongly advised to use error logging in place of +; error displaying on production web sites. +log_errors = On + +; Set maximum length of log_errors. In error_log information about the source is +; added. The default is 1024 and 0 allows to not apply any maximum length at all. +log_errors_max_len = 1024 + +; Do not log repeated messages. Repeated errors must occur in same file on same +; line until ignore_repeated_source is set true. +ignore_repeated_errors = Off + +; Ignore source of message when ignoring repeated messages. When this setting +; is On you will not log errors with repeated messages from different files or +; source lines. +ignore_repeated_source = Off + +; If this parameter is set to Off, then memory leaks will not be shown (on +; stdout or in the log). This has only effect in a debug compile, and if +; error reporting includes E_WARNING in the allowed list +report_memleaks = On + +;report_zend_debug = 0 + +; Store the last error/warning message in $php_errormsg (boolean). +track_errors = Off + +; Disable the inclusion of HTML tags in error messages. +; Note: Never use this feature for production boxes. +;html_errors = Off + +; If html_errors is set On PHP produces clickable error messages that direct +; to a page describing the error or function causing the error in detail. +; You can download a copy of the PHP manual from http://www.php.net/docs.php +; and change docref_root to the base URL of your local copy including the +; leading '/'. You must also specify the file extension being used including +; the dot. +; Note: Never use this feature for production boxes. +;docref_root = "/phpmanual/" +;docref_ext = .html + +; String to output before an error message. +;error_prepend_string = "" + +; String to output after an error message. +;error_append_string = "" + +; Log errors to specified file. +error_log = /home/aclindsa/php_error_log + +; Log errors to syslog (Event Log on NT, not valid in Windows 95). +error_log = syslog + + +;;;;;;;;;;;;;;;;; +; Data Handling ; +;;;;;;;;;;;;;;;;; +; +; Note - track_vars is ALWAYS enabled as of PHP 4.0.3 + +; The separator used in PHP generated URLs to separate arguments. +; Default is "&". +;arg_separator.output = "&" + +; List of separator(s) used by PHP to parse input URLs into variables. +; Default is "&". +; NOTE: Every character in this directive is considered as separator! +;arg_separator.input = ";&" + +; This directive describes the order in which PHP registers GET, POST, Cookie, +; Environment and Built-in variables (G, P, C, E & S respectively, often +; referred to as EGPCS or GPC). Registration is done from left to right, newer +; values override older values. +variables_order = "EGPCS" + +; Whether or not to register the EGPCS variables as global variables. You may +; want to turn this off if you don't want to clutter your scripts' global scope +; with user data. This makes most sense when coupled with track_vars - in which +; case you can access all of the GPC variables through the $HTTP_*_VARS[], +; variables. +; +; You should do your best to write your scripts so that they do not require +; register_globals to be on; Using form variables as globals can easily lead +; to possible security problems, if the code is not very well thought of. +register_globals = Off + +; Whether or not to register the old-style input arrays, HTTP_GET_VARS +; and friends. If you're not using them, it's recommended to turn them off, +; for performance reasons. +register_long_arrays = Off + +; This directive tells PHP whether to declare the argv&argc variables (that +; would contain the GET information). If you don't use these variables, you +; should turn it off for increased performance. +register_argc_argv = On + +; When enabled, the SERVER and ENV variables are created when they're first +; used (Just In Time) instead of when the script starts. If these variables +; are not used within a script, having this directive on will result in a +; performance gain. The PHP directives register_globals, register_long_arrays, +; and register_argc_argv must be disabled for this directive to have any affect. +auto_globals_jit = On + +; Maximum size of POST data that PHP will accept. +post_max_size = 8M + +; Magic quotes +; + +; Magic quotes for incoming GET/POST/Cookie data. +magic_quotes_gpc = On + +; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. +magic_quotes_runtime = Off + +; Use Sybase-style magic quotes (escape ' with '' instead of \'). +magic_quotes_sybase = Off + +; Automatically add files before or after any PHP document. +auto_prepend_file = +auto_append_file = + +; As of 4.0b4, PHP always outputs a character encoding by default in +; the Content-type: header. To disable sending of the charset, simply +; set it to be empty. +; +; PHP's built-in default is text/html +default_mimetype = "text/html" +;default_charset = "iso-8859-1" + +; Always populate the $HTTP_RAW_POST_DATA variable. +;always_populate_raw_post_data = On + + +;;;;;;;;;;;;;;;;;;;;;;;;; +; Paths and Directories ; +;;;;;;;;;;;;;;;;;;;;;;;;; + +; UNIX: "/path1:/path2" +include_path = ".:/usr/lib64/php:/usr/lib/php" +; +; Windows: "\path1;\path2" +;include_path = ".;c:\php\includes" + +; The root of the PHP pages, used only if nonempty. +; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root +; if you are running php as a CGI under any web server (other than IIS) +; see documentation for security issues. The alternate is to use the +; cgi.force_redirect configuration below +doc_root = + +; The directory under which PHP opens the script using /~username used only +; if nonempty. +user_dir = + +; Directory in which the loadable extensions (modules) reside. +extension_dir = "/usr/lib64/php/modules" + +; Whether or not to enable the dl() function. The dl() function does NOT work +; properly in multithreaded servers, such as IIS or Zeus, and is automatically +; disabled on them. +enable_dl = On + +; cgi.force_redirect is necessary to provide security running PHP as a CGI under +; most web servers. Left undefined, PHP turns this on by default. You can +; turn it off here AT YOUR OWN RISK +; **You CAN safely turn this off for IIS, in fact, you MUST.** +; cgi.force_redirect = 1 + +; if cgi.nph is enabled it will force cgi to always sent Status: 200 with +; every request. +; cgi.nph = 1 + +; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape +; (iPlanet) web servers, you MAY need to set an environment variable name that PHP +; will look for to know it is OK to continue execution. Setting this variable MAY +; cause security issues, KNOW WHAT YOU ARE DOING FIRST. +; cgi.redirect_status_env = ; + +; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate +; security tokens of the calling client. This allows IIS to define the +; security context that the request runs under. mod_fastcgi under Apache +; does not currently support this feature (03/17/2002) +; Set to 1 if running under IIS. Default is zero. +; fastcgi.impersonate = 1; + +; Disable logging through FastCGI connection +; fastcgi.log = 0 + +; cgi.rfc2616_headers configuration option tells PHP what type of headers to +; use when sending HTTP response code. If it's set 0 PHP sends Status: header that +; is supported by Apache. When this option is set to 1 PHP will send +; RFC2616 compliant header. +; Default is zero. +;cgi.rfc2616_headers = 0 + + +;;;;;;;;;;;;;;;; +; File Uploads ; +;;;;;;;;;;;;;;;; + +; Whether to allow HTTP file uploads. +file_uploads = On + +; Temporary directory for HTTP uploaded files (will use system default if not +; specified). +;upload_tmp_dir = + +; Maximum allowed size for uploaded files. +upload_max_filesize = 10M + + +;;;;;;;;;;;;;;;;;; +; Fopen wrappers ; +;;;;;;;;;;;;;;;;;; + +; Whether to allow the treatment of URLs (like http:// or ftp://) as files. +allow_url_fopen = On + +; Whether to allow include/require to open URLs (like http:// or ftp://) as files. +allow_url_include = On + +; Define the anonymous ftp password (your email address) +;from="john@doe.com" + +; Define the User-Agent string +; user_agent="PHP" + +; Default timeout for socket based streams (seconds) +default_socket_timeout = 60 + +; If your scripts have to deal with files from Macintosh systems, +; or you are running on a Mac and need to deal with files from +; unix or win32 systems, setting this flag will cause PHP to +; automatically detect the EOL character in those files so that +; fgets() and file() will work regardless of the source of the file. +; auto_detect_line_endings = Off + + +;;;;;;;;;;;;;;;;;;;;;; +; Dynamic Extensions ; +;;;;;;;;;;;;;;;;;;;;;; +; +; If you wish to have an extension loaded automatically, use the following +; syntax: +; +; extension=modulename.extension +; +; For example: +; +; extension=msql.so +; +; Note that it should be the name of the module only; no directory information +; needs to go here. Specify the location of the extension with the +; extension_dir directive above. + + +;;;; +; Note: packaged extension modules are now loaded via the .ini files +; found in the directory /etc/php.d; these are loaded by default. +;;;; + + +;;;;;;;;;;;;;;;;;;; +; Module Settings ; +;;;;;;;;;;;;;;;;;;; + +[Date] +; Defines the default timezone used by the date functions +date.timezone = "America/Denver" +;additional options at http://php.net/timezones + +;date.default_latitude = 31.7667 +;date.default_longitude = 35.2333 + +;date.sunrise_zenith = 90.583333 +;date.sunset_zenith = 90.583333 + +[filter] +;filter.default = unsafe_raw +;filter.default_flags = + +[iconv] +;iconv.input_encoding = ISO-8859-1 +;iconv.internal_encoding = ISO-8859-1 +;iconv.output_encoding = ISO-8859-1 + +[sqlite] +;sqlite.assoc_case = 0 + +[xmlrpc] +;xmlrpc_error_number = 0 +;xmlrpc_errors = 0 + +[Pcre] +;PCRE library backtracking limit. +;pcre.backtrack_limit=100000 + +;PCRE library recursion limit. +;Please note that if you set this value to a high number you may consume all +;the available process stack and eventually crash PHP (due to reaching the +;stack size limit imposed by the Operating System). +;pcre.recursion_limit=100000 + +[Syslog] +; Whether or not to define the various syslog variables (e.g. $LOG_PID, +; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In +; runtime, you can define these variables by calling define_syslog_variables(). +define_syslog_variables = Off + +[mail function] +; For Win32 only. +SMTP = localhost +smtp_port = 25 + +; For Win32 only. +;sendmail_from = me@example.com + +; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). +sendmail_path = /usr/sbin/sendmail -t -i + +; Force the addition of the specified parameters to be passed as extra parameters +; to the sendmail binary. These parameters will always replace the value of +; the 5th parameter to mail(), even in safe mode. +;mail.force_extra_parameters = + +[SQL] +sql.safe_mode = Off + +[ODBC] +;odbc.default_db = Not yet implemented +;odbc.default_user = Not yet implemented +;odbc.default_pw = Not yet implemented + +; Allow or prevent persistent links. +odbc.allow_persistent = On + +; Check that a connection is still valid before reuse. +odbc.check_persistent = On + +; Maximum number of persistent links. -1 means no limit. +odbc.max_persistent = -1 + +; Maximum number of links (persistent + non-persistent). -1 means no limit. +odbc.max_links = -1 + +; Handling of LONG fields. Returns number of bytes to variables. 0 means +; passthru. +odbc.defaultlrl = 4096 + +; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. +; See the documentation on odbc_binmode and odbc_longreadlen for an explanation +; of uodbc.defaultlrl and uodbc.defaultbinmode +odbc.defaultbinmode = 1 + +[MySQL] +; Allow or prevent persistent links. +mysql.allow_persistent = On + +; Maximum number of persistent links. -1 means no limit. +mysql.max_persistent = -1 + +; Maximum number of links (persistent + non-persistent). -1 means no limit. +mysql.max_links = -1 + +; Default port number for mysql_connect(). If unset, mysql_connect() will use +; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the +; compile-time value defined MYSQL_PORT (in that order). Win32 will only look +; at MYSQL_PORT. +mysql.default_port = + +; Default socket name for local MySQL connects. If empty, uses the built-in +; MySQL defaults. +mysql.default_socket = + +; Default host for mysql_connect() (doesn't apply in safe mode). +mysql.default_host = + +; Default user for mysql_connect() (doesn't apply in safe mode). +mysql.default_user = + +; Default password for mysql_connect() (doesn't apply in safe mode). +; Note that this is generally a *bad* idea to store passwords in this file. +; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password") +; and reveal this password! And of course, any users with read access to this +; file will be able to reveal the password as well. +mysql.default_password = + +; Maximum time (in seconds) for connect timeout. -1 means no limit +mysql.connect_timeout = 60 + +; Trace mode. When trace_mode is active (=On), warnings for table/index scans and +; SQL-Errors will be displayed. +mysql.trace_mode = Off + +[MySQLi] + +; Maximum number of links. -1 means no limit. +mysqli.max_links = -1 + +; Default port number for mysqli_connect(). If unset, mysqli_connect() will use +; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the +; compile-time value defined MYSQL_PORT (in that order). Win32 will only look +; at MYSQL_PORT. +mysqli.default_port = 3306 + +; Default socket name for local MySQL connects. If empty, uses the built-in +; MySQL defaults. +mysqli.default_socket = + +; Default host for mysql_connect() (doesn't apply in safe mode). +mysqli.default_host = + +; Default user for mysql_connect() (doesn't apply in safe mode). +mysqli.default_user = + +; Default password for mysqli_connect() (doesn't apply in safe mode). +; Note that this is generally a *bad* idea to store passwords in this file. +; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") +; and reveal this password! And of course, any users with read access to this +; file will be able to reveal the password as well. +mysqli.default_pw = + +; Allow or prevent reconnect +mysqli.reconnect = Off + +[PostgresSQL] +; Allow or prevent persistent links. +pgsql.allow_persistent = On + +; Detect broken persistent links always with pg_pconnect(). +; Auto reset feature requires a little overheads. +pgsql.auto_reset_persistent = Off + +; Maximum number of persistent links. -1 means no limit. +pgsql.max_persistent = -1 + +; Maximum number of links (persistent+non persistent). -1 means no limit. +pgsql.max_links = -1 + +; Ignore PostgreSQL backends Notice message or not. +; Notice message logging require a little overheads. +pgsql.ignore_notice = 0 + +; Log PostgreSQL backends Noitce message or not. +; Unless pgsql.ignore_notice=0, module cannot log notice message. +pgsql.log_notice = 0 + +[bcmath] +; Number of decimal digits for all bcmath functions. +bcmath.scale = 0 + +[browscap] +;browscap = extra/browscap.ini + +[Session] +; Handler used to store/retrieve data. +session.save_handler = files + +; Argument passed to save_handler. In the case of files, this is the path +; where data files are stored. Note: Windows users have to change this +; variable in order to use PHP's session functions. +; +; As of PHP 4.0.1, you can define the path as: +; +; session.save_path = "N;/path" +; +; where N is an integer. Instead of storing all the session files in +; /path, what this will do is use subdirectories N-levels deep, and +; store the session data in those directories. This is useful if you +; or your OS have problems with lots of files in one directory, and is +; a more efficient layout for servers that handle lots of sessions. +; +; NOTE 1: PHP will not create this directory structure automatically. +; You can use the script in the ext/session dir for that purpose. +; NOTE 2: See the section on garbage collection below if you choose to +; use subdirectories for session storage +; +; The file storage module creates files using mode 600 by default. +; You can change that by using +; +; session.save_path = "N;MODE;/path" +; +; where MODE is the octal representation of the mode. Note that this +; does not overwrite the process's umask. +session.save_path = "/tmp" + +; Whether to use cookies. +session.use_cookies = 1 + +; This option enables administrators to make their users invulnerable to +; attacks which involve passing session ids in URLs; defaults to 0. +; session.use_only_cookies = 1 + +; Name of the session (used as cookie name). +session.name = PHPSESSID + +; Initialize session on request startup. +session.auto_start = 0 + +; Lifetime in seconds of cookie or, if 0, until browser is restarted. +session.cookie_lifetime = 0 + +; The path for which the cookie is valid. +session.cookie_path = / + +; The domain for which the cookie is valid. +session.cookie_domain = + +; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript. +session.cookie_httponly = + +; Handler used to serialize data. php is the standard serializer of PHP. +session.serialize_handler = php + +; Define the probability that the 'garbage collection' process is started +; on every session initialization. +; The probability is calculated by using gc_probability/gc_divisor, +; e.g. 1/100 means there is a 1% chance that the GC process starts +; on each request. + +session.gc_probability = 1 +session.gc_divisor = 100 + +; After this number of seconds, stored data will be seen as 'garbage' and +; cleaned up by the garbage collection process. +session.gc_maxlifetime = 1440 + +; NOTE: If you are using the subdirectory option for storing session files +; (see session.save_path above), then garbage collection does *not* +; happen automatically. You will need to do your own garbage +; collection through a shell script, cron entry, or some other method. +; For example, the following script would is the equivalent of +; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): +; cd /path/to/sessions; find -cmin +24 | xargs rm + +; PHP 4.2 and less have an undocumented feature/bug that allows you to +; to initialize a session variable in the global scope, albeit register_globals +; is disabled. PHP 4.3 and later will warn you, if this feature is used. +; You can disable the feature and the warning separately. At this time, +; the warning is only displayed, if bug_compat_42 is enabled. + +session.bug_compat_42 = 1 +session.bug_compat_warn = 1 + +; Check HTTP Referer to invalidate externally stored URLs containing ids. +; HTTP_REFERER has to contain this substring for the session to be +; considered as valid. +session.referer_check = + +; How many bytes to read from the file. +session.entropy_length = 0 + +; Specified here to create the session id. +session.entropy_file = + +;session.entropy_length = 16 + +;session.entropy_file = /dev/urandom + +; Set to {nocache,private,public,} to determine HTTP caching aspects +; or leave this empty to avoid sending anti-caching headers. +session.cache_limiter = nocache + +; Document expires after n minutes. +session.cache_expire = 180 + +; trans sid support is disabled by default. +; Use of trans sid may risk your users security. +; Use this option with caution. +; - User may send URL contains active session ID +; to other person via. email/irc/etc. +; - URL that contains active session ID may be stored +; in publically accessible computer. +; - User may access your site with the same session ID +; always using URL stored in browser's history or bookmarks. +session.use_trans_sid = 0 + +; Select a hash function +; 0: MD5 (128 bits) +; 1: SHA-1 (160 bits) +session.hash_function = 0 + +; Define how many bits are stored in each character when converting +; the binary hash data to something readable. +; +; 4 bits: 0-9, a-f +; 5 bits: 0-9, a-v +; 6 bits: 0-9, a-z, A-Z, "-", "," +session.hash_bits_per_character = 5 + +; The URL rewriter will look for URLs in a defined set of HTML tags. +; form/fieldset are special; if you include them here, the rewriter will +; add a hidden field with the info which is otherwise appended +; to URLs. If you want XHTML conformity, remove the form entry. +; Note that all valid entries require a "=", even if no value follows. +; url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" +url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset=" + +[Assertion] +; Assert(expr); active by default. +;assert.active = On + +; Issue a PHP warning for each failed assertion. +;assert.warning = On + +; Don't bail out by default. +;assert.bail = Off + +; User-function to be called if an assertion fails. +;assert.callback = 0 + +; Eval the expression with current error_reporting(). Set to true if you want +; error_reporting(0) around the eval(). +;assert.quiet_eval = 0 + +[mbstring] +; language for internal character representation. +;mbstring.language = Japanese + +; internal/script encoding. +; Some encoding cannot work as internal encoding. +; (e.g. SJIS, BIG5, ISO-2022-*) +;mbstring.internal_encoding = EUC-JP + +; http input encoding. +;mbstring.http_input = auto + +; http output encoding. mb_output_handler must be +; registered as output buffer to function +;mbstring.http_output = SJIS + +; enable automatic encoding translation according to +; mbstring.internal_encoding setting. Input chars are +; converted to internal encoding by setting this to On. +; Note: Do _not_ use automatic encoding translation for +; portable libs/applications. +;mbstring.encoding_translation = Off + +; automatic encoding detection order. +; auto means +;mbstring.detect_order = auto + +; substitute_character used when character cannot be converted +; one from another +;mbstring.substitute_character = none; + +; overload(replace) single byte functions by mbstring functions. +; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), +; etc. Possible values are 0,1,2,4 or combination of them. +; For example, 7 for overload everything. +; 0: No overload +; 1: Overload mail() function +; 2: Overload str*() functions +; 4: Overload ereg*() functions +;mbstring.func_overload = 0 + +; enable strict encoding detection. +;mbstring.strict_encoding = Off + +[gd] +; Tell the jpeg decode to libjpeg warnings and try to create +; a gd image. The warning will then be displayed as notices +; disabled by default +;gd.jpeg_ignore_warning = 0 + +[exif] +; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. +; With mbstring support this will automatically be converted into the encoding +; given by corresponding encode setting. When empty mbstring.internal_encoding +; is used. For the decode settings you can distinguish between motorola and +; intel byte order. A decode setting cannot be empty. +;exif.encode_unicode = ISO-8859-15 +;exif.decode_unicode_motorola = UCS-2BE +;exif.decode_unicode_intel = UCS-2LE +;exif.encode_jis = +;exif.decode_jis_motorola = JIS +;exif.decode_jis_intel = JIS + +[Tidy] +; The path to a default tidy configuration file to use when using tidy +;tidy.default_config = /usr/local/lib/php/default.tcfg + +; Should tidy clean and repair output automatically? +; WARNING: Do not use this option if you are generating non-html content +; such as dynamic images +tidy.clean_output = Off + +[soap] +; Enables or disables WSDL caching feature. +soap.wsdl_cache_enabled=1 +; Sets the directory name where SOAP extension will put cache files. +soap.wsdl_cache_dir="/tmp" +; (time to live) Sets the number of second while cached file will be used +; instead of original one. +soap.wsdl_cache_ttl=86400 + +; Local Variables: +; tab-width: 4 +; End: + +zend_extension=/usr/lib64/php/zend/ZendOptimizer-5.2.so diff --git a/projects/index.php b/projects/index.php new file mode 100644 index 0000000..35c16e9 --- /dev/null +++ b/projects/index.php @@ -0,0 +1,25 @@ + +Projects - aclindsay.com + + +
    +
    +

    Projects

    + +

    I am currently working on ChronOS Linux, a real-time addition to the Linux kernel, as well as associated libraries.

    +

    One project which I would love to actually work on if I ever had the time, can be found at acal.aclindsay.com.

    +

    My github page has several small projects I have worked on over time.

    +
    + +
    + + diff --git a/stylesheet.css b/stylesheet.css new file mode 100644 index 0000000..a16fb60 --- /dev/null +++ b/stylesheet.css @@ -0,0 +1,199 @@ +/** + * Handle Self-hosted True Type Fonts + */ +@font-face { + font-family: 'Cardo'; + font-style: normal; + font-weight: normal; + src: local('Cardo'), url('fonts/Cardo99s.ttf') format('truetype'); +} + +/** + * These styles handle layout + */ + +body { + margin: 0; + padding: 0; +} +#header-inner, #content, #footer-inner { + width: 80%; + min-width: 45em; + max-width: 60em; + margin: 0 auto; +} +#main, #sidebar { + position: relative; +} +#main { + float: left; + width: 73%; +} +#sidebar { + float: right; + width: 23%; +} +#footer { + clear: both; +} + +/** + * These styles handle look + */ + +body { + font: 12pt/18pt Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif; + font-family: 'Cardo', Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif; +/* font: normal 100% Helvetica, Arial, sans-serif;*/ + background-color: #eeeeee; +} +#header { + height: 150px; + width: 100%; + background-color: #88BBEE; + border-bottom: 6px solid #003366; +} +#header-inner { + position: relative; + background: url('graphics/stripedTree.png') no-repeat bottom left; + height: 100%; +} +#header-inner #title { + margin: 0; + padding: 0; + position: absolute; + height: 53px; + top: 0em; + right: 0em; + font-weight: bold; + font-size: 1.2em; + background: url('graphics/cornerStripedLeft.png') no-repeat bottom left; +} +#header-inner #title a{ + display: block; + margin: 0; + padding: 15px 20px 10px 20px; + text-decoration: none; + color: #666666; + background: url('graphics/cornerStripedRight.png') no-repeat top right; +} +#header-inner #title a:hover{ + color: #FFFFFF; +} +#content { + padding: 1em 0 0 0; +} +#main { + padding: 0 0 2em 0; + margin: 0; +} +#sidebar { + background-color: #f5f5f5; + margin: 1em 0 1em 0; + border: 2px solid #cccccc; + -moz-border-radius: 5px; + border-radius: 5px; + padding: 5px 0 5px 0; +} +#sidebar > * { + margin: .5em; +} +#footer { + margin: 0; + padding: 1em 0 1em 0; + background-color: #339933; + border-top: 6px solid #006600; + border-bottom: 6px solid #663300; +} +#footer a{ + color: #003366; +} +#footer a:hover{ + color: #000033; +} + + +div#tabs { + margin: 0; + padding: 0; + position: absolute; + right: 0px; + bottom: 0px; +} + +div#tabs ul { + margin: 0; + padding: 0; + list-style: none; + text-align: left; +} + +div#tabs ul li { + margin: 0; + padding: 0; + display:inline; +} + +div#tabs ul li a { + position: relative; + bottom: 3px; + font-weight: bold; + color: #333333; + margin: 0 0 0 17px; + padding: 3px; + text-decoration:none; + border-top: #003366 2px solid; + background-color: #88BBEE; +} +div#tabs ul li a:hover { + color: #DDD; + text-shadow: 3px 3px 3px #346; +} +a { + color: #2288aa; +} +a:hover { + color: #006699; +} + +/*Styles for Wordpress*/ +#sidebar ul { + padding: 0px; +} +#sidebar li { + list-style-type: none; +} +/* Wordpress Captions */ +.aligncenter, +div.aligncenter { + display: block; + margin-left: auto; + margin-right: auto; +} + +.wp-caption { + border: 1px solid #ddd; + text-align: center; + background-color: #f3f3f3; + padding-top: 4px; + margin: 10px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.wp-caption img { + margin: 0; + padding: 0; + border: 0 none; +} + +.wp-caption p.wp-caption-text { + font-size: 11px; + line-height: 17px; + padding: 0 4px 5px; + margin: 0; +} +/* End captions */ + diff --git a/svgparser/index.php b/svgparser/index.php new file mode 100644 index 0000000..92cfe0e --- /dev/null +++ b/svgparser/index.php @@ -0,0 +1,52 @@ + +SVG Parser - aclindsay.com + + + +
    +
    +

    Convert to Dojo 'dojox.gfx' format from SVG

    +

    The dojox.gfx tool is very powerful, but there is currently no easy way to convert drawings + from SVG into the format. The only existing tool I found was an XSL file, which was very simplistic, + but didn't cover many cases (example: gradient transformations). Therefore, if you wanted to use existing SVG + files with dojox.gfx, you had to convert the file by hand. This was extremely tedious, so I have developed a converter tool + with which you may convert existing SVG files into Javascript code ready to be used with dojox.gfx. If you have any comments or + suggestions for improvement, feel free to let me know at dojox dot gfx @t aclindsay D0T com.

    +
    SVG (XML) + + +
    +
    Javascript Code + +
    + +
    + +
    + + diff --git a/svgparser/parser/.htaccess b/svgparser/parser/.htaccess new file mode 100644 index 0000000..52ab9f9 --- /dev/null +++ b/svgparser/parser/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^.*$ index.php diff --git a/svgparser/parser/LICENSE b/svgparser/parser/LICENSE new file mode 100644 index 0000000..3cb6234 --- /dev/null +++ b/svgparser/parser/LICENSE @@ -0,0 +1,281 @@ + 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 + diff --git a/svgparser/parser/index.php b/svgparser/parser/index.php new file mode 100644 index 0000000..83a9bf6 --- /dev/null +++ b/svgparser/parser/index.php @@ -0,0 +1,344 @@ + + +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. +*/ + +require_once("parser/Parser.php"); + +$requestData = ''; +if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > 0) { + $httpContent = fopen('php://input', 'r'); + while ($data = fread($httpContent, 1024)) { + $requestData .= $data; + } + fclose($httpContent); +} + +if ($requestData == '') + exit; + +$parser = new Parser(); +$svg = $parser->parse($requestData); + +//first, create javascript objects for all the gradients +$linearGradients = $svg->getCompleteLinearGradients(); +$radialGradients = $svg->getCompleteRadialGradients(); +$paths = $svg->getPaths(); +$rects = $svg->getRectangles(); +$circles = $svg->getCircles(); +$ellipses = $svg->getEllipses(); +$lines = $svg->getLines(); +$polylines = $svg->getPolylines(); +$texts = $svg->getTexts(); + +echo "/* +SVG to dojox.gfx Parser +Copyright (C) 2009 Aaron Lindsay + +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. +*/\n\n"; +echo "//set 'g' equal to the dojo group you want to add this drawing as...\n//ex. var g = surface.createGroup()\n\n"; + +//echo all the linear gradients +foreach ($linearGradients as $gradient) { + //make sure the gradient has its transform(s) applied + if (!$gradient->transformsApplied()) + $gradient->applyTransforms(); + + echo "var gradient".$gradient->getId()." = {\n"; + echo "\ttype: \"linear\",\n"; + echo "\tx1: ".$gradient->getX1().", y1: ".$gradient->getY1().",\n"; + echo "\tx2: ".$gradient->getX2().", y2: ".$gradient->getY2().",\n"; + echo "\tcolors: [\n"; + + $stops = $gradient->getStops(); + for ($i = 0; $i < count($stops)-1; $i++) { + echo "\t\t{offset: ".$stops[$i]->getOffset().", color: \"".$stops[$i]->getColor()."\"},\n"; + } + echo "\t\t{offset: ".$stops[count($stops)-1]->getOffset().", color: \"".$stops[count($stops)-1]->getColor()."\"}\n"; + echo "\t]\n"; + echo "};\n"; +} + +//now, do the same for all the radial gradients +foreach ($radialGradients as $gradient) { + //make sure the gradient has its transform(s) applied + if (!$gradient->transformsApplied()) + $gradient->applyTransforms(); + + echo "var gradient".$gradient->getId()." = {\n"; + echo "\ttype: \"radial\",\n"; + echo "\tcx: ".$gradient->getCx().", cy: ".$gradient->getCy().",\n"; + echo "\tr: ".$gradient->getR().",\n"; + echo "\tfx: ".$gradient->getFx().", fy: ".$gradient->getFy().",\n"; + echo "\tcolors: [\n"; + + $stops = $gradient->getStops(); + for ($i = 0; $i < count($stops)-1; $i++) { + echo "\t\t{offset: ".$stops[$i]->getOffset().", color: \"".$stops[$i]->getColor()."\"},\n"; + } + echo "\t\t{offset: ".$stops[count($stops)-1]->getOffset().", color: \"".$stops[count($stops)-1]->getColor()."\"}\n"; + echo "\t]\n"; + echo "};\n"; +} + +//now, get all the paths +foreach ($paths as $path) { + echo "g.createPath({type: \"path\", path: \"".$path->getPath()."\"})"; + addFill($path); + addStroke($path); + addTransform($path); + echo ";\n"; +} + +//and all rectangles +foreach ($rects as $rect) { + echo "g.createRect({type: \"rect\", x: ".$rect->getX().", y: ".$rect->getY().", height: ".$rect->getHeight().", width: ".$rect->getWidth().", r: ".$rect->getR()."})"; + addFill($rect); + addStroke($rect); + addTransform($rect); + + echo ";\n"; +} + +//and all circles +foreach ($circles as $circle) { + echo "g.createCircle({type: \"circle\", cx:".$circle->getCx().", cy:".$circle->getCy().", r: ".$circle->getR()."})"; + addFill($circle); + addStroke($circle); + addTransform($circle); + + echo ";\n"; +} + +//and all ellipses +foreach ($ellipses as $ellipse) { + echo "g.createEllipse({type: \"ellipse\", cx:".$ellipse->getCx().", cy:".$ellipse->getCy().", rx: ".$ellipse->getRx().", ry: ".$ellipse->getRy()."})"; + addFill($ellipse); + addStroke($ellipse); + addTransform($ellipse); + + echo ";\n"; +} + +//and all lines +foreach ($lines as $line) { + echo "g.createLine({type: \"line\", x1:".$line->getX1().", y1:".$line->getY1().", x2:".$line->getX2().", y2:".$line->getY2()."})"; + addStroke($line); + addTransform($line); + echo ";\n"; +} + +//and all polylines +foreach ($polylines as $polyline) { + echo "//TODO - implement polylines\n"; +} + +//and all texts +foreach ($texts as $text) { + echo "g.createText({type: \"text\", x: ".$text->getX().", y: ".$text->getY().", text: \"".$text->getText()."\", align: \"".$text->getTextAnchor()."\", decoration: \"".$text->getTextDecoration()."\"})"; + addFill($text); + addStroke($text); + addTransform($text); + echo ";\n"; +} + +function addFont($shape) { + $putComma = false; + + //get the font family, if available + $family = $shape->getStyle("font-family"); + if ($family != null) { + if ($putComma) + echo ","; + else { + echo ".setFont({"; + $putComma = true; + } + + echo "family: \"".$family."\""; + } + + //get the font variant, if available + $variant = $shape->getStyle("font-variant"); + if ($variant != null) { + if ($putComma) + echo ","; + else { + echo ".setFont({"; + $putComma = true; + } + + echo "variant: \"".$variant."\""; + } + + //get the font size, if available + $size = $shape->getStyle("font-size"); + if ($size != null) { + if ($putComma) + echo ","; + else { + echo ".setFont({"; + $putComma = true; + } + + echo "size: \"".$size."\""; + } + + //get the font style, if available + $style = $shape->getStyle("font-style"); + if ($style != null) { + if ($putComma) + echo ","; + else { + echo ".setFont({"; + $putComma = true; + } + + echo "style: \"".$style."\""; + } + + //get the font weight, if available + $weight = $shape->getStyle("font-weight"); + if ($weight != null) { + if ($putComma) + echo ","; + else { + echo ".setFont({"; + $putComma = true; + } + + echo "style: \"".$weight."\""; + } + + if ($putComma) + echo "})"; +} + +function addFill($shape) { + $fill = $shape->getStyle("fill"); + if ($fill == null) + return; + + if (ereg("url\(.*\)", $fill)) { + $parts = split("[\(\)]", $fill); + $url = trim($parts[1], "#"); + echo ".setFill(gradient".$url.")"; + } else if (ereg("#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})", $fill)) { + echo ".setFill(\"".$fill."\")"; + } +} + +function addStroke($shape) { + $putComma = false; + + //get the stroke width, if available + $width = $shape->getStyle("stroke-width"); + if ($width != null) { + if ($putComma) + echo ","; + else { + echo ".setStroke({"; + $putComma = true; + } + + $width = trim($width, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); + echo "width: $width"; + } + + //get the stroke color, if available + $color = $shape->getStyle("stroke"); + if ($color != null) { + if ($putComma) + echo ","; + else { + echo ".setStroke({"; + $putComma = true; + } + + echo "color: \"".$color."\""; + } + + //get the stroke cap, if available + $cap = $shape->getStyle("stroke-linecap"); + if ($cap != null) { + if ($putComma) + echo ","; + else { + echo ".setStroke({"; + $putComma = true; + } + + echo "cap: \"$cap\""; + } + + //get the line join, if available + $join = $shape->getStyle("stroke-linejoin"); + if ($join != null) { + if ($putComma) + echo ","; + else { + echo ".setStroke({"; + $putComma = true; + } + + if ($join == "miter") + echo "join: 4"; + else + echo "join: \"$join\""; + } + + //if any kind of dash is made in SVG, convert it to 'style: "Dash"' in dojox.gfx + $style = $shape->getStyle("stroke-dasharray"); + if ($style != null && $style != 'none') { + if ($putComma) + echo ","; + else { + echo ".setStroke({"; + $putComma = true; + } + + echo "style: \"Dash\""; + } + + if ($putComma) + echo "})"; +} + +function addTransform($shape) { + //echo "\n==== transform:"; + //var_dump($shape->getTransform()); + $transform = $shape->getTransform(); + if (!$transform->isIdentity()) { + echo ".setTransform({xx:".$transform->getXx().", xy:".$transform->getXy().", dx:".$transform->getDx().", yy:".$transform->getYy().", yx:".$transform->getYx().", dy:".$transform->getDy()."})"; + } +} + +?> diff --git a/svgparser/parser/objects/Circle.php b/svgparser/parser/objects/Circle.php new file mode 100644 index 0000000..34f4bf7 --- /dev/null +++ b/svgparser/parser/objects/Circle.php @@ -0,0 +1,41 @@ + + +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. +*/ + +require_once("objects/Element.php"); + +class Circle extends Element { + private $cx; + private $cy; + private $r; + + public function __construct() { + $this->cx = 0; + $this->cy = 0; + $this->r = 0; + } + + public function getCx() { return $this->cx; } + public function getCy() { return $this->cy; } + public function getR() { return $this->r; } + public function setCx($x) { $this->cx = $x; } + public function setCy($x) { $this->cy = $x; } + public function setR($x) { $this->r = $x; } +} +?> diff --git a/svgparser/parser/objects/Element.php b/svgparser/parser/objects/Element.php new file mode 100644 index 0000000..32ff7c6 --- /dev/null +++ b/svgparser/parser/objects/Element.php @@ -0,0 +1,183 @@ + + +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. +*/ + +class Element { + private $id; + private $styles; + private $transforms; + private $transform; + + public function __construct() { + $this->id = ""; + $this->styles = array(); + $this->transforms = array(); + $this->transform = new Transform(); + } + + public function setId($newId) { + $this->id = $newId; + } + public function getId() { + return $this->id; + } + + public function setStyles($newStyles) { + $this->styles = array(); + $smallerStyles = split(";", $newStyles); + foreach($smallerStyles as $small) { + $parts = split(":", $small); + $this->styles[$parts[0]] = $parts[1]; + } + } + public function setStyle($key, $style) { + $this->styles[$key] = $style; + } + public function getStyles() { + return $this->styles; + } + public function getStyle($key) { + if ($this->styles && array_key_exists($key, $this->styles)) + return $this->styles[$key]; + else + return null; + } + public function setStroke($stroke) { + $this->styles["stroke"] = $stroke; + } + public function setStrokeWidth($width) { + $this->styles["stroke-width"] = $width; + } + public function setStrokeLinecap($linecap) { + $this->styles["stroke-linecap"] = $linecap; + } + + public function setFill($fill) { + $this->styles["fill"] = $fill; + } + + //$transform is a string of transformations + public function setTransforms($transform) { + $this->transforms = array(); + $this->addTransforms($transform); + $this->combineTransforms(); + } + + //$transform is a string of transformations + public function addTransforms($transform) { + $parts = split("\\)", $transform); + foreach ($parts as $part) { + //because ')' is the last character, we'll get an empty string here if we don't watch out + if ($part == "") + break; + + $transform = split("\\(", trim($part)); + switch (trim($transform[0])) { + case "matrix": + //get all the matrix elements, create a new transform and set them + $elements = split("[[:blank:],]+", trim($transform[1])); + $transformObject = new Transform(); + $transformObject->setFullMatrix($elements[0], $elements[1], $elements[2], $elements[3], $elements[4], $elements[5]); + $this->transforms[] = $transformObject; + break; + case "translate": + //get all the matrix elements, create a new translate transform and set them + $elements = split("[[:blank:],]+", trim($transform[1])); + $transformObject = new Transform(); + $transformObject->setTranslate($elements[0], $elements[1]); + $this->transforms[] = $transformObject; + break; + case "scale": + //get all the matrix elements, create a new scale transform and set them + $elements = split("[[:blank:],]+", trim($transform[1])); + $transformObject = new Transform(); + if (count($elements) > 1) + $transformObject->setScale($elements[0], $elements[1]); + else + $transformObject->setScale($elements[0]); + $this->transforms[] = $transformObject; + break; + case "rotate": + //get all the matrix elements, create a new rotate transform and set them + $elements = split("[[:blank:],]+", trim($transform[1])); + //if there are 3 arguments, they are angle, and (x,y) coordinates of the point to rotate about + //to handle this, we translate, rotate, and translate back + if (count($elements) >= 3) { + $transformObject1 = new Transform(); + $transformObject1->setTranslate(-$elements[1], -$elements[2]); + $this->transforms[] = $transformObject1; + + $transformObject2 = new Transform(); + $transformObject2->setRotate($elements[0]); + $this->transforms[] = $transformObject2; + + $transformObject3 = new Transform(); + $transformObject3->setTranslate($elements[1], $elements[2]); + $this->transforms[] = $transformObject3; + } else { + $transformObject = new Transform(); + $transformObject->setRotate($elements[0]); + $this->transforms[] = $transformObject; + } + break; + case "skewX": + //get all the matrix elements, create a new skew transform and set them + $elements = split("[[:blank:],]+", trim($transform[1])); + $transformObject = new Transform(); + $transformObject->setSkewX($elements[0]); + $this->transforms[] = $transformObject; + break; + case "skewY": + //get all the matrix elements, create a new skew transform and set them + $elements = split("[[:blank:],]+", trim($transform[1])); + $transformObject = new Transform(); + $transformObject->setSkewY($elements[0]); + $this->transforms[] = $transformObject; + break; + } + } + //combine all these into one transform + $this->combineTransforms(); + } + + + //combine all transforms into one transform and store in $this->transform + private function combineTransforms() { + $one = new Transform(); + foreach ($this->transforms as $transform) + $one->multiplyBy($transform); + $this->transform = $one; + } + + public function setTransform($transform) { + $this->transform = $transform; + $this->transforms = array(); + $this->transforms[] = $transform; + } + + public function getTransform() { + return $this->transform; + } + + //an ARRAY of Transform objects is returned + public function getTransforms() { + return $this->transforms; + } +} +?> diff --git a/svgparser/parser/objects/Ellipse.php b/svgparser/parser/objects/Ellipse.php new file mode 100644 index 0000000..4395df1 --- /dev/null +++ b/svgparser/parser/objects/Ellipse.php @@ -0,0 +1,45 @@ + + +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. +*/ + +require_once("objects/Element.php"); + +class Ellipse extends Element { + private $cx; + private $cy; + private $rx; + private $ry; + + public function __construct() { + $this->cx = 0; + $this->cy = 0; + $this->rx = 0; + $this->ry = 0; + } + + public function getCx() { return $this->cx; } + public function getCy() { return $this->cy; } + public function getRx() { return $this->rx; } + public function getRy() { return $this->ry; } + public function setCx($x) { $this->cx = $x; } + public function setCy($x) { $this->cy = $x; } + public function setRx($x) { $this->rx = $x; } + public function setRy($x) { $this->ry = $x; } +} +?> diff --git a/svgparser/parser/objects/Gradient.php b/svgparser/parser/objects/Gradient.php new file mode 100644 index 0000000..424b87a --- /dev/null +++ b/svgparser/parser/objects/Gradient.php @@ -0,0 +1,55 @@ + + +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. +*/ + +require_once("objects/Element.php"); + +require_once("objects/Transform.php"); + +class Gradient extends Element{ + private $link; + private $stops; + + public function __construct() { + parent::__construct(); + $this->stops = array(); + } + + public function setLink($link) { + $this->link = trim($link, " \t\n\r#"); + } + public function getLink() { + return isset($this->link)?$this->link:null; + } + + public function addStop($stop) { + $this->stops[] = $stop; + } + public function setStops($stops) { + $this->stops = $stops; + } + public function getStops() { + return $this->stops; + } + + public function isValid() { + return count($this->stops) > 0; + } +} +?> diff --git a/svgparser/parser/objects/GradientStop.php b/svgparser/parser/objects/GradientStop.php new file mode 100644 index 0000000..c71c5a1 --- /dev/null +++ b/svgparser/parser/objects/GradientStop.php @@ -0,0 +1,58 @@ + + +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. +*/ + +class GradientStop extends Element{ + private $offset; + + public function __construct() { + parent::__construct(); + $this->offset = 0; + } + + public function setColor($color) { + $this->setStyle("stop-color", $color); + } + public function getColor() { + $color = $this->getStyle("stop-color"); + if ($color == null) + return "#000000"; + else + return $color; + } + + public function setOpacity($opacity) { + $this->setStyle("stop-opacity", $opacity); + } + public function getOpacity() { + $opacity = $this->getStyle("stop-opacity"); + if ($opacity == null) + return 1; + else + return $opacity; + } + + public function setOffset($offset) { + $this->offset = $offset; + } + public function getOffset() { + return isset($this->offset)?$this->offset:0; + } +} +?> diff --git a/svgparser/parser/objects/Line.php b/svgparser/parser/objects/Line.php new file mode 100644 index 0000000..7642111 --- /dev/null +++ b/svgparser/parser/objects/Line.php @@ -0,0 +1,43 @@ + + +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. +*/ + +class Line extends Element { + private $x1; + private $y1; + private $x2; + private $y2; + + public function __construct() { + $this->x1 = 0; + $this->y1 = 0; + $this->x2 = 0; + $this->y2 = 0; + } + + public function getX1() { return $this->x1; } + public function getY1() { return $this->y1; } + public function getX2() { return $this->x2; } + public function getY2() { return $this->y2; } + public function setX1($x) { $this->x1 = $x; } + public function setY1($x) { $this->y1 = $x; } + public function setX2($x) { $this->x2 = $x; } + public function setY2($x) { $this->y2 = $x; } +} +?> diff --git a/svgparser/parser/objects/LinearGradient.php b/svgparser/parser/objects/LinearGradient.php new file mode 100644 index 0000000..c534ac6 --- /dev/null +++ b/svgparser/parser/objects/LinearGradient.php @@ -0,0 +1,90 @@ + + +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. +*/ + +require_once("objects/Gradient.php"); + +class LinearGradient extends Gradient { + private $x1; + private $y1; + private $x2; + private $y2; + + private $transformsApplied = false; + + public function __construct() { + parent::__construct(); + } + + public function setX1($x) { + $this->x1 = $x; + } + public function setY1($x) { + $this->y1 = $x; + } + public function setX2($x) { + $this->x2 = $x; + } + public function setY2($x) { + $this->y2 = $x; + } + + public function getX1() { + return $this->x1; + } + public function getY1() { + return $this->y1; + } + public function getX2() { + return $this->x2; + } + public function getY2() { + return $this->y2; + } + + public function isValid() { + if (!parent::isValid()) + return false; + if (!isset($this->x1) || !isset($this->y1) || !isset($this->x2) || !isset($this->y2)) + return false; + + return true; + } + + public function transformsApplied() { + return $this->transformsApplied; + } + + //apply all the transforms to the points in this gradient + public function applyTransforms() { + $transforms = $this->getTransforms(); + foreach($transforms as $transform) { + $oldX1 = $this->x1; + $oldY1 = $this->y1; + $oldX2 = $this->x2; + $oldY2 = $this->y2; + $this->x1 = $transform->applyToX($oldX1, $oldY1); + $this->y1 = $transform->applyToY($oldX1, $oldY1); + $this->x2 = $transform->applyToX($oldX2, $oldY2); + $this->y2 = $transform->applyToY($oldX2, $oldY2); + } + $this->transformsApplied = true; + } +} +?> diff --git a/svgparser/parser/objects/Path.php b/svgparser/parser/objects/Path.php new file mode 100644 index 0000000..265c3b0 --- /dev/null +++ b/svgparser/parser/objects/Path.php @@ -0,0 +1,38 @@ + + +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. +*/ + +require_once("objects/Element.php"); + +class Path extends Element { + private $path; + + public function __construct() { + parent::__construct(); + $this->path = ""; + } + + public function setPath($newPath) { + $this->path = $newPath; + } + public function getPath() { + return $this->path; + } +} +?> diff --git a/svgparser/parser/objects/Polyline.php b/svgparser/parser/objects/Polyline.php new file mode 100644 index 0000000..fcf5da8 --- /dev/null +++ b/svgparser/parser/objects/Polyline.php @@ -0,0 +1,37 @@ + + +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. +*/ + +require_once("objects/Element.php"); + +class Polyline extends Element { + private $points; + + public function __construct() { + $this->points=""; + } + + public function getPoints() { + return $this->points; + } + public function setPoints($x) { + $this->points = $x; + } +} +?> diff --git a/svgparser/parser/objects/RadialGradient.php b/svgparser/parser/objects/RadialGradient.php new file mode 100644 index 0000000..80461b1 --- /dev/null +++ b/svgparser/parser/objects/RadialGradient.php @@ -0,0 +1,97 @@ + + +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. +*/ + +require_once("objects/Gradient.php"); + +class RadialGradient extends Gradient { + private $cx; + private $cy; + private $r; + private $fx; + private $fy; + + private $transformsApplied = false; + + public function __construct() { + parent::__construct(); + } + + public function setCx($x) { + $this->cx = $x; + } + public function setCy($x) { + $this->cy = $x; + } + public function setR($x) { + $this->r = $x; + } + public function setFx($x) { + $this->fx = $x; + } + public function setFy($x) { + $this->fy = $x; + } + + public function getCx() { + return $this->cx; + } + public function getCy() { + return $this->cy; + } + public function getR() { + return $this->r; + } + public function getFx() { + return $this->fx; + } + public function getFy() { + return $this->fy; + } + + public function isValid() { + if (!parent::isValid()) + return false; + if (!isset($this->cx) || !isset($this->cy) || !isset($this->r) || !isset($this->fx) || !isset($this->fy)) + return false; + + return true; + } + + public function transformsApplied() { + return $this->transformsApplied; + } + + //apply all the transforms to the points in this gradient + public function applyTransforms() { + $transforms = $this->getTransforms(); + foreach($transforms as $transform) { + $oldCx = $this->cx; + $oldCy = $this->cy; + $oldFx = $this->fx; + $oldFy = $this->fy; + $this->cx = $transform->applyToX($oldCx, $oldCy); + $this->cy = $transform->applyToY($oldCx, $oldCy); + $this->fx = $transform->applyToX($oldFx, $oldFy); + $this->fy = $transform->applyToY($oldFx, $oldFy); + } + $this->transformsApplied = true; + } +} +?> diff --git a/svgparser/parser/objects/Rectangle.php b/svgparser/parser/objects/Rectangle.php new file mode 100644 index 0000000..ad5ba33 --- /dev/null +++ b/svgparser/parser/objects/Rectangle.php @@ -0,0 +1,66 @@ + + +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. +*/ + +require_once("objects/Element.php"); + +class Rectangle extends Element { + private $x; + private $y; + private $height; + private $width; + private $rx; + private $ry; + + public function __construct() { + $this->x = 0; + $this->y = 0; + $this->height = 0; + $this->width = 0; + $this->rx = null; + $this->ry = null; + } + + public function getX() { return $this->x; } + public function getY() { return $this->y; } + public function getHeight() { return $this->height; } + public function getWidth() { return $this->width; } + public function getRx() { return ($this->rx != null)?$this->rx:0; } + public function getRy() { return ($this->ry != null)?$this->ry:0; } + public function getR() { + if ($this->rx != null && $this->ry != null) + return ($this->rx + $this->ry) / 2; + else if ($this->rx != null) + return $this->rx; + else if ($this->ry != null) + return $this->ry; + else + return 0; + } + + public function setX($x) { $this->x = $x; } + public function setY($x) { $this->y = $x; } + public function setHeight($x) { $this->height = $x; } + public function setWidth($x) { $this->width = $x; } + public function setRx($x) { $this->rx = $x; } + public function setRy($x) { $this->ry = $x; } + public function setR($r) { $this->setRx($r); $this->setRy($r); } + +} +?> diff --git a/svgparser/parser/objects/SVG.php b/svgparser/parser/objects/SVG.php new file mode 100644 index 0000000..c76450e --- /dev/null +++ b/svgparser/parser/objects/SVG.php @@ -0,0 +1,153 @@ + + +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. +*/ + +class SVG { + private $paths; + private $rects; + private $circles; + private $ellipses; + private $lines; + private $polylines; + private $texts; + private $linearGradients; + private $radialGradients; + + public function __construct() { + $this->paths = array(); + $this->rects = array(); + $this->circles = array(); + $this->ellipses = array(); + $this->lines = array(); + $this->polylines = array(); + $this->texts = array(); + + $this->linearGradients = array(); + $this->radialGradients = array(); + } + + public function addPath($path) { + $this->paths[] = $path; + } + public function getPaths() { + return $this->paths; + } + + public function addRectangle($rect) { + $this->rects[] = $rect; + } + public function getRectangles() { + return $this->rects; + } + + public function addCircle($circle) { + $this->circles[] = $circle; + } + public function getCircles() { + return $this->circles; + } + + public function addEllipse($ellipse) { + $this->ellipses[] = $ellipse; + } + public function getEllipses() { + return $this->ellipses; + } + + public function addLine($line) { + $this->lines[] = $line; + } + public function getLines() { + return $this->lines; + } + + public function addPolyline($polyline) { + $this->polylines[] = $polyline; + } + public function getPolylines() { + return $this->polylines; + } + + public function addText($text) { + $this->texts[] = $text; + } + public function getTexts() { + return $this->texts; + } + + public function addLinearGradient($gradient) { + $this->linearGradients[] = $gradient; + } + public function getLinearGradients() { + return $this->linearGradients; + } + + public function addRadialGradient($gradient) { + $this->radialGradients[] = $gradient; + } + public function getRadialGradients() { + return $this->radialGradients; + } + + public function getCompleteLinearGradients() { + $validGradients = array(); + foreach($this->linearGradients as $gradient) { + if ($gradient->isValid()) { + $validGradients[] = $gradient; + } else if ($gradient->getLink() != null) { + $newGradient = $this->linkGradient($gradient); + if ($newGradient->isValid()) { + $validGradients[] = $newGradient; + } + } + } + return $validGradients; + } + + public function getCompleteRadialGradients() { + $validGradients = array(); + foreach($this->radialGradients as $gradient) { + if ($gradient->isValid()) { + $validGradients[] = $gradient; + } else if ($gradient->getLink() != null) { + $newGradient = $this->linkGradient($gradient); + if ($newGradient->isValid()) + $validGradients[] = $gradient; + } + } + return $validGradients; + } + + private function linkGradient($gradient) { + //search through all gradients for one with an id matching the link field + $link = $gradient->getLink(); + $toLink = null; + foreach($this->linearGradients as $match) { + if ($match->getId() == $link) { + $toLink = $match; + break; + } + } + if ($toLink != null) { + $gradient->setStops($toLink->getStops()); + } + return $gradient; + } +} +?> diff --git a/svgparser/parser/objects/Text.php b/svgparser/parser/objects/Text.php new file mode 100644 index 0000000..2afcde7 --- /dev/null +++ b/svgparser/parser/objects/Text.php @@ -0,0 +1,61 @@ + + +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. +*/ + +class Text extends Element { + private $x; + private $y; + private $text; + + public function __construct() { + $this->x = 0; + $this->y = 0; + $this->text = ""; + } + + public function getX() { return $this->x; } + public function getY() { return $this->y; } + public function getText() { return $this->text; } + public function setX($x) { $this->x = $x; } + public function setY($x) { $this->y = $x; } + public function setText($x) { $this->text = $x; } + + public function setTextAnchor($anchor) { + $this->setStyle("text-anchor", $anchor); + } + public function getTextAnchor() { + $anchor = $this->getStyle("text-anchor"); + if ($anchor == null) + return "start"; + else + return $anchor; + } + + public function setTextDecoration($decoration) { + $this->setStyle("text-decoration", $decoration); + } + public function getTextDecoration() { + $decoration = $this->getStyle("text-decoration"); + if ($decoration == null) + return "none"; + else + return $decoration; + } +} +?> diff --git a/svgparser/parser/objects/Transform.php b/svgparser/parser/objects/Transform.php new file mode 100644 index 0000000..70d3ed1 --- /dev/null +++ b/svgparser/parser/objects/Transform.php @@ -0,0 +1,106 @@ + + +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. +*/ + +class Transform { + private $xx; + private $xy; + private $yx; + private $yy; + private $dx; + private $dy; + + public function __construct() { + $this->xx = 1; + $this->xy = 0; + $this->yx = 0; + $this->yy = 1; + $this->dx = 0; + $this->dy = 0; + } + + public function setFullMatrix($newXx, $newXy, $newYx, $newYy, $newDx, $newDy) { + $this->xx = $newXx; + $this->xy = $newXy; + $this->yx = $newYx; + $this->yy = $newYy; + $this->dx = $newDx; + $this->dy = $newDy; + } + + public function getXx() { return $this->xx; } + public function getXy() { return $this->xy; } + public function getYx() { return $this->yx; } + public function getYy() { return $this->yy; } + public function getDx() { return $this->dx; } + public function getDy() { return $this->dy; } + public function setXx($x) { $this->xx = $x; } + public function setXy($x) { $this->xy = $x; } + public function setYx($x) { $this->yx = $x; } + public function setYy($x) { $this->yy = $x; } + public function setDx($x) { $this->dx = $x; } + public function setDy($x) { $this->dy = $x; } + + public function setTranslate($newDx, $newDy = 0) { + $this->setFullMatrix(1,0,0,1,$newDx, $newDy); + } + + public function setScale($scaleX, $scaleY = -1) { + if ($scaleY == -1) + $scaleY = $scaleX; + $this->setFullMatrix($scaleX, 0, 0, $scaleY, 0, 0); + } + + public function setRotate($angle) { + $this->setFullMatrix(cos(deg2rad($angle)), sin(deg2rad($angle)), -sin(deg2rad($angle)), cos(deg2rad($angle)), 0, 0); + } + + public function setSkewX($angle) { + $this->setFullMatrix(1, 0, tan(deg2rad($angle)), 1, 0, 0); + } + + public function setSkewY($angle) { + $this->setFullMatrix(1, tan(deg2rad($angle)), 0, 1, 0, 0); + } + + public function applyToX($x, $y) { + return $this->xx * $x + $this->xy * $y + $this->dx; + } + + public function applyToY($x, $y) { + return $this->yx * $x + $this->yy * $y + $this->dy; + } + + //does multiplication of the form [$this]*[$other] + //and stores the result in $this + public function multiplyBy($other) { + $xx = ($this->xx*$other->xx + $this->xy*$other->yx); + $xy = ($this->xx*$other->xy + $this->xy*$other->yy); + $dx = ($this->xx*$other->dx + $this->xy*$other->dy + $this->dx); + $yx = ($this->yx*$other->xx + $this->yy*$other->yx); + $yy = ($this->yx*$other->xy + $this->yy*$other->yy); + $dy = ($this->yx*$other->yx + $this->yy*$other->dy + $this->dy); + $this->setFullMatrix($xx, $xy, $yx, $yy, $dx, $dy); + } + + public function isIdentity() { + return ($this->xx == 1 && $this->xy == 0 && $this->yx == 0 && $this->yy == 1 && $this->dx == 0 && $this->dy == 0); + } +} +?> diff --git a/svgparser/parser/parser/Parser.php b/svgparser/parser/parser/Parser.php new file mode 100644 index 0000000..11b1e72 --- /dev/null +++ b/svgparser/parser/parser/Parser.php @@ -0,0 +1,397 @@ + + +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. +*/ + +require_once("objects/SVG.php"); + +require_once("objects/Path.php"); +require_once("objects/Rectangle.php"); +require_once("objects/Circle.php"); +require_once("objects/Ellipse.php"); +require_once("objects/Line.php"); +require_once("objects/Polyline.php"); +require_once("objects/Line.php"); +require_once("objects/Text.php"); + +require_once("objects/Gradient.php"); +require_once("objects/RadialGradient.php"); +require_once("objects/LinearGradient.php"); +require_once("objects/GradientStop.php"); + +require_once("objects/Transform.php"); + +class Parser { + private $elementStack; + private $svg; + private $transformStack; + private $characterDataStack; + + public function parse($SVGstring) { + //reset the stack of elements in case someone already ran this + unset($this->elementStack); + $this->elementStack = array(); + + //reset the stack of transforms in case someone already ran this + unset($this->transformStack); + $this->transformStack = array(); + + //reset the stack of character data (this is used for the text fields) + $this->characterDataStack = array(); + + $this->svg = new SVG(); + + //create the parser object + $parser = xml_parser_create(); + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); //set to 0 so all the elements don't get converted to upper case + xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); //we don't like extra white-space so skip it + + //set the handlers + xml_set_element_handler($parser, array($this, "startElementHandler"), array($this,"endElementHandler")); + xml_set_character_data_handler($parser, array($this, "characterDataHandler")); + + xml_parse($parser, $SVGstring); + xml_parser_free($parser); //parser... be free!!! + + return $this->svg; + } + + private function startElementHandler($parser, $name, $attribs) { + $currentTransform = new Transform(); + + switch ($name) { + case "path": + $path = new Path(); + if (array_key_exists("id", $attribs)) + $path->setId($attribs["id"]); + if (array_key_exists("d", $attribs)) + $path->setPath($attribs["d"]); + if (array_key_exists("style", $attribs)) + $path->setStyles($attribs["style"]); + if (array_key_exists("stroke", $attribs)) + $path->setStroke($attribs["stroke"]); + if (array_key_exists("stroke-width", $attribs)) + $path->setStrokeWidth($attribs["stroke-width"]); + if (array_key_exists("stroke-linecap", $attribs)) + $path->setStrokeLinecap($attribs["stroke-linecap"]); + if (array_key_exists("fill", $attribs)) + $path->setFill($attribs["fill"]); + if (array_key_exists("transform", $attribs)) { + $path->setTransforms($attribs["transform"]); + $currentTransform = $path->getTransform(); + } + $this->elementStack[] = $path; + break; + case "rect": + $rect = new Rectangle(); + if (array_key_exists("id", $attribs)) + $rect->setId($attribs["id"]); + if (array_key_exists("x", $attribs)) + $rect->setX($attribs["x"]); + if (array_key_exists("y", $attribs)) + $rect->setY($attribs["y"]); + if (array_key_exists("height", $attribs)) + $rect->setHeight($attribs["height"]); + if (array_key_exists("width", $attribs)) + $rect->setWidth($attribs["width"]); + if (array_key_exists("rx", $attribs)) + $rect->setRx($attribs["rx"]); + if (array_key_exists("ry", $attribs)) + $rect->setRy($attribs["ry"]); + if (array_key_exists("style", $attribs)) + $rect->setStyles($attribs["style"]); + if (array_key_exists("stroke", $attribs)) + $rect->setStroke($attribs["stroke"]); + if (array_key_exists("stroke-width", $attribs)) + $rect->setStrokeWidth($attribs["stroke-width"]); + if (array_key_exists("stroke-linecap", $attribs)) + $rect->setStrokeLinecap($attribs["stroke-linecap"]); + if (array_key_exists("fill", $attribs)) + $rect->setFill($attribs["fill"]); + if (array_key_exists("transform", $attribs)) { + $rect->setTransforms($attribs["transform"]); + $currentTransform = $rect->getTransform(); + } + $this->elementStack[] = $rect; + break; + case "circle": + $circle = new Circle(); + if (array_key_exists("id", $attribs)) + $circle->setId($attribs["id"]); + if (array_key_exists("cx", $attribs)) + $circle->setCx($attribs["cx"]); + if (array_key_exists("cy", $attribs)) + $circle->setCy($attribs["cy"]); + if (array_key_exists("r", $attribs)) + $circle->setR($attribs["r"]); + if (array_key_exists("style", $attribs)) + $circle->setStyles($attribs["style"]); + if (array_key_exists("stroke", $attribs)) + $circle->setStroke($attribs["stroke"]); + if (array_key_exists("stroke-width", $attribs)) + $circle->setStrokeWidth($attribs["stroke-width"]); + if (array_key_exists("stroke-linecap", $attribs)) + $circle->setStrokeLinecap($attribs["stroke-linecap"]); + if (array_key_exists("fill", $attribs)) + $circle->setFill($attribs["fill"]); + if (array_key_exists("transform", $attribs)) { + $circle->setTransforms($attribs["transform"]); + $currentTransform = $circle->getTransform(); + } + $this->elementStack[] = $circle; + break; + case "ellipse": + $ellipse = new Ellipse(); + if (array_key_exists("id", $attribs)) + $ellipse->setId($attribs["id"]); + if (array_key_exists("cx", $attribs)) + $ellipse->setCx($attribs["cx"]); + if (array_key_exists("cy", $attribs)) + $ellipse->setCy($attribs["cy"]); + if (array_key_exists("rx", $attribs)) + $ellipse->setRx($attribs["rx"]); + if (array_key_exists("ry", $attribs)) + $ellipse->setRy($attribs["ry"]); + if (array_key_exists("style", $attribs)) + $ellipse->setStyles($attribs["style"]); + if (array_key_exists("stroke", $attribs)) + $ellipse->setStroke($attribs["stroke"]); + if (array_key_exists("stroke-width", $attribs)) + $ellipse->setStrokeWidth($attribs["stroke-width"]); + if (array_key_exists("stroke-linecap", $attribs)) + $ellipse->setStrokeLinecap($attribs["stroke-linecap"]); + if (array_key_exists("fill", $attribs)) + $ellipse->setFill($attribs["fill"]); + if (array_key_exists("transform", $attribs)) { + $ellipse->setTransforms($attribs["transform"]); + $currentTransform = $ellipse->getTransform(); + } + $this->elementStack[] = $ellipse; + break; + case "line": + $line = new Line(); + if (array_key_exists("id", $attribs)) + $line->setId($attribs["id"]); + if (array_key_exists("x1", $attribs)) + $line->setX1($attribs["x1"]); + if (array_key_exists("y1", $attribs)) + $line->setY1($attribs["y1"]); + if (array_key_exists("x2", $attribs)) + $line->setX2($attribs["x2"]); + if (array_key_exists("y2", $attribs)) + $line->setY2($attribs["y2"]); + if (array_key_exists("style", $attribs)) + $line->setStyles($attribs["style"]); + if (array_key_exists("stroke", $attribs)) + $line->setStroke($attribs["stroke"]); + if (array_key_exists("stroke-width", $attribs)) + $line->setStrokeWidth($attribs["stroke-width"]); + if (array_key_exists("stroke-linecap", $attribs)) + $line->setStrokeLinecap($attribs["stroke-linecap"]); + if (array_key_exists("transform", $attribs)) { + $line->setTransforms($attribs["transform"]); + $currentTransform = $line->getTransform(); + } + $this->elementStack[] = $line; + break; + case "polyline": + $polyline = new Polyline(); + if (array_key_exists("id", $attribs)) + $polyline->setId($attribs["id"]); + if (array_key_exists("points", $attribs)) + $polyline->setPoints($attribs["points"]); + if (array_key_exists("style", $attribs)) + $polyline->setStyles($attribs["style"]); + if (array_key_exists("stroke", $attribs)) + $polyline->setStroke($attribs["stroke"]); + if (array_key_exists("stroke-width", $attribs)) + $polyline->setStrokeWidth($attribs["stroke-width"]); + if (array_key_exists("stroke-linecap", $attribs)) + $polyline->setStrokeLinecap($attribs["stroke-linecap"]); + if (array_key_exists("transform", $attribs)) { + $polyline->setTransforms($attribs["transform"]); + $currentTransform = $polyline->getTransform(); + } + $this->elementStack[] = $polyline; + break; + case "text": + case "tspan": + $text = new Text(); + if (array_key_exists("id", $attribs)) + $text->setId($attribs["id"]); + if (array_key_exists("x", $attribs)) + $text->setX($attribs["x"]); + if (array_key_exists("y", $attribs)) + $text->setY($attribs["y"]); + if (array_key_exists("style", $attribs)) + $text->setStyles($attribs["style"]); + if (array_key_exists("stroke", $attribs)) + $text->setStroke($attribs["stroke"]); + if (array_key_exists("stroke-width", $attribs)) + $text->setStrokeWidth($attribs["stroke-width"]); + if (array_key_exists("stroke-linecap", $attribs)) + $text->setStrokeLinecap($attribs["stroke-linecap"]); + if (array_key_exists("fill", $attribs)) + $text->setFill($attribs["fill"]); + if (array_key_exists("text-anchor", $attribs)) + $text->setTextAnchor($attribs["text-anchor"]); + if (array_key_exists("text-decoration", $attribs)) + $text->setTextDecoration($attribs["text-decoration"]); + if (array_key_exists("transform", $attribs)) { + $text->setTransforms($attribs["transform"]); + $currentTransform = $text->getTransform(); + } + $this->elementStack[] = $text; + break; + case "linearGradient": + $linearGradient = new LinearGradient(); + if (array_key_exists("id", $attribs)) + $linearGradient->setId($attribs["id"]); + if (array_key_exists("style", $attribs)) + $linearGradient->setStyles($attribs["style"]); + if (array_key_exists("gradientTransform", $attribs)) + $linearGradient->setTransforms($attribs["gradientTransform"]); + if (array_key_exists("xlink:href", $attribs)) + $linearGradient->setLink($attribs["xlink:href"]); + if (array_key_exists("x1", $attribs)) + $linearGradient->setX1($attribs["x1"]); + if (array_key_exists("y1", $attribs)) + $linearGradient->setY1($attribs["y1"]); + if (array_key_exists("x2", $attribs)) + $linearGradient->setX2($attribs["x2"]); + if (array_key_exists("y2", $attribs)) + $linearGradient->setY2($attribs["y2"]); + $this->elementStack[] = $linearGradient; + break; + case "stop": + $stop = new GradientStop(); + if (array_key_exists("id", $attribs)) + $stop->setId($attribs["id"]); + if (array_key_exists("style", $attribs)) + $stop->setStyles($attribs["style"]); + if (array_key_exists("offset", $attribs)) + $stop->setOffset($attribs["offset"]); + $this->elementStack[] = $stop; + break; + case "radialGradient": + $radialGradient = new RadialGradient(); + if (array_key_exists("id", $attribs)) + $radialGradient->setId($attribs["id"]); + if (array_key_exists("style", $attribs)) + $radialGradient->setStyles($attribs["style"]); + if (array_key_exists("gradientTransform", $attribs)) + $radialGradient->setTransforms($attribs["gradientTransform"]); + if (array_key_exists("xlink:href", $attribs)) + $radialGradient->setLink($attribs["xlink:href"]); + if (array_key_exists("cx", $attribs)) + $radialGradient->setCx($attribs["cx"]); + if (array_key_exists("cy", $attribs)) + $radialGradient->setCy($attribs["cy"]); + if (array_key_exists("r", $attribs)) + $radialGradient->setR($attribs["r"]); + if (array_key_exists("fx", $attribs)) + $radialGradient->setFx($attribs["fx"]); + if (array_key_exists("fy", $attribs)) + $radialGradient->setFy($attribs["fy"]); + $this->elementStack[] = $radialGradient; + break; + case "g": + if (array_key_exists("transform", $attribs)) { + $element = new Element(); + $element->setTransforms($attribs["transform"]); + $currentTransform = $element->getTransform(); + } + break; + } + //dump the transforms on the stack of them so if there are any nested elements, they can access them + $this->transformStack[] = $currentTransform; + } + + private function characterDataHandler($parser, $data) { + $this->characterDataStack[] = $data; + } + + private function endElementHandler($parser, $name) { + //as well as the last text data + $lastText = array_pop($this->characterDataStack); + + switch ($name) { + case "path": + $element = array_pop($this->elementStack); + $element->setTransform($this->getFullCurrentTransform()); + $this->svg->addPath($element); + break; + case "rect": + $element = array_pop($this->elementStack); + $element->setTransform($this->getFullCurrentTransform()); + $this->svg->addRectangle($element); + break; + case "circle": + $element = array_pop($this->elementStack); + $element->setTransform($this->getFullCurrentTransform()); + $this->svg->addCircle($element); + break; + case "ellipse": + $element = array_pop($this->elementStack); + $element->setTransform($this->getFullCurrentTransform()); + $this->svg->addEllipse($element); + break; + case "line": + $element = array_pop($this->elementStack); + $element->setTransform($this->getFullCurrentTransform()); + $this->svg->addLine($element); + break; + case "polyline": + $element = array_pop($this->elementStack); + $element->setTransform($this->getFullCurrentTransform()); + $this->svg->addPolyline($element); + break; + case "text": + case "tspan": + $element = array_pop($this->elementStack); + $element->setTransform($this->getFullCurrentTransform()); + $element->setText($lastText); + //add the element only if the text has at least some non-whitespace + if (trim($lastText) != "") + $this->svg->addText($element); + break; + case "linearGradient": + $this->svg->addLinearGradient(array_pop($this->elementStack)); + break; + case "stop": + $stop = array_pop($this->elementStack); + if ($this->elementStack[count($this->elementStack)-1] instanceof Gradient) + $this->elementStack[count($this->elementStack)-1]->addStop($stop); + break; + case "radialGradient": + $this->svg->addRadialGradient(array_pop($this->elementStack)); + break; + } + + //pop the last transform off the stack + array_pop($this->transformStack); + } + + private function getFullCurrentTransform() { + $one = new Transform(); + foreach ($this->transformStack as $transform) + $one->multiplyBy($transform); + return $one; + } +} +?> diff --git a/tabs.php b/tabs.php new file mode 100644 index 0000000..4850423 --- /dev/null +++ b/tabs.php @@ -0,0 +1,8 @@ +
    + +
    diff --git a/wedding/flowery.png b/wedding/flowery.png new file mode 100644 index 0000000..c1ce31b Binary files /dev/null and b/wedding/flowery.png differ diff --git a/wedding/index.html b/wedding/index.html new file mode 100644 index 0000000..18e7a1f --- /dev/null +++ b/wedding/index.html @@ -0,0 +1,29 @@ + + +Our Wedding + + + + +
    +
    + main +
    + +
    + + + diff --git a/wedding/stylesheet.css b/wedding/stylesheet.css new file mode 100644 index 0000000..06bf9e8 --- /dev/null +++ b/wedding/stylesheet.css @@ -0,0 +1,168 @@ +/** + * These styles handle importing the fonts + */ +@font-face { + font-family: 'Tangerine'; + font-style: normal; + font-weight: bold; + src: local('Tangerine'), url('http://aclindsay.com/fonts/Tangerine_Bold.ttf') format('truetype'); +} +@font-face { + font-family: 'Tangerine'; + font-style: normal; + font-weight: normal; + src: local('Tangerine'), url('http://aclindsay.com/fonts/Tangerine_Regular.ttf') format('truetype'); +} +@font-face { + font-family: 'IM Fell DW Pica'; + font-style: normal; + font-weight: normal; + src: local('IM FELL DW Pica Roman'), local('IM_FELL_DW_Pica_Roman'), url('http://aclindsay.com/fonts/IMFePIrm28P.ttf') format('truetype'); +} +@font-face { + font-family: 'Reenie Beanie'; + font-style: normal; + font-weight: normal; + src: local('Reenie Beanie'), url('http://aclindsay.com/fonts/ReenieBeanie.ttf') format('truetype'); +} + +/** + * These styles handle layout + */ + +body { + font-family: Helvetica, Arial, sans-serif; + margin: 0; + padding: 0; +} +#header-inner, #content, #footer-inner { + width: 80%; + min-width: 45em; + max-width: 60em; + margin: 0 auto; +} +#main, #sidebar { + position: relative; +} +#main { + float: left; + width: 73%; +} +#sidebar { + float: right; + width: 23%; +} +#footer { + clear: both; +} + +/** + * These styles handle look + */ + +body { + font: normal 100% Helvetica, Arial, sans-serif; + background-color: #eeeeee; +} +#header { + height: 150px; + width: 100%; +} +#header-inner { + position: relative; + background: #bb99bb url('flowery.png') 100% 90% no-repeat; + height: 100%; + -moz-border-radius-bottomleft: 15px; + -moz-border-radius-bottomright: 15px; + border-bottom-right-radius: 15px; + border-bottom-left-radius: 15px; + border-left: 2px solid #664455; + border-right: 2px solid #664455; + border-bottom: 2px solid #664455; + color: #222; +} +#header-inner #header-wedding { + position: absolute; + font-family: 'Reenie Beanie', arial, serif; + font-color: #444; + font-size: 1.2em; + top: .8em; + left: 14em; +} +#header-inner #header-aaron { + position: absolute; + font-family: 'IM Fell DW Pica', arial, serif; + font-weight: bold; + font-size: 1.5em; + top: 2.5em; + left: 3em; +} +#header-inner #header-and { + position: absolute; + font-family: 'Reenie Beanie', arial, serif; + font-color: #444; + top: 5.5em; + left: 19.5em; +} +#header-inner #header-elizabeth { + position: absolute; + font-family: 'Tangerine', arial, serif; + font-weight: bold; + font-size: 2em; + top: 3em; + left: 11em; +} +#header-inner #title { + margin: 0; + padding: 0; + position: absolute; + height: 53px; + top: 0em; + right: 0em; + font-weight: bold; + font-size: 1.2em; + background: url('graphics/cornerStripedLeft.png') no-repeat bottom left; +} +#header-inner #title a{ + display: block; + margin: 0; + padding: 15px 20px 10px 20px; + text-decoration: none; + color: #666666; + background: url('graphics/cornerStripedRight.png') no-repeat top right; +} +#header-inner #title a:hover{ + color: #FFFFFF; +} +#content { + padding: 1em 0 0 0; +} +#main { + padding: 0 0 2em 0; + margin: 0; +} +#sidebar { + background-color: #ffeeee; + margin: 1em 0 1em 0; + border: 2px solid #eebb88; + -moz-border-radius: 15px; + border-radius: 15px; + padding: 5px 0 5px 0; +} +#sidebar > * { + margin: .5em; +} +#footer { + margin: 0; + padding: 1em 0 1em 0; +} + +#footer-inner { + height: 25px; + padding: 1em 0 1em 0; + text-align: center; + background-color: #ccbbaa; + border: 2px solid #664455; + -moz-border-radius: 15px; + border-radius: 15px; +}