Example #1
0
    $gBitSystem->storeConfig('cascader_style', NULL);
}
// create a css file based on the user specifications
if (!empty($_REQUEST['create_style'])) {
    $cascaderCss = $gCascader->createHeader();
    $cascaderCss .= $gCascader->createCss($_REQUEST['cascader']);
    if ($cssUrl = $gCascader->writeCss($cascaderCss)) {
        $feedback['success'] = tra("The css file was stored to") . ": " . $cssUrl;
    } else {
        $feedback['error'] = tra("There was a problem storing your custom css file.");
    }
    $gBitSystem->storeConfig('cascader_style', $cssUrl);
}
// apply an existing style
if (!empty($_REQUEST['apply_style'])) {
    $gBitSystem->storeConfig('cascader_style', LibertyAttachable::getStorageUrl() . $_REQUEST['apply_style']);
}
// unset the custom style color settings
if (!empty($_REQUEST['clear_style'])) {
    $gBitSystem->storeConfig('cascader_style', NULL);
}
// remove a style file
if (!empty($_REQUEST['remove_style'])) {
    if ($gCascader->expunge($_REQUEST['remove_style'])) {
        // remove the config entry if we're removing the css file we're currently using
        if (preg_match("/" . $_REQUEST['remove_style'] . "\$/", $gBitSystem->getConfig('cascader_style'))) {
            $gBitSystem->storeConfig('cascader_style', NULL);
        }
        $feedback['success'] = tra("The css file was successfully removed from your system");
    }
}
Example #2
0
 function getStorageUrl($pSubDir = NULL)
 {
     return LibertyAttachable::getStorageUrl($pSubDir, NULL, PACKAGER_PKG_NAME);
 }
Example #3
0
 /**
  * Write CSS to file
  *
  * @param array $pStyleName Name of the file to store it to
  * @param array $pString
  * @access public
  * @return the URL to the file just stored - ready for linking
  */
 function writeCss($pString = NULL)
 {
     if ($this->isValid() && !empty($pString) && ($path = LibertyAttachable::getStoragePath())) {
         // We need to work out what name to use
         $storefile = $this->mInfo['date'] . '-' . str_replace(" ", "_", $this->mTitle) . '.css';
         $fh = fopen($path . $storefile, 'w');
         fwrite($fh, $pString);
         fclose($fh);
         return LibertyAttachable::getStorageUrl() . $storefile;
     }
 }