示例#1
0
function plugin_blockparser_parse($blockid)
{
    if ($f_contents = io_load_file(BLOCKS_DIR . $blockid . EXT)) {
        $contents = utils_kexplode($f_contents);
        return array_change_key_case($contents, CASE_LOWER);
    }
    // else:
    return false;
}
示例#2
0
function static_parse($id)
{
    if (!static_isvalid($id)) {
        return false;
    }
    if ($fname = static_exists($id)) {
        $entry = io_load_file($fname);
        return utils_kexplode($entry);
    }
    return array();
}
示例#3
0
function comment_parse($entryid, $id)
{
    $f = comment_exists($entryid, $id);
    if (!$f) {
        return false;
    }
    $fc = io_load_file($f);
    $arr = utils_kexplode($fc);
    //$arr['EMAIL'] = apply_filters('comment_email', $arr['EMAIL']);
    // hackish: dash to underscore for ip-address :( todo: clean this up here or somewhere else
    //$arr['ip_address'] = $arr['ip-address'];
    return array_change_key_case($arr, CASE_LOWER);
}
示例#4
0
function draft_parse($id)
{
    if ($fname = draft_exists($id)) {
        $entry = io_load_file($fname);
        $entry = utils_kexplode($entry);
        if (!isset($entry['categories'])) {
            $entry['categories'] = array();
        } else {
            $entry['categories'] = explode(',', $entry['categories']);
        }
        return $entry;
    }
    return array();
}
示例#5
0
 function main()
 {
     $success = -1;
     $ver = array('stable' => 'unknown', 'unstable' => 'unknown');
     $file = utils_geturl($this->web);
     if ($file) {
         $ver = utils_kexplode($file['content']);
         if (!isset($ver['stable'])) {
             $success = -1;
         } elseif (system_ver_compare($ver['stable'], SYSTEM_VER)) {
             $success = 1;
         } else {
             $success = 2;
         }
     } else {
         $success = -1;
     }
     $this->smarty->assign('updates', $ver);
     $this->smarty->assign('fpweb', $this->fpweb);
     $this->smarty->assign('sfweb', $this->sfweb);
     $this->smarty->assign('success', $success);
 }
示例#6
0
function entry_parse($id, $raw = false)
{
    $f = entry_exists($id);
    if (!$f) {
        return array();
    }
    $fc = io_load_file($f);
    if (!$fc) {
        return array();
    }
    $arr = utils_kexplode($fc);
    // propagates the error if entry does not exist
    if (isset($arr['categories']) && trim($arr['categories']) != '') {
        $cats = (array) explode(',', $arr['categories']);
        $arr['categories'] = (array) $cats;
    } else {
        $arr['categories'] = array();
    }
    // if (!is_array($arr['categories'])) die();
    if (!isset($arr['AUTHOR'])) {
        global $fp_config;
        $arr['AUTHOR'] = $fp_config['general']['author'];
    }
    if ($raw) {
        return $arr;
    }
    return $arr;
}
示例#7
0
 function parse_string($str)
 {
     $params = utils_kexplode(strtolower($str), ',:', false);
     $this->validate_array($params);
 }
示例#8
0
/**
 * Function for embedding videos
 *
 * @param string $action
 * @param array $attr
 * @param string $content
 * @param mixed $params Not used
 * @param mixed $node_object Not used
 * @return string
 */
function do_bbcode_video($action, $attr, $content, $params, $node_object)
{
    if ($action == 'validate') {
        return true;
    }
    $vurl = parse_url($attr['default']);
    if (isset($attr['type'])) {
        $type = $attr['type'];
    } else {
        // is it http://www.MYSITE.com  or http://MYSITE.com ?
        $web = explode('.', $vurl['host']);
        array_pop($web);
        $type = isset($web[1]) ? $web[1] : $web[0];
    }
    $query = utils_kexplode($vurl['query'], '=&');
    $the_url = null;
    $others = '';
    switch ($type) {
        case 'google':
            $the_url = "http://video.google.com/googleplayer.swf?docid={$query['docid']}";
            $others = '<param name="FlashVars" value="playerMode=embedded" />';
            break;
        case 'youtube':
            $the_url = "http://youtube.com/v/{$query['v']}";
            break;
        case 'default':
        default:
            $the_url = null;
    }
    if ($the_url) {
        $width = isset($attr['width']) ? $attr['width'] : '400';
        $height = isset($attr['height']) ? $attr['height'] : '326';
        $float = isset($attr['float']) ? "style=\"float: {$attr['float']}\" " : '';
        return '<object type="application/x-shockwave-flash" height="' . $height . '" width="' . $width . '" ' . $float . 'data="' . $the_url . '">' . '<param name="movie" value="' . $the_url . '" />' . $others . '</object>';
    }
    return '[unsupported video]';
}
示例#9
0
/**
 * function bdb_parse_entry
 *
 * <p>Parses the entry file passed as parameter; returns an associative array
 * of the file content</p>
 * Tipically, entry arrays are usually made of these keys
 * - VERSION	:	SimplePHPBlog or compatible blogs' version identifier string
 * - SUBJECT 	:	Subject of the entry
 * - CONTENT	:	Content of the entry
 * - DATE		:	UNIX filestamp to format by {@link date_format()}.
 * 
 * comments usually provide also 
 * - NAME 	:	author name
 * - EMAIL	:	author email (if any)
 * - URL	:	author website url (if any)
 *
 * A common usage of the function could be
 * <code>
 * <?php
 * $entry = bdb_parse_entry(bdb_filetoid($myid));
 * ?>
 * </code>
 *
 * @param string $file filepath of the blogdb entry
 * @return string
 *
 * @todo validate returned id
 */
function bdb_parse_entry($id, $type = null)
{
    if (file_exists($id)) {
        $file = $id;
    } else {
        $file = bdb_idtofile($id, $type);
    }
    if (file_exists($file)) {
        $contents = io_load_file($file);
        // TODO: here we must add compatibility to encoding conversion!
        // if "dumb" (legacy :D) mode is enabled (set to true in default.php, then we set parsing
        // to ignore array key case (defaults to true i.e. check them to be uppercase or failing otherwise
        $entry = utils_kexplode($contents, '|', !DUMB_MODE_ENABLED);
        return $entry;
    } else {
        return false;
    }
}
示例#10
0
function system_init_action_params()
{
    global $fp_params;
    $fp_params = array();
    if ($x = @$_GET['x']) {
        $fp_params = utils_kexplode($x, ':;', false);
    }
    $fp_params = array_merge($_GET, $fp_params);
}