ESTRICT fixes

This commit is contained in:
Grischa Brockhaus 2012-06-14 15:41:40 +02:00
parent 0d567145a6
commit 9f19378490
3 changed files with 11 additions and 9 deletions

View file

@ -1,7 +1,7 @@
<?php <?php
class CurlFetcher { class CurlFetcher {
public function file_get_contents($fileurl, $allow_curl =TRUE) { static public function file_get_contents($fileurl, $allow_curl =TRUE) {
$max_redirects = 5; $max_redirects = 5;
if (defined('OEMBED_USE_CURL') && OEMBED_USE_CURL && defined('CURLOPT_URL')) { if (defined('OEMBED_USE_CURL') && OEMBED_USE_CURL && defined('CURLOPT_URL')) {
$ch = curl_init(); $ch = curl_init();
@ -32,7 +32,7 @@ class CurlFetcher {
* - maxredirect is less or equal zero: no follow redirections * - maxredirect is less or equal zero: no follow redirections
* (see: http://php.net/manual/en/function.curl-setopt.php) * (see: http://php.net/manual/en/function.curl-setopt.php)
*/ */
private function curl_exec_follow(/*resource*/ $ch, /*int*/ &$maxredirect = null) { static private function curl_exec_follow(/*resource*/ $ch, /*int*/ &$maxredirect = null) {
$mr = $maxredirect === null ? 5 : intval($maxredirect); $mr = $maxredirect === null ? 5 : intval($maxredirect);
if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) { if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $mr > 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $mr > 0);

View file

@ -4,7 +4,7 @@
class OEmbedDatabase { class OEmbedDatabase {
function save_oembed($url, $oembed) { static function save_oembed($url, $oembed) {
if (empty($url) || !isset($oembed)) return false; if (empty($url) || !isset($oembed)) return false;
if (isset($oembed->html)) { if (isset($oembed->html)) {
$oembed->html = OEmbedDatabase::cleanup_html($oembed->html); $oembed->html = OEmbedDatabase::cleanup_html($oembed->html);
@ -18,7 +18,7 @@ class OEmbedDatabase {
return $oembed; return $oembed;
} }
function load_oembed($url) { static function load_oembed($url) {
global $serendipity; global $serendipity;
if (empty($url)) return null; if (empty($url)) return null;
@ -42,13 +42,14 @@ class OEmbedDatabase {
} }
return null; return null;
} }
function clear_cache() {
static function clear_cache() {
global $serendipity; global $serendipity;
$q = "delete from {$serendipity['dbPrefix']}" . PLUGIN_OEMBED_DATABASEVNAME; $q = "delete from {$serendipity['dbPrefix']}" . PLUGIN_OEMBED_DATABASEVNAME;
serendipity_db_schema_import($q); serendipity_db_schema_import($q);
} }
function install(&$obj) { static function install(&$obj) {
global $serendipity; global $serendipity;
if (!OEmbedDatabase::table_created(PLUGIN_OEMBED_DATABASEVNAME)) { if (!OEmbedDatabase::table_created(PLUGIN_OEMBED_DATABASEVNAME)) {
@ -71,7 +72,7 @@ class OEmbedDatabase {
} }
function table_created($table = PLUGIN_OEMBED_DATABASEVNAME) { static function table_created($table = PLUGIN_OEMBED_DATABASEVNAME) {
global $serendipity; global $serendipity;
$q = "select count(*) from {$serendipity['dbPrefix']}" . $table; $q = "select count(*) from {$serendipity['dbPrefix']}" . $table;
@ -84,7 +85,7 @@ class OEmbedDatabase {
} }
} }
function cleanup_html( $str ) { static function cleanup_html( $str ) {
$str = trim($str); $str = trim($str);
// Clear unicode stuff // Clear unicode stuff
$str=str_ireplace("\u003C","<",$str); $str=str_ireplace("\u003C","<",$str);

View file

@ -1,7 +1,8 @@
<?php <?php
class OEmbedTemplater { class OEmbedTemplater {
/* get the right template (s9y template path, then plugin path) and expand it */ /* get the right template (s9y template path, then plugin path) and expand it */
function fetchTemplate($filename, $oembed, $url) { static function fetchTemplate($filename, $oembed, $url) {
global $serendipity; global $serendipity;
if (!is_object($serendipity['smarty'])) if (!is_object($serendipity['smarty']))