• Witam
    Jest to wtyczka -text expander. Wysuwa tekst schowany w linku po kliknięciu na link. Czy może mi ktoś powiedzieć który kodu fragment odpowiada za edycje koloru linku, ponieważ ustawiony jest na niebieski który nie bardzo komponuj się z moją stroną.
    Pozdr

    <?php
    
    //////////// WPADMIN BOOTSTRAP LOADER
        if(file_exists('../../../wp-load.php')) {
        	require_once("../../../wp-load.php");
        } else if(file_exists('../../wp-load.php')) {
        	require_once("../../wp-load.php");
        } else if(file_exists('../wp-load.php')) {
        	require_once("../wp-load.php");
        } else if(file_exists('wp-load.php')) {
        	require_once("wp-load.php");
        } else if(file_exists('../../../../wp-load.php')) {
        	require_once("../../../../wp-load.php");
        } else if(file_exists('../../../../wp-load.php')) {
        	require_once("../../../../wp-load.php");
        } else {
    
        	if(file_exists('../../../wp-config.php')) {
        		require_once("../../../wp-config.php");
        	} else if(file_exists('../../wp-config.php')) {
        		require_once("../../wp-config.php");
        	} else if(file_exists('../wp-config.php')) {
        		require_once("../wp-config.php");
        	} else if(file_exists('wp-config.php')) {
        		require_once("wp-config.php");
        	} else if(file_exists('../../../../wp-config.php')) {
        		require_once("../../../../wp-config.php");
        	} else if(file_exists('../../../../wp-config.php')) {
        		require_once("../../../../wp-config.php");
        	} else {
        		echo '<p>Failed to load bootstrap.</p>';
    			exit;
        	}
        }
        require_once(ABSPATH.'wp-admin/admin.php');
    //////////// END BOOTSTRAP LOADER
    
    if (function_exists('admin_url')) {
    	wp_admin_css_color('classic', __('Blue'), admin_url("css/colors-classic.css"), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7'));
    	wp_admin_css_color('fresh', __('Gray'), admin_url("css/colors-fresh.css"), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF'));
    } else {
    	wp_admin_css_color('classic', __('Blue'), get_bloginfo('wpurl').'/wp-admin/css/colors-classic.css', array('#073447', '#21759B', '#EAF3FA', '#BBD8E7'));
    	wp_admin_css_color('fresh', __('Gray'), get_bloginfo('wpurl').'/wp-admin/css/colors-fresh.css', array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF'));
    }
    
    wp_enqueue_script( 'common' );
    wp_enqueue_script( 'jquery-color' );
    
    @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    
    ?>
    <!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 do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
    <head>
    	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
    	<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Text Expander'); ?> — <?php _e('WordPress'); ?></title>
    	<?php
    		wp_enqueue_style( 'global' );
    		wp_enqueue_style( 'wp-admin' );
    		wp_enqueue_style( 'colors' );
    		wp_enqueue_style( 'media' );
    	?>
    
    	<script type="text/javascript">
    
    	//<![CDATA[
    		function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
    	//]]>
    	</script>
    
    	<?php
    	do_action('admin_print_styles');
    	do_action('admin_print_scripts');
    	do_action('admin_head');
    
    	if ( isset($content_func) && is_string($content_func) )
    		do_action( "admin_head_{$content_func}" );
    	?>
    
    </head>
    
    <body id="media-upload">
    <div style="padding:10px;" id="hs4wOptions">
    <h3>Text Expander</h3>
    <ul>
    With a Text Expander you can insert special links to your content. If a user click this expander link the hidden text slides in. That expander can of course contain html-elements like images or tables.<br /><br />
    <b>Example::</b><br /><br />
    <b>[EXPAND <i>Click to expand!</i>]</b>Thats the expanded text<b>[/EXPAND]</b><br /><br />
    </ul>
    <h3>Insert Options</h3>
    <ul>
    <table>
      <form name="formular">
        <tr>
            <td><label for="e_Title">Title: </label></td>
            <td><input name="e_Title" type="text" size="32" value="" tabindex="1" /></td>
            <td><small><i>Title of your HTML Expander</i></small></td>
        </tr>
        <tr>
            <td><label for="e_Text">Text: </label></td>
            <td><textarea name="e_Text" cols="50" rows="10" tabindex="2" /></textarea></td>
            <td><small><i>Text you want to be expandable/collapsable</i></small></td>
        </tr>
      </form>
    </table><br/>
    <input type="submit" id="insertcode" class="button button-primary" name="insertintopost" value="Insert into post" />
    </ul>
    <script type="text/javascript">
    /* <![CDATA[ */
        jQuery('#insertcode').click(function(){
            var win = window.dialogArguments || opener || parent || top;
            if( window.document.formular.e_Title.value || window.document.formular.e_Text.value ) {
                var out = '[EXPAND ';
                if( window.document.formular.e_Title.value )    out = out + window.document.formular.e_Title.value + ']';
                else                                            out = out + 'Click to expand!]';
                if( window.document.formular.e_Text.value )    out = out + window.document.formular.e_Text.value;
                else                                            out = out + 'Text';
                out = out + '[/EXPAND]'
            } else {
                var out = '[EXPAND Click to expand!]Thats the expanded text[/EXPAND]';
    
            }
    
            if (jQuery('#format').val()>0) win.send_to_editor(out + ' format="' + jQuery('#format').val() + '"]');
            else win.send_to_editor(out);
        });
    
    /* ]]> */
    </script>
    </div>
    </body>
    </html>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator amistad18

    (@amistad18)

    W zaprezentowanym kodzie nie ma zdefiniowanego koloru linków.

    Thread Starter legwan1414

    (@legwan1414)

    Hmm to pewnie w tym kodzie bo oprócz tego zostały już tylko pliki-text-expander/readme.txt

    <?php
    /*
    Plugin Name: Text Expander
    Plugin URI: http://www.ali.dj/wordpress-plugin-text-expander/
    Description: Allows you to define areas of text that expand/collapse when clicked. It is an improved version of Dagon Design's Expanding Text-Plugin.
    Author: Alexander Zigelski
    Version: 0.3
    Author URI: http://www.ali.dj
    */
    
    // add the options page
    add_action('admin_menu', 'text_expander_admin_add_page');
    add_action('wp_print_scripts', 'load_jquery');
    add_action('wp_head', 'expander_javascript');
    add_filter('the_content', 'expander_process');
    $wp_text_expander_url = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
    
    function text_expander_admin_add_page() {
    add_options_page('Text Expander Settings', 'Text Expander', 'manage_options', 'text_expander', 'text_expander_options_page');
    }
    
    // display the options page
    function text_expander_options_page() {
    ?>
    <div>
    <h2>Text Expander Settings</h2>
    Options relating to the Custom Plugin.
    <form action="options.php" method="post">
    <?php settings_fields('text_expander_options'); ?>
    <?php do_settings_sections('text_expander'); ?>
    <br />
    <input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />
    </form></div>
    
    <?php
    }
    add_action('admin_init', 'plugin_admin_init');
    
    function plugin_admin_init(){
    register_setting( 'text_expander_options', 'text_expander_options', 'expand_text_validate' );
    add_settings_section('text_expander_main', 'Expand/Collapse-link', 'text_expander_main_section_text', 'text_expander');
    add_settings_field('expand_text', 'Before collapse link:', 'text_expander_expand_text_string', 'text_expander', 'text_expander_main');
    add_settings_field('collapse_text', 'Before expand link:', 'text_expander_collapse_text_string', 'text_expander', 'text_expander_main');
    }
    
    register_activation_hook(__FILE__, 'add_defaults_fn');
    
    // Define default option settings
    function add_defaults_fn() {
    	$tmp = get_option('text_expander_options');
        if(($tmp['chkbox1']=='on')||(!is_array($tmp))) {
    		$arr = array("expand_text"=>"&uArr;", "collapse_text" => "&dArr;");
    		update_option('text_expander_options', $arr);
    	}
    }
    
    function text_expander_main_section_text() {
    echo '<p>Here you can adjust which character or string is shown before the expand or collapse link.<br />
    		Default values are a down-and up-arrow</p>';
    }
    
    function text_expander_expand_text_string() {
    $options = get_option('text_expander_options');
    echo "<input id='expand_text_string' name='text_expander_options[expand_text]' size='40' type='text' value='{$options['expand_text']}' />";
    }
    
    function text_expander_collapse_text_string() {
    $options = get_option('text_expander_options');
    echo "<input id='collapse_text_string' name='text_expander_options[collapse_text]' size='40' type='text' value='{$options['collapse_text']}' />";
    }
    
    // validate our options
    function expand_text_validate($input) {
    $options = get_option('text_expander_options');
    $options['expand_text'] = trim($input['expand_text']);
    $options['collapse_text'] = trim($input['collapse_text']);
    return $options;
    }
    
    function expander_str_replace_once($needle , $replace , $haystack){
        // Looks for the first occurence of $needle in $haystack
        // and replaces it with $replace.
        $pos = strpos($haystack, $needle);
        if ($pos === false) {
            // Nothing found
        return $haystack;
        }
        return substr_replace($haystack, $replace, $pos, strlen($needle));
    }
    
    function wp_text_expander_add_media_button() {
    	GLOBAL $wp_text_expander_url;
    	$url = $wp_text_expander_url.'/media-button-expander.php?tab=add&TB_iframe=true&height=300&width=640';
    	if (is_ssl()) $url = preg_replace( '/^http:\/\//', 'https://',  $url );
    	echo '<a href="'.$url.'" class="thickbox" title="'.'Add Text Expander'.'"><img src="'.$wp_text_expander_url.'/img/media-button-text-expander.gif" alt="'.'Add Text Expander'.'"></a>';
    }
    
    add_action('media_buttons', 'wp_text_expander_add_media_button', 20);
    
    function load_jquery(){
        wp_enqueue_script('jquery');
    }
    
    function expander_process($content) {
    
    	$offset = 0;
    	$stag = '[EXPAND ';
    	$etag = '[/EXPAND]';
    	while (stripos($content, $stag, $offset)) {
    
    		// string to replace
    		$s = stripos($content, $stag, $offset);
    		$e = stripos($content, $etag, $s) + strlen($etag);
    
    		// inside data
    		$ds = stripos($content, ']', $s) + 1;
    		$de = $e - strlen($etag);
    
    		// style tag
    		$ss = $s + strlen($stag);
    		$se = $ds - 1;
    
    		$sstring = substr($content, $s, $e - $s);
    		$sdesc = substr($content, $ss, $se - $ss);
    		$sdata = substr($content, $ds, $de - $ds);
    
    		mt_srand((double)microtime()*1000000);
    		$rnum = mt_rand();
    
    		$new_string = '<a style="display:none;" id="te' . $rnum;
    		$new_string .= '" href="javascript:expand(\'#te' . $rnum . '\')">';
    		$new_string .= $sdesc . '</a>' . "\n";
    		$new_string .= '<div class="te_div" id="te' . $rnum . '">';
    		$new_string .= '<script language="JavaScript" type="text/javascript">expander_hide(\'#te' . $rnum . '\');</script>';
    
    		$sdata = preg_replace('<code>^<br /></code>sim', '', $sdata);
    		$content = expander_str_replace_once($sstring, $new_string . $sdata . '</div>', $content);
    		$offset = $s + 1;
    	}
    	return $content;
    }
    
    function expander_javascript() {
      	$options = get_option('text_expander_options');
    	echo '
    <script language="JavaScript" type="text/javascript"><!--
    
    function expand(param) {
     jQuery("div"+param).stop().slideToggle("slow", function() {
        linkname = jQuery("a"+param).html();
        if( jQuery("div"+param).is(":visible") ) {
          jQuery("a"+param).html(expand_text+" "+linkname.substring(collapse_text_length));
        }
        else {
            jQuery("a"+param).html(collapse_text+" "+linkname.substring(expand_text_length));
        }
      });
    
    }
    function expander_hide(param) {
            jQuery("div"+param).hide();
    		linkname = jQuery("a"+param).html();
            collapse_text  = "'.$options['collapse_text'].'";
            expand_text    = "'.$options['expand_text'].'";
            collapse_text_length = jQuery("<span />").html(collapse_text).text().length;
            expand_text_length = jQuery("<span />").html(collapse_text).text().length;
            jQuery("a"+param).html(collapse_text + " " + linkname);
            jQuery("a"+param).show();
    }
    //--></script>
    ';
    }
    
    ?>
    Moderator amistad18

    (@amistad18)

    Także nie widzę. Podaj w końcu adres strony.

    Thread Starter legwan1414

    (@legwan1414)

    Serwer Xampp’a

Viewing 4 replies - 1 through 4 (of 4 total)
  • Temat ‘Edycja wtyczki’ jest zamknięty na nowe odpowiedzi.