예제 #1
0
function copy_config_file($dbname, $username, $password, $dbhost, $tableprefix)
{
    $password = addslashes($password);
    $abs_url = get_absolute_url();
    $rel_url = get_relative_url();
    $config_sample = file(ABS_PATH . 'config-sample.php');
    foreach ($config_sample as $line_num => $line) {
        switch (substr($line, 0, 16)) {
            case "define('DB_NAME'":
                $config_sample[$line_num] = str_replace("database_name", $dbname, $line);
                break;
            case "define('DB_USER'":
                $config_sample[$line_num] = str_replace("'username'", "'{$username}'", $line);
                break;
            case "define('DB_PASSW":
                $config_sample[$line_num] = str_replace("'password'", "'{$password}'", $line);
                break;
            case "define('DB_HOST'":
                $config_sample[$line_num] = str_replace("localhost", $dbhost, $line);
                break;
            case "define('DB_TABLE":
                $config_sample[$line_num] = str_replace('oc_', $tableprefix, $line);
                break;
            case "define('REL_WEB_":
                $config_sample[$line_num] = str_replace('rel_here', $rel_url, $line);
                break;
            case "define('WEB_PATH":
                $config_sample[$line_num] = str_replace('http://localhost', $abs_url, $line);
                break;
        }
    }
    $handle = fopen(ABS_PATH . 'config.php', 'w');
    foreach ($config_sample as $line) {
        fwrite($handle, $line);
    }
    fclose($handle);
    chmod(ABS_PATH . 'config.php', 0666);
}
예제 #2
0
function spyropress_conditional_scripts()
{
    $content = '
  		<!--[if IE]>
			<link rel="stylesheet" href="' . assets_css() . 'ie.css">
		<![endif]-->

		<!--[if lte IE 8]>
			<script src="' . assets() . 'vendor/respond/respond.js"></script>
            <script src="' . assets() . 'vendor/excanvas/excanvas.js"></script>
		<![endif]-->';
    echo get_relative_url($content);
}
예제 #3
0
/**
 * Place Fav and Apple Icon
 */
function spyropress_fav_touch_icons()
{
    $output = '';
    if ($favicon = get_setting('custom_favicon')) {
        $output .= '<link rel="shortcut icon" href="' . $favicon . '"/>' . "\n";
    }
    if ($apple_small = get_setting('apple_small')) {
        $output .= '<link rel="apple-touch-icon" href="' . $apple_small . '">' . "\n";
    }
    if ($apple_medium = get_setting('apple_medium')) {
        $output .= '<link rel="apple-touch-icon" sizes="72x72" href="' . $apple_medium . '">' . "\n";
    }
    if ($apple_large = get_setting('apple_large')) {
        $output .= '<link rel="apple-touch-icon" sizes="114x114" href="' . $apple_large . '">' . "\n";
    }
    if ($output) {
        echo '<!--Le fav and touch icons-->' . "\n";
        echo get_relative_url($output);
        echo '<!--/Le fav and touch icons-->' . "\n";
    }
}