}
        if (run("video:text:process", $run_result) != null) {
            $run_result = run("video:text:process", $run_result);
        }
        // URLs to links
        $run_result = run("weblogs:html_activate_urls", $run_result);
        // Remove the evil font tag
        $run_result = preg_replace("/<font[^>]*>/i", "", $run_result);
        $run_result = preg_replace("/<\\/font>/i", "", $run_result);
        // add rel="nofollow" to any links
        if ($addrelnofollow) {
            $run_result = preg_replace('/<a\\s+([^>]*)\\s+rel=/i', '<a $1 ', $run_result);
            $run_result = preg_replace('/<a\\s+/i', '<a rel="nofollow" ', $run_result);
        }
        // Text cutting
        // Commented out for the moment as it seems to disproportionately increase
        // memory usage / load
        /*
        global $individual;
        
        if (!isset($individual) || $individual != 1) {
            $run_result = preg_replace("/\{\{cut\}\}(.|\n)*(\{\{uncut\}\})?/","{{more}}",$run_result);
        } else {
            // $run_result = preg_replace("/\{\{cut\}\}/","",$run_result);
            $run_result = str_replace("{{cut}}","",$run_result);
            $run_result = str_replace("{{uncut}}","",$run_result);
        }
        */
        $setresult = elggcache_set("weblogs_text_process:weblogs", $cachekey, $run_result);
    }
}
예제 #2
0
/**
 * Get a single record as an object
 *
 * @uses $CFG
 * @param string $table The table to select from.
 * @param string $field1 the first field to check (optional).
 * @param string $value1 the value field1 must have (requred if field1 is given, else optional).
 * @param string $field2 the second field to check (optional).
 * @param string $value2 the value field2 must have (requred if field2 is given, else optional).
 * @param string $field3 the third field to check (optional).
 * @param string $value3 the value field3 must have (requred if field3 is given, else optional).
 * @return mixed a fieldset object containing the first mathcing record, or false if none found.
 */
function get_record($table, $field1 = null, $value1 = null, $field2 = null, $value2 = null, $field3 = null, $value3 = null, $fields = '*')
{
    global $CFG;
    $trycache = false;
    //just cache things by primary key for now
    if ($field1 == "ident" && $value1 == intval($value1) && empty($field2) && empty($value2) && empty($field3) && empty($value3) && $fields == "*") {
        $trycache = true;
        $cacheval = elggcache_get($table, $field1 . "_" . intval($value1));
        if (!is_null($cacheval)) {
            return $cacheval;
        } else {
        }
    }
    $select = where_clause_prepared($field1, $field2, $field3);
    $values = where_values_prepared($value1, $value2, $value3);
    $returnvalue = get_record_sql('SELECT ' . $fields . ' FROM ' . $CFG->prefix . $table . ' ' . $select, $values);
    if ($trycache) {
        $setres = elggcache_set($table, $field1 . "_" . $value1, $returnvalue);
    }
    return $returnvalue;
}