wordpress, problem s diakritikou v téme

Programovacie jazyky, rady, poradňa...
kolac
Star
Star
Používateľov profilový obrázok
Príspevky: 635
Registrovaný: 15 apr 2007, 16:18
Bydlisko: Košice
Kontaktovať používateľa:

wordpress, problem s diakritikou v téme

Príspevok od používateľa kolac »

Ahojte,

pouzivam wordpress verzie 2.9.2 so svk prekladom. Tema nieje "optimalizovana " pre slovencinu.

Mam nasledovny problem, ked upravujem napr. niektore doinstalovane moduly, aby v nich fungovala diakritika ( otvorim si dany subor cez notepad napr. a prestavim kodovanie na UTF-8 ), diakritika funguje no z neznameho dovodu sa v teme spravi par posunov grafiky. Nechapem tomu. Upravujem dany modul, nenarabam priamo s temou.

Mohlo by to suvisiet s tym, ze som nijak neupravil povodnu hlavicku temy ?

Kód: Vybrať všetko

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
mate niekto nejake napady ?
hojko
Site Admin
Site Admin
Používateľov profilový obrázok
Príspevky: 38515
Registrovaný: 24 apr 2004, 18:29
Bydlisko: Európa
Kontaktovať používateľa:

Re: wordpress, problem s diakritikou v téme

Príspevok od používateľa hojko »

Neviem, ci klasicky Notepad zvlada UTF-8, myslim, ze nie. Jedine ak by si pouzival Notebad+ alebo PSPad.

Co tak hodit screeny, aby bolo vidiet ten posun, pripadne oznacit dane miesto a hodit na ukazku vyslednu cast zdrojoveho kodu???
websterko
Medium Expert
Medium Expert
Používateľov profilový obrázok
Príspevky: 122
Registrovaný: 31 dec 2005, 12:57
Bydlisko: Bratislava
Kontaktovať používateľa:

Re: wordpress, problem s diakritikou v téme

Príspevok od používateľa websterko »

mne to dakedy robilo tiez.... pomohlo nainstalovanie pspadu... a editacia suborov v nom
kolac
Star
Star
Používateľov profilový obrázok
Príspevky: 635
Registrovaný: 15 apr 2007, 16:18
Bydlisko: Košice
Kontaktovať používateľa:

Re: wordpress, problem s diakritikou v téme

Príspevok od používateľa kolac »

Ak pouzivam na editovanie notepad2, uz sa tie posuvy nerobia, no problem s diakritikou som stále neodstranil.

Riešim momentalne to, že kontaktny formular miesto spravnej diakritiky posiela nieco taketo

Kód: Vybrať všetko

me&Aring;ˆo napísal/a:
1.) na trvalo som upravil hlavicku v teme, tj:

Kód: Vybrať všetko

<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=windows-1250" />
2.) v suboroch danej temy som prestavil kodovanie na UTF-8

... Problem pretrvava. Ake kodovanie pouzivate vy ?
caesar1987
Addict
Addict
Používateľov profilový obrázok
Príspevky: 3001
Registrovaný: 02 okt 2005, 0:57
Bydlisko: Nové Zámky
Kontaktovať používateľa:

Re: wordpress, problem s diakritikou v téme

Príspevok od používateľa caesar1987 »

Kód: Vybrať všetko

charset=windows-1250
preco si tam dal toto kodovanie a nie utf-8 ako chces?
kolac
Star
Star
Používateľov profilový obrázok
Príspevky: 635
Registrovaný: 15 apr 2007, 16:18
Bydlisko: Košice
Kontaktovať používateľa:

Re: wordpress, problem s diakritikou v téme

Príspevok od používateľa kolac »

to je jedno, s UTF-8 to takisto nefunguje, ale diakritika nefunguje len v obsahu kontaktneho formularu, inak vo vsetkych ostatnych kutoch stranky aj v inych moduloch je to OK.
hojko
Site Admin
Site Admin
Používateľov profilový obrázok
Príspevky: 38515
Registrovaný: 24 apr 2004, 18:29
Bydlisko: Európa
Kontaktovať používateľa:

Re: wordpress, problem s diakritikou v téme

Príspevok od používateľa hojko »

A nepouziva formular specificky font pisma, ktory sa inde nenachadza a preto nezobrazi diakritiku???
kolac
Star
Star
Používateľov profilový obrázok
Príspevky: 635
Registrovaný: 15 apr 2007, 16:18
Bydlisko: Košice
Kontaktovať používateľa:

Re: wordpress, problem s diakritikou v téme

Príspevok od používateľa kolac »

wp-contactform.php :)

Kód: Vybrať všetko

<?php
/*
Plugin Name: WP-ContactForm
Plugin URI: http://blog.ftwr.co.uk/wordpress/
Description: WP Contact Form is a drop in form for users to contact you. It can be implemented on a page or a post.
Author: Ryan Duff, Peter Westwood
Author URI: http://blog.ftwr.co.uk
Version: 1.5.1.1
*/

load_plugin_textdomain('wpcf',$path = 'wp-content/plugins/wp-contact-form');

