function SitegalleryEditForm() { parent::MailForm(__FILE__); page_title(intl_get('Edit Album Description')); $multi = false; if (intl_lang() == intl_default_lang()) { $ps1 = new PropertySet('sitegallery', 'album_title'); $ps2 = new PropertySet('sitegallery', 'album_description'); $ps3 = new PropertySet('sitegallery', 'album_date'); } else { $this->lang = intl_lang(); $this->reflang = intl_default_lang(); $multi = true; $ps1 = new PropertySet('sitegallery', 'album_title_' . intl_lang()); $ps2 = new PropertySet('sitegallery', 'album_description_' . intl_lang()); $ps3 = new PropertySet('sitegallery', 'album_date'); $ps4 = new PropertySet('sitegallery', 'album_title'); $ps5 = new PropertySet('sitegallery', 'album_description'); } global $cgi; $name = $ps1->get($cgi->album); if (!empty($name)) { $this->widgets['title']->setValue($name); } $desc = $ps2->get($cgi->album); if (!empty($desc)) { $this->widgets['description']->setValue($desc); } $date = $ps3->get($cgi->album); if (!empty($date)) { $this->widgets['date']->setValue($date); } if ($multi) { $n = $ps4->get($cgi->album); if (!empty($n)) { $this->widgets['title_ref'] =& $this->widgets['title_ref']->changeType('info'); $this->widgets['title_ref']->setValue($n); $this->widgets['title_ref']->htmlentities = false; } $n = $ps5->get($cgi->album); if (!empty($n)) { $this->widgets['description_ref'] =& $this->widgets['description_ref']->changeType('info'); $this->widgets['description_ref']->setValue(nl2br($n)); $this->widgets['description_ref']->alt = intl_get('Reference Description'); $this->widgets['description_ref']->htmlentities = false; } $langs = intl_get_langs(); $this->message = intl_get('Language') . ': ' . $langs[intl_lang()]; } }
/** * Sets the actual value for this widget. * * @access public * @param string $value * */ function setValue($value = '') { loader_import('saf.Database.PropertySet'); $ps = new PropertySet('mailform', 'snippet'); $val = $ps->get($value); if ($val) { $this->data_value = $val; } else { $this->data_value = $value; } }
<?php loader_import('saf.Database.PropertySet'); $ps = new PropertySet('mailform', 'snippet'); echo $ps->get($parameters['code']);
/** * Fetches a remote XML document and returns an object structure * parsed by SloppyDOM. Returns false if there is a parsing * error, and sets the $error property with the error message. * $expires can be set to either 'auto' (the default), which * tries to discover the cache duration based on the * syn:updatePeriod and syn:updateFrequency values in the * feed itself, and defaults to 1 hour (3600 seconds) if they * are not present. If $expires is set to a number, that is * used as the number of seconds to cache the feed for. * * @access public * @param string * @param mixed * @return object */ function &fetch($url, $expires = 'auto') { $ps = new PropertySet('rss_fetch', 'source'); $doc = false; $res = $ps->get($url); if ($res) { $doc = unserialize($res); if ($doc->_expires < time()) { $doc = false; } } if (!$doc) { if (extension_loaded('curl')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_MAXREDIRS, 3); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); $rssfeed = curl_exec($ch); if (!$rssfeed) { $this->error = 'RSS source not found: ' . curl_error($ch) . ' (' . curl_errno($ch) . ')'; curl_close($ch); return false; } curl_close($ch); } else { $rssfeed = @file($url); if (!is_array($rssfeed) || count($rssfeed) <= 0) { $this->error = 'RSS source not found'; return false; } $rssfeed = @join('', $rssfeed); } $sloppy = new SloppyDOM(); $doc = $sloppy->parse($rssfeed); if (!$doc) { $this->error = $sloppy->error; return false; } $root = $doc->root->name; $ns = false; foreach (array_keys($doc->root->attributes) as $k) { if ($doc->root->attributes[$k]->value == 'http://purl.org/rss/1.0/modules/syndication/') { $ns = str_replace('xmlns:', '', $doc->root->attributes[$k]->name); } } if (!$ns) { $ns = 'syn'; } // auto tries to auto-discover the cache expiration time if ($expires == 'auto') { $node =& $doc->query($root . '/channel/' . $ns . ':updatePeriod'); if (is_object($node)) { switch ($node->content) { case 'yearly': $node =& $doc->query($root . '/channel/' . $ns . ':updateFrequency'); $expires = $node->content * 31536000; break; case 'monthly': $node =& $doc->query($root . '/channel/' . $ns . ':updateFrequency'); $expires = $node->content * 2592000; break; case 'weekly': $node =& $doc->query($root . '/channel/' . $ns . ':updateFrequency'); $expires = $node->content * 604800; break; case 'daily': $node =& $doc->query($root . '/channel/' . $ns . ':updateFrequency'); $expires = $node->content * 86400; break; case 'hourly': default: $node =& $doc->query($root . '/channel/' . $ns . ':updateFrequency'); $expires = $node->content * 3600; break; } } else { // if all else fails, default to 1 hour $expires = 3600; } // require an expiry time -- can't be none } elseif ($expires <= 0) { $expires = 3600; } $doc->_expires = time() + $expires; $ps->set($url, serialize($doc)); } return $doc; }
$ps2 = new PropertySet('sitegallery', 'album_description'); $ps3 = new PropertySet('sitegallery', 'album_date'); } else { $ps1 = new PropertySet('sitegallery', 'album_title_' . intl_lang()); $ps2 = new PropertySet('sitegallery', 'album_description_' . intl_lang()); $ps3 = new PropertySet('sitegallery', 'album_date'); } foreach ($files as $k => $v) { if (!@is_dir($path . '/' . $v)) { continue; } $galleries[] = array('path' => $prefix . $v, 'name' => ucwords(preg_replace('/[^a-zA-Z\'-]+/', ' ', $v)), 'ts' => filemtime($path . '/' . $v), 'count' => sitegallery_count_images($path . '/' . $v), 'thumb' => sitegallery_get_thumbnail(sitegallery_first_image($path . '/' . $v)), 'desc' => ''); $name = $ps1->get($prefix . $v); if (!empty($name)) { $galleries[count($galleries) - 1]['name'] = $name; } $desc = $ps2->get($prefix . $v); if (!empty($desc)) { $galleries[count($galleries) - 1]['desc'] = nl2br($desc); } $date = $ps3->get($prefix . $v); if (!empty($date)) { $galleries[count($galleries) - 1]['ts'] = strtotime($date); } } usort($galleries, 'sitegallery_sort_galleries'); if ($context == 'action') { page_title(appconf('title')); } echo template_simple('galleries.spt', $galleries); //info ($galleries);