summaryrefslogtreecommitdiff
path: root/src/php
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2014-06-28 15:30:53 -0400
committerAllen Winter <allen.winter@kdab.com>2014-06-28 15:30:53 -0400
commitc363e524f603b4dbeb5bbde5971e7d1c9b26b206 (patch)
treeba17e68406efd25045f86b0c5403c6c4273f1097 /src/php
downloadlibical-git-0.48.tar.gz
libical 0.48 (non-ancestor)v0.480.48
Diffstat (limited to 'src/php')
-rw-r--r--src/php/Makefile13
-rw-r--r--src/php/README17
-rw-r--r--src/php/test.php21
3 files changed, 51 insertions, 0 deletions
diff --git a/src/php/Makefile b/src/php/Makefile
new file mode 100644
index 00000000..f371a382
--- /dev/null
+++ b/src/php/Makefile
@@ -0,0 +1,13 @@
+all: LibicalWrap.so
+
+LibicalWrap.so: LibicalWrap.o
+ gcc -shared -L/usr/lib -rdynamic LibicalWrap.o ../libical/.libs/libical.a ../libicalss/.libs/libicalss.a -o LibicalWrap.so
+
+LibicalWrap.o: LibicalWrap.c
+ gcc -fpic -I/usr/include/php4/TSRM/ -I/usr/include/php4/ -I/usr/include/php4/Zend -I/usr/include/php4/main -c LibicalWrap.c -o LibicalWrap.o
+
+LibicalWrap.c: LibicalWrap.i
+ swig -php -o LibicalWrap.c LibicalWrap.i
+
+clean:
+ rm LibicalWrap.so LibicalWrap.o LibicalWrap.c
diff --git a/src/php/README b/src/php/README
new file mode 100644
index 00000000..15088204
--- /dev/null
+++ b/src/php/README
@@ -0,0 +1,17 @@
+Arnout Engelen pointed out, that you could create a php libical wrapper:
+
+PHP currently seems to lack proper iCalendar libraries.
+Since there already is a LibicalWrap.i for the Python
+bindings, it's not very hard to make a libical .so that
+can be accessed from PHP. Would be a valuable building
+block in the practical adoption of the iCalendar
+standard (imho).
+
+I'm attaching a Makefile how I whipped together the
+.so, and a small example of how to use the resulting
+library. Obviously this is not good enough for in the
+official distribution, but it'll probably give you an
+idea of how to make a PHP binding.
+
+However, it's here for documentation purposes, until s.b. comes around the corner
+with the demand and a Patch how to implement it clean. Feeling addressed? Send Diffs!
diff --git a/src/php/test.php b/src/php/test.php
new file mode 100644
index 00000000..98ee7c8d
--- /dev/null
+++ b/src/php/test.php
@@ -0,0 +1,21 @@
+<?php
+
+// '../../../../' is a dirty hack to be able to store LibicalWrap.so in my
+// homedir instead of in the machine-global directory
+
+if (dl('../../../../home/arnouten/dev/libical-0.23/src/php/LibicalWrap.so')) {
+ print "Success\n";
+} else {
+ print "Problem\n";
+ exit();
+}
+
+$calstr = `cat /home/qharmony/public_html/kalender/oldcode/cal/calendars/US32Holidays.ics`;
+
+$calendar = icalcomponent_new_from_string($calstr);
+
+$comp = icalcomponent_get_first_component($calendar, 1);
+
+print icalcomponent_as_ical_string($comp);
+
+?>