/*
This shows the quicktag on the write pages
Based off Buttonsnap Template
http://redalt.com/downloads
*/
if(get_option('wpcf_show_quicktag') == true) {
	include( plugin_dir_path(__FILE__) . 'buttonsnap.php');

	add_action('init', 'wpcf_button_init');
	add_action('marker_css', 'wpcf_marker_css');

	function wpcf_button_init() {
		$wpcf_button_url = buttonsnap_dirname(__FILE__) . '/wpcf_button.png';

		buttonsnap_textbutton($wpcf_button_url, __('Insert Contact Form', 'wpcf'), '<!--contact form-->');
		buttonsnap_register_marker('contact form', 'wpcf_marker');
	}

	function wpcf_marker_css() {
		$wpcf_marker_url = buttonsnap_dirname(__FILE__) . '/wpcf_marker.gif';
		echo "
			.wpcf_marker {
					
					height: 15px;
					width: 155px
					margin-top: 5px;
					background-image: url({$wpcf_marker_url});
					background-repeat: no-repeat;
					background-position: left;
			}
		";
	}
}

function wpcf_is_malicious($input) {
	$is_malicious = false;
	$bad_inputs = array("\r", "\n", "mime-version", "content-type", "cc:", "to:");
	foreach($bad_inputs as $bad_input) {
		if(strpos(strtolower($input), strtolower($bad_input)) !== false) {
			$is_malicious = true; break;
		}
	}
	return $is_malicious;
}

/* This function checks for errors on input and changes $wpcf_strings if there are any errors. Shortcircuits if there has not been a submission */
function wpcf_check_input() {
	if(!(isset($_POST['wpcf_stage']))) {return false;} // Shortcircuit.

	$_POST['wpcf_your_name'] = htmlentities(stripslashes(trim($_POST['wpcf_your_name'])));
	$_POST['wpcf_email'] = htmlentities(stripslashes(trim($_POST['wpcf_email'])));
	$_POST['wpcf_website'] = htmlentities(stripslashes(trim($_POST['wpcf_website'])));
	$_POST['wpcf_msg'] = htmlentities(stripslashes(trim($_POST['wpcf_msg'])));

	global $wpcf_strings;
	$ok = true;

	if(empty($_POST['wpcf_your_name']))
	{
		$ok = false; $reason = 'empty';
		$wpcf_strings['name'] = '<div class="contactright"><input type="text" name="wpcf_your_name" id="wpcf_your_name" size="30" maxlength="50" value="' . $_POST['wpcf_your_name'] . '" class="contacterror" /> (' . __('povinné', 'wpcf') . ')</div>';
	}

    if(!is_email($_POST['wpcf_email']))
    {
	    $ok = false; $reason = 'empty';
	    $wpcf_strings['email'] = '<div class="contactright"><input type="text" name="wpcf_email" id="wpcf_email" size="30" maxlength="50" value="' . $_POST['wpcf_email'] . '" class="contacterror" /> (' . __('povinné', 'wpcf') . ')</div>';
	}

    if(empty($_POST['wpcf_msg']))
    {
	    $ok = false; $reason = 'empty';
	    $wpcf_strings['msg'] = '<div class="contactright"><textarea name="wpcf_msg" id="wpcf_message" cols="80" rows="15" class="contacterror">' . $_POST['wpcf_msg'] . '</textarea></div>';
	}

	if(wpcf_is_malicious($_POST['wpcf_your_name']) || wpcf_is_malicious($_POST['wpcf_email'])) {
		$ok = false; $reason = 'malicious';
	}

	if($ok == true)
	{
		return true;
	}
	else {
		if($reason == 'malicious') {
			$wpcf_strings['error'] = "<div style='font-weight: bold;'>You can not use any of the following in the Name or Email fields: a linebreak, or the phrases 'mime-version', 'content-type', 'cc:' or 'to:'.</div>";
		} elseif($reason == 'empty') {
			$wpcf_strings['error'] = '<div style="font-weight: bold;">' . stripslashes(get_option('wpcf_error_msg')) . '</div>';
		}
		return false;
	}
}

