Wsparcie » Wtyczki » Subscribe To Comments – tłumaczenie na polski

  • Rozwiązano Durus

    (@durus)


    Witam,

    Mam 2 problemy z tą wtyczką:

    1. Gdy przejdę w zarządzanie subskrypcjami wyrzuca mi taki błąd:

    „Warning: Illegal string offset 'manager’ in /home/getyourb/domains/zkuchniwziete.pl/public_html/wp-content/plugins/subscribe-to-comments/subscribe-to-comments.php on line 304”

    Niestety nie znam się na php i nie wiem jak naprawić błąd. Próbowałem zadeklarować klasę ale to nie ten kierunek 🙂 Co trzeba zrobić?

    2. Jak zrobić tłumaczenie do wtyczki, żeby nie tłumaczyć na sztywno? Tzn. tłumaczenie zrobiłem w Poedit, zapisałem i mam plik .mo, tutaj pytanie, co dalej? Jak zassać tłumaczenie do wtyczki?

    Kod php od początku do linii odpowiedzialnych za błędy:

    /* This is the code that is inserted into the comment form */
    function show_subscription_checkbox ($id='0') {
    	global $sg_subscribe;
    	sg_subscribe_start();
    
    	if ( $sg_subscribe->checkbox_shown ) return $id;
    	if ( !$email = $sg_subscribe->current_viewer_subscription_status() ) :
    		$checked_status = ( !empty($_COOKIE['subscribe_checkbox_'.COOKIEHASH]) && 'checked' == $_COOKIE['subscribe_checkbox_'.COOKIEHASH] ) ? true : false;
    	?>
    
    <?php /* ------------------------------------------------------------------- */ ?>
    <?php /* This is the text that is displayed for users who are NOT subscribed */ ?>
    <?php /* ------------------------------------------------------------------- */ ?>
    
    	<p <?php if ($sg_subscribe->clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments">
    	<input type="checkbox" name="subscribe" id="subscribe" value="subscribe" style="width: auto;" <?php if ( $checked_status ) echo 'checked="checked" '; ?>/><?php echo $sg_subscribe->not_subscribed_text; ?>
    	</p>
    
    <?php /* ------------------------------------------------------------------- */ ?>
    
    <?php elseif ( $email == 'admin' && current_user_can('manage_options') ) : ?>
    
    <?php /* ------------------------------------------------------------- */ ?>
    <?php /* This is the text that is displayed for the author of the post */ ?>
    <?php /* ------------------------------------------------------------- */ ?>
    
    	<p <?php if ($sg_subscribe->clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments">
    	<?php echo str_replace('[manager_link]', $sg_subscribe->manage_link($email, true, false), $sg_subscribe->author_text); ?>
    	</p>
    
    <?php else : ?>
    
    <?php /* --------------------------------------------------------------- */ ?>
    <?php /* This is the text that is displayed for users who ARE subscribed */ ?>
    <?php /* --------------------------------------------------------------- */ ?>
    
    	<p <?php if ($sg_subscribe->clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments">
    	<?php echo str_replace('[manager_link]', $sg_subscribe->manage_link($email, true, false), $sg_subscribe->subscribed_text); ?>
    	</p>
    
    <?php /* --------------------------------------------------------------- */ ?>
    
    <?php endif;
    
    $sg_subscribe->checkbox_shown = true;
    return $id;
    }
    
    /* -------------------------------------------------------------------- */
    /* This function outputs a "subscribe without commenting" form.         */
    /* Place this somewhere within "the loop", but NOT within another form  */
    /* This is NOT inserted automaticallly... you must place it yourself    */
    /* -------------------------------------------------------------------- */
    function show_manual_subscription_form() {
    	global $id, $sg_subscribe, $user_email;
    	sg_subscribe_start();
    	$sg_subscribe->show_errors('solo_subscribe', '<div class="solo-subscribe-errors">', '</div>', __('<strong>Error: </strong>', 'subscribe-to-comments'), '<br />');
    
    if ( !$sg_subscribe->current_viewer_subscription_status() ) :
    	get_currentuserinfo(); ?>
    
    <?php /* ------------------------------------------------------------------- */ ?>
    <?php /* This is the text that is displayed for users who are NOT subscribed */ ?>
    <?php /* ------------------------------------------------------------------- */ ?>
    
    	<form action="" method="post">
    	<input type="hidden" name="solo-comment-subscribe" value="solo-comment-subscribe" />
    	<input type="hidden" name="postid" value="<?php echo (int) $id; ?>" />
    	<input type="hidden" name="ref" value="<?php echo urlencode('http://' . $_SERVER['HTTP_HOST'] . attribute_escape($_SERVER['REQUEST_URI'])); ?>" />
    
    	<p class="solo-subscribe-to-comments">
    	<?php _e('Subscribe without commenting', 'subscribe-to-comments'); ?>
    	<br />
    	<label for="solo-subscribe-email"><?php _e('E-Mail:', 'subscribe-to-comments'); ?>
    	<input type="text" name="email" id="solo-subscribe-email" size="22" value="<?php echo $user_email; ?>" /></label>
    	<input type="submit" name="submit" value="<?php _e('Subscribe', 'subscribe-to-comments'); ?>" />
    	</p>
    	</form>
    
    <?php /* ------------------------------------------------------------------- */ ?>
    
    <?php endif;
    }
    
    /* -------------------------
    Use this function on your comments display - to show whether a user is subscribed to comments on the post or not.
    Note: this must be used within the comments loop!  It will not work properly outside of it.
    ------------------------- */
    function comment_subscription_status() {
    global $comment;
    if ($comment->comment_subscribe == 'Y') {
    return true;
    } else {
    return false;
    }
    }
    
    /* ============================= */
    /* DO NOT MODIFY BELOW THIS LINE */
    /* ============================= */
    
    class sg_subscribe_settings {
    	function options_page_contents() {
    		global $sg_subscribe;
    		sg_subscribe_start();
    		if ( isset($_POST['sg_subscribe_settings_submit']) ) {
    			check_admin_referer('subscribe-to-comments-update_options');
    			$update_settings = stripslashes_deep($_POST['sg_subscribe_settings']);
    			$sg_subscribe->update_settings($update_settings);
    		}
    
    		echo '<h2>'.__('Subscribe to Comments Options','subscribe-to-comments').'</h2>';
    		echo '<ul>';
    
    		echo '<li><label for="name">' . __('"From" name for notifications:', 'subscribe-to-comments') . ' <input type="text" size="40" id="name" name="sg_subscribe_settings[name]" value="' . sg_subscribe_settings::form_setting('name') . '" /></label></li>';
    		echo '<li><label for="email">' . __('"From" e-mail addresss for notifications:', 'subscribe-to-comments') . ' <input type="text" size="40" id="email" name="sg_subscribe_settings[email]" value="' . sg_subscribe_settings::form_setting('email') . '" /></label></li>';
    		echo '<li><label for="clear_both"><input type="checkbox" id="clear_both" name="sg_subscribe_settings[clear_both]" value="clear_both"' . sg_subscribe_settings::checkflag('clear_both') . ' /> ' . __('Do a CSS "clear" on the subscription checkbox/message (uncheck this if the checkbox/message appears in a strange location in your theme)', 'subscribe-to-comments') . '</label></li>';
    		echo '</ul>';
    
    		echo '<fieldset><legend>' . __('Comment Form Text', 'subscribe-to-comments') . '</legend>';
    
    		echo '<p>' . __('Customize the messages shown to different people.  Use <code>[manager_link]</code> to insert the URI to the Subscription Manager.', 'subscribe-to-comments') . '</p>';
    
    		echo '<ul>';
    
    		echo '<li><label for="not_subscribed_text">' . __('Not subscribed', 'subscribe-to-comments') . '</label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="not_subscribed_text" name="sg_subscribe_settings[not_subscribed_text]">' . sg_subscribe_settings::textarea_setting('not_subscribed_text') . '</textarea></li>';
    
    		echo '<li><label for="subscribed_text">' . __('Subscribed', 'subscribe-to-comments') . '</label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="subscribed_text" name="sg_subscribe_settings[subscribed_text]">' . sg_subscribe_settings::textarea_setting('subscribed_text') . '</textarea></li>';
    
    		echo '<li><label for="author_text">' . __('Entry Author', 'subscribe-to-comments') . '</label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="author_text" name="sg_subscribe_settings[author_text]">' . sg_subscribe_settings::textarea_setting('author_text') . '</textarea></li>';
    
    		echo '</ul></fieldset>';
    
    		echo '<fieldset>';
    		echo '<legend><input type="checkbox" id="use_custom_style" name="sg_subscribe_settings[use_custom_style]" value="use_custom_style"' . sg_subscribe_settings::checkflag('use_custom_style') . ' /> <label for="use_custom_style">' . __('Use custom style for Subscription Manager', 'subscribe-to-comments') . '</label></legend>';
    
    		echo '<p>' . __('These settings only matter if you are using a custom style.  <code>[theme_path]</code> will be replaced with the path to your current theme.', 'subscribe-to-comments') . '</p>';
    
    		echo '<ul>';
    		echo '<li><label for="sg_sub_header">' . __('Path to header:', 'subscribe-to-comments') . ' <input type="text" size="40" id="sg_sub_header" name="sg_subscribe_settings[header]" value="' . sg_subscribe_settings::form_setting('header') . '" /></label></li>';
    		echo '<li><label for="sg_sub_sidebar">' . __('Path to sidebar:', 'subscribe-to-comments') . ' <input type="text" size="40" id="sg_sub_sidebar" name="sg_subscribe_settings[sidebar]" value="' . sg_subscribe_settings::form_setting('sidebar') . '" /></label></li>';
    		echo '<li><label for="sg_sub_footer">' . __('Path to footer:', 'subscribe-to-comments') . ' <input type="text" size="40" id="sg_sub_footer" name="sg_subscribe_settings[footer]" value="' . sg_subscribe_settings::form_setting('footer') . '" /></label></li>';
    
    		echo '<li><label for="before_manager">' . __('HTML for before the subscription manager:', 'subscribe-to-comments') . ' </label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="before_manager" name="sg_subscribe_settings[before_manager]">' . sg_subscribe_settings::textarea_setting('before_manager') . '</textarea></li>';
    		echo '<li><label for="after_manager">' . __('HTML for after the subscription manager:', 'subscribe-to-comments') . ' </label><br /><textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="after_manager" name="sg_subscribe_settings[after_manager]">' . sg_subscribe_settings::textarea_setting('after_manager') . '</textarea></li>';
    		echo '</ul>';
    		echo '</fieldset>';
    	}
    
    	function checkflag($optname) {
    		$options = get_settings('sg_subscribe_settings');
    		if ( $options[$optname] != $optname )
    			return;
    		return ' checked="checked"';
    	}
    
    	function form_setting($optname) {
    		$options = get_settings('sg_subscribe_settings');
    		return attribute_escape($options[$optname]);
    	}
    
    	function textarea_setting($optname) {
    		$options = get_settings('sg_subscribe_settings');
    		return wp_specialchars($options[$optname]);
    	}
    
    	function options_page() {
    		/** Display "saved" notification on post **/
    		if ( isset($_POST['sg_subscribe_settings_submit']) )
    			echo '<div class="updated"><p><strong>' . __('Options saved.', 'subscribe-to-comments') . '</strong></p></div>';
    
    		echo '<form method="post"><div class="wrap">';
    
    		sg_subscribe_settings::options_page_contents();
    
    	  echo '<p class="submit"><input type="submit" name="sg_subscribe_settings_submit" value="';
    	  _e('Update Options &raquo;', 'subscribe-to-comments');
    	  echo '" /></p></div>';
    
    		if ( function_exists('wp_nonce_field') )
    			wp_nonce_field('subscribe-to-comments-update_options');
    
    		echo '</form>';
    	}
    
    }
    
    class sg_subscribe {
    	var $errors;
    	var $messages;
    	var $post_subscriptions;
    	var $email_subscriptions;
    	var $subscriber_email;
    	var $site_email;
    	var $site_name;
    	var $standalone;
    	var $form_action;
    	var $checkbox_shown;
    	var $use_wp_style;
    	var $header;
    	var $sidebar;
    	var $footer;
    	var $clear_both;
    	var $before_manager;
    	var $after_manager;
    	var $email;
    	var $new_email;
    	var $ref;
    	var $key;
    	var $key_type;
    	var $action;
    	var $default_subscribed;
    	var $not_subscribed_text;
    	var $subscribed_text;
    	var $author_text;
    	var $salt;
    	var $settings;
    	var $version = '2.1.2';
    
    	function sg_subscribe() {
    		global $wpdb;
    		$this->db_upgrade_check();
    
    		$this->settings = get_settings('sg_subscribe_settings');
    
    		$this->salt = $this->settings['salt'];
    		$this->site_email = ( is_email($this->settings['email']) && $this->settings['email'] != 'email@example.com' ) ? $this->settings['email'] : get_bloginfo('admin_email');
    		$this->site_name = ( $this->settings['name'] != 'YOUR NAME' && !empty($this->settings['name']) ) ? $this->settings['name'] : get_bloginfo('name');
    		$this->default_subscribed = ($this->settings['default_subscribed']) ? true : false;
    
    		$this->not_subscribed_text = $this->settings['not_subscribed_text'];
    		$this->subscribed_text = $this->settings['subscribed_text'];
    		$this->author_text = $this->settings['author_text'];
    		$this->clear_both = $this->settings['clear_both'];
    
    		$this->errors = '';
    		$this->post_subscriptions = array();
    		$this->email_subscriptions = '';
    	}
    
    	function manager_init() {
    		$this->messages = '';
    		$this->use_wp_style = ( $this->settings['use_custom_style'] == 'use_custom_style' ) ? false : true;
    		if ( !$this->use_wp_style ) {
    			$this->header = str_replace('[theme_path]', get_template_directory(), $this->settings['header']);
    			$this->sidebar = str_replace('[theme_path]', get_template_directory(), $this->settings['sidebar']);
    			$this->footer = str_replace('[theme_path]', get_template_directory(), $this->settings['footer']);
    			$this->before_manager = $this->settings['before_manager'];
    			$this->after_manager = $this->settings['after_manager'];
    		}
    
    		foreach ( array('email', 'key', 'ref', 'new_email') as $var )
    			if ( isset($_REQUEST[$var]) && !empty($_REQUEST[$var]) )
    				$this->{$var} = attribute_escape(trim(stripslashes($_REQUEST[$var])));
    		if ( !$this->key )
    			$this->key = 'unset';
    	}
    
    	function add_error($text='generic error', $type='manager') {
    		$this->errors[$type][] = $text;
    	}
    
    	function show_errors($type='manager', $before_all='<div class="updated updated-error">', $after_all='</div>', $before_each='<p>', $after_each='</p>'){
    		if ( is_array($this->errors[$type]) ) {
    			echo $before_all;
    			foreach ($this->errors[$type] as $error)
    				echo $before_each . $error . $after_each;
    			echo $after_all;
    		}
    		unset($this->errors);

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator amistad18

    (@amistad18)

    1. Zgłoś problem autorowi wtyczki.
    2. W plikach wtyczki nie ma jakiegoś katalogu lang, language, z plikiem .po? Zazwyczaj wtyczki dostarczają już plik do tłumaczenia.

    Thread Starter Durus

    (@durus)

    1. Ostatnia aktualizacja wtyczki była 3 lata temu i powstają nowe na bazie kodu z tej, więc przypuszczam, że szybciej nauczę się php i napiszę wtyczkę od nowa niż uzyskam odpowiedź od autora.

    2. Nie ma. Tłumaczenie zrobiłem ale pytanie dotyczyło tego jak te tłumaczenia zassać do wtyczki. Nawet powiedzmy mam inną wtyczkę, która ma katalog lang i tłumaczenia z plikiami .po ale jak aktywować jakieś tłumaczenie we wtyczce?

    Moderator amistad18

    (@amistad18)

    1. Podaj linka do wtyczki. Dlaczego z tych nowych nie skorzystasz?

    2. https://codex.wordpress.org/Function_Reference/load_plugin_textdomain

    Thread Starter Durus

    (@durus)

    https://wordpress.org/plugins/subscribe-to-comments/

    Przerobiłem wszystkie jakie znalazłem do subskrypcji komentarzy i albo wywalały błąd krytyczny albo nie działały. Ta jakby nie było działa tylko ten błąd wyświetla. Chyba pozostaje podszkolić się w php.

    Dzięki za linka, co nie co rozjaśniło mi się 🙂

    Thread Starter Durus

    (@durus)

    Problem rozwiązałem. Gdyby ktoś potrzebował wklejam rozwiązanie.

    W pliku: subscribe-to-comments.php

    dla bezpieczeństwa w linii 272:
    – oryginał: $this->errors = ”;
    – zamieniamy na: $this->errors = array();

    rozwiązanie problemu illegal offset w linii 303:
    – oryginał: if ( is_array($this->errors[$type]) ) {
    – zamieniamy na: if (is_array($this->errors) && is_array($this->errors[$type])) {

    Pozdrawiam, Durus

Viewing 5 replies - 1 through 5 (of 5 total)
  • Temat ‘Subscribe To Comments – tłumaczenie na polski’ jest zamknięty na nowe odpowiedzi.