> pictools > doc > pkscripts
> pictools > doc > pkscripts
Pictools: How Things Work
V3.3 (419)
pkscripts.php
/library/pkscripts.php
Code for finding and parsing captions file (invoked by servepicture.php , slideshow, and urlHandler)
usage, in PHP code: include_once($sp->root . "/library/pkscripts.php");
function findCoveringCapFile($dir, $pattern)
Searches directory dir (a site-rooted name) and its parents for a captions (.cap) file satisfying pattern. Returns FALSE for failure or a two-element array:
  • file
  • the text of the file
Picture directories are supposed to have a file localcaptions.cap that will match, but older directories may lack that file. Hence findCoveringCap file is provided to search up the tree for an applicable captions file. servepicture.php wants a captions file containing a particular picture. It passes the search pattern:
/\[pixname\.[alphanum]\]/
SlideShow.php wants a captions file for a particular segment. It passes in the pattern
/^file: segmentname{endofword}/
function parsecaps($f, $pix)
Parse the .cap file $f to find the entry for $pix. Return an associative array with values
array index   form of the file line providing the value
rawcaption   [$pix.ext] caption
pixname   [$pix.ext] caption
imageext   [$pix.ext] caption
prev   prior [...] caption
next   subsequent [...] caption
seg   file: seg title
title   file: seg title
subtitle   subtitle: xxx
picdir   picturesdir: ddddd
function setframeparms($pixinfo)
where $pixinfo is an array as returned from parsecaps. Set the frameparm.xxx properties. This method is called by servepicture to set those properties. Servepicture then calls (the value of property frame.wholepage, default:) frame.php, which fetches the frameparm properties to determine what to show.
function findCapFile($dir, $local, $pattern) (unused, although more general than findCoveringCapFile)
Look for a .cap file in $dir and its children, where said .cap file matches $pattern. If $local is not null, it is a .cap file to be placed at the front of the list. Usefull patterns are /\[pixname\.[alphanum]\]/and /^file: segmentname{endofword}/.  Return FALSE or a two-element array: [file, the text of the file]. $dir and $local are site rooted.
 
Copyright © 2016 ZweiBieren, All rights reserved. Jul 4, 2016 21:35 GMT Page maintained by ZweiBieren