/*Wrapper function which calls the form.*/
function wpcf_callback( $content ) {
	global $wpcf_strings;

	/* Run the input check. */		
	if(false === strpos($content, '<!--contact form-->')) {
		return $content;
	}
	
	/* Declare strings that change depending on input. This also resets them so errors clear on resubmission. */
	$wpcf_strings = array(
		'name' => '<div class="contactright"><input type="text" name="wpcf_your_name" id="wpcf_your_name" size="30" maxlength="50" value="' . (isset($_POST['wpcf_your_name']) ? $_POST['wpcf_your_name'] :'') . '" /> (' . __('povinné', 'wpcf') . ')</div>',
		'email' => '<div class="contactright"><input type="text" name="wpcf_email" id="wpcf_email" size="30" maxlength="50" value="' . (isset($_POST['wpcf_email']) ? $_POST['wpcf_email'] : '') . '" /> (' . __('povinné', 'wpcf') . ')</div>',
		'msg' => '<div class="contactright"><textarea name="wpcf_msg" id="wpcf_msg" cols="80" rows="15" >' . (isset($_POST['wpcf_msg']) ? $_POST['wpcf_msg'] : '' ) . '</textarea></div>',
		'error' => '');
	
    if(wpcf_check_input()) // If the input check returns true (ie. there has been a submission & input is ok)
    {
            $recipient = get_option('wpcf_email');
            $subject = get_option('wpcf_subject');
						$success_msg = get_option('wpcf_success_msg');
						$success_msg = stripslashes($success_msg);

            $name = $_POST['wpcf_your_name'];
            $email = $_POST['wpcf_email'];
            $website = $_POST['wpcf_website'];
            $msg = $_POST['wpcf_msg'];

      			$headers = "MIME-Version: 1.0\n";
						$headers .= "From: $name <$email>\n";
						$headers .= "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
            $fullmsg = "-----------------------\n";
            $fullmsg = "------ odkazovač ------\n";
            $fullmsg = "-----------------------\n";
            $fullmsg = "$name napísal/a:\n";
            $fullmsg .= wordwrap($msg, 80, "\n") . "\n\n";
            $fullmsg .= "webstránka: " . $website . "\n";
            $fullmsg .= "IP: " . getip();

            mail($recipient, $subject, $fullmsg, $headers);

            $results = '<div style="font-weight: bold;">' . $success_msg . '</div>';
            echo $results;
    }
    else // Else show the form. If there are errors the strings will have updated during running the inputcheck.
    {
        $form = '<div class="contactform">
        ' . $wpcf_strings['error'] . '
        	<form action="' . get_permalink() . '" method="post">
        		<div class="contactleft"><label for="wpcf_your_name">' . __('Meno: ', 'wpcf') . '</label></div>' . $wpcf_strings['name']  . '
        		<div class="contactleft"><label for="wpcf_email">' . __('E-mail: ', 'wpcf') . '</label></div>' . $wpcf_strings['email'] . '
        		<div class="contactleft"><label for="wpcf_website">' . __('Webstránka: ', 'wpcf') . '</label></div><div class="contactright"><input type="text" name="wpcf_website" id="wpcf_website" size="30" maxlength="100" value="' . (isset($_POST['wpcf_website']) ? $_POST['wpcf_website'] : '') . '" /></div>
            	<div class="contactleft"><label for="wpcf_msg">' . __('Správa: ', 'wpcf') . '</label></div>' . $wpcf_strings['msg'] . '
            	<div class="contactright"><input type="submit" name="Submit" value="' . __('Poslať', 'wpcf') . '" id="contactsubmit" /><input type="hidden" name="wpcf_stage" value="process" /></div>
        	</form>
        </div>
        <div style="clear:both; height:1px;">&nbsp;</div>';
        return str_replace('<!--contact form-->', $form, $content);
    }
}


/*Can't use WP's function here, so lets use our own*/
function getip() {
	if (isset($_SERVER))
	{
 		if (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
 		{
  			$ip_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];
 		}
 		elseif (isset($_SERVER["HTTP_CLIENT_IP"]))
 		{
  			$ip_addr = $_SERVER["HTTP_CLIENT_IP"];
 		}
 		else
 		{
 			$ip_addr = $_SERVER["REMOTE_ADDR"];
 		}
	}
	else
	{
 		if ( getenv( 'HTTP_X_FORWARDED_FOR' ) )
 		{
  			$ip_addr = getenv( 'HTTP_X_FORWARDED_FOR' );
 		}
 		elseif ( getenv( 'HTTP_CLIENT_IP' ) )
 		{
  			$ip_addr = getenv( 'HTTP_CLIENT_IP' );
 		}
 		else
 		{
  			$ip_addr = getenv( 'REMOTE_ADDR' );
 		}
	}
return $ip_addr;
}


/*CSS Styling*/
function wpcf_css() {
	?>
<style type="text/css" media="screen">

/* Begin Contact Form CSS */
.contactform {
	position: static;
	overflow: hidden;
	width: 95%;
}

.contactleft {
	width: 10%;
	white-space: pre;
	text-align: right;
	clear: both;
	float: left;
	display: inline;
	padding: 4px;
	margin: 5px 0;
}

.contactright {
	width: 85%;
	text-align: left;
	float: right;
	display: inline;
	padding: 4px;
	margin: 5px 0;
}

.contacterror {
	border: 1px solid #ff0000;
}

.contactsubmit {
}
/* End Contact Form CSS */

	</style>

<?php

	}

function wpcf_add_options_page() {
		add_options_page(__('Contact Form Options', 'wpcf'), __('Contact Form', 'wpcf'), 'manage_options', 'wp-contact-form/options-contactform.php');
	}

/* Action calls for all functions */

//if(get_option('wpcf_show_quicktag') == true) {add_action('admin_footer', 'wpcf_add_quicktag');}

add_action('admin_menu', 'wpcf_add_options_page');
add_filter('wp_head', 'wpcf_css');
add_filter('the_content', 'wpcf_callback', 7);

?>
Napísať odpoveď