Esempio n. 1
0
function thesis_options_head()
{
    wp_enqueue_style('thesis-options-stylesheet', THESIS_CSS_FOLDER . '/options.css');
    #wp
    if ($_GET['page'] == 'thesis-file-editor') {
        require_once ABSPATH . 'wp-admin/includes/misc.php';
        #wp
        wp_enqueue_script('color-picker', THESIS_SCRIPTS_FOLDER . '/jscolor/jscolor.js');
        #wp
        if (function_exists('use_codepress')) {
            wp_enqueue_script('codepress');
        }
        if (use_codepress()) {
            add_action('admin_print_footer_scripts', 'codepress_footer_js');
        }
    } elseif ($_GET['page'] == 'options-manager') {
        $manager = new thesis_options_manager();
        $manager->add_js();
        $manager->manage_options();
    } else {
        wp_enqueue_script('jquery-ui-core');
        #wp
        wp_enqueue_script('jquery-ui-sortable');
        #wp
        wp_enqueue_script('jquery-ui-tabs');
        #wp
        wp_enqueue_script('thesis-admin-js', THESIS_SCRIPTS_FOLDER . '/thesis.js');
        #wp
        if ($_GET['page'] == 'thesis-design-options') {
            wp_enqueue_script('color-picker', THESIS_SCRIPTS_FOLDER . '/jscolor/jscolor.js');
        }
        #wp
    }
}
Esempio n. 2
0
<?php

global $tml, $user_level, $tml_admin_messages, $tml_admin, $msgid, $checksum, $restrict_by_tags_use_default, $restrict_by_tags_type, $restrict_by_tags_slugs, $restrict_by_cats_use_default, $restrict_by_cats_type, $restrict_by_cats_slugs;
###		Standard authorization check		###
if (!is_object($tml) || !current_user_can("edit_plugins")) {
    echo __("Sorry: you can not configure Thank Me Later with your account.", "thankmelater");
    exit;
}
if (function_exists("use_codepress") && $tml->get_option("syntax_highlighting")) {
    use_codepress();
}
?>

<form method="post" name="template" id="template" action="?<?php 
echo attribute_escape(TML_admin_pages_hierarchy::build_query() . (isset($msgid) ? "&msgid=" . urlencode($msgid) . "&checksum=" . $checksum : ""));
?>
">
	<?php 
wp_nonce_field("thank-me-later-admin-messages-new-message");
?>
	
	<table class="form-table tml-form">

		<tbody>
			<tr valign="top">
				<th scope="row">
					<label for="from_name"><?php 
_e("From Name", "thankmelater");
?>
</label>
				</th>
	if ( isset($_GET['liveupdate']) ) {
		check_admin_referer('edit-plugin-test_' . $file);

		$error = validate_plugin($file);
		if ( is_wp_error($error) )
			wp_die( $error );

		if ( ! is_plugin_active($file) )
			activate_plugin($file, "plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error

		wp_redirect("plugin-editor.php?file=$file&a=te");
		exit;
	}

	if ( use_codepress() )
		wp_enqueue_script( 'codepress' );

	// List of allowable extensions
	$editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include');
	$editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions);

	if ( ! is_file($real_file) ) {
		wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.')));
	} else {
		// Get the extension of the file
		if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) {
			$ext = strtolower($matches[1]);
			// If extension is not in the acceptable list, skip it
			if ( !in_array( $ext, $editable_extensions) )
				wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.')));
Esempio n. 4
0
    function options_page()
    {
        global $thesis_site;
        $custom_editor = new thesis_custom_editor();
        ?>

<div id="thesis_options" class="wrap<?php 
        if (get_bloginfo('text_direction') == 'rtl') {
            echo ' rtl';
        }
        ?>
">
<?php 
        thesis_version_indicator();
        thesis_options_title(__('Thesis Custom File Editor', 'thesis'), false);
        thesis_options_nav();
        thesis_options_status_check();
        if (version_compare($thesis_site->version, thesis_version()) != 0) {
            ?>
	<form id="upgrade_needed" action="<?php 
            echo admin_url('admin-post.php?action=thesis_upgrade');
            ?>
" method="post">
		<h3><?php 
            _e('Oooh, Exciting!', 'thesis');
            ?>
</h3>
		<p><?php 
            _e('It&#8217;s time to upgrade your Thesis, which means there&#8217;s new awesomeness in your immediate future. Click the button below to fast-track your way to the awesomeness!', 'thesis');
            ?>
</p>
		<p><input type="submit" class="upgrade_button" id="teh_upgrade" name="upgrade" value="<?php 
            _e('Upgrade Thesis', 'thesis');
            ?>
" /></p>
	</form>
<?php 
        } elseif (file_exists(THESIS_CUSTOM)) {
            // Determine which file we're editing. Default to something harmless, like custom.css.
            $file = $_GET['file'] ? $_GET['file'] : 'custom.css';
            $files = $custom_editor->get_custom_files();
            $extension = substr($file, strrpos($file, '.'));
            // Determine if the custom file exists and is writable. Otherwise, this page is useless.
            $error = $custom_editor->is_custom_writable($file, $files);
            if ($error) {
                echo $error;
            } else {
                // Get contents of custom.css
                if (filesize(THESIS_CUSTOM . '/' . $file) > 0) {
                    $content = fopen(THESIS_CUSTOM . '/' . $file, 'r');
                    $content = fread($content, filesize(THESIS_CUSTOM . '/' . $file));
                    $content = htmlspecialchars($content);
                } else {
                    $content = '';
                }
            }
            // Highlighting for which language?
            $lang = function_exists('codepress_get_lang') ? codepress_get_lang($file) : '';
            ?>
	<div class="one_col">
		<form method="post" id="file-jump" name="file-jump" action="<?php 
            echo admin_url('admin-post.php?action=thesis_file_editor');
            ?>
">
			<h3><?php 
            printf(__('Currently editing: <code>%s</code>', 'thesis'), "custom/{$file}");
            ?>
</h3>
<?php 
            if (function_exists('use_codepress')) {
                if (use_codepress()) {
                    echo "\t\t\t<a class=\"syntax\" id=\"codepress-off\" href=\"admin.php?page=thesis-file-editor&amp;codepress=off&amp;file={$file}\">" . __('Disable syntax highlighting', 'thesis') . "</a>\n";
                } else {
                    echo "\t\t\t<a class=\"syntax\" id=\"codepress-on\" href=\"admin.php?page=thesis-file-editor&amp;codepress=on&amp;file={$file}\">" . __('Enable syntax highlighting', 'thesis') . "</a></p>\n";
                }
            }
            ?>
			<p>
				<select id="custom_files" name="custom_files">
					<option value="<?php 
            echo $file;
            ?>
"><?php 
            echo $file;
            ?>
</option>
<?php 
            foreach ($files as $f) {
                // An option for each available file
                if ($f != $file) {
                    echo "\t\t\t\t\t<option value=\"{$f}\">{$f}</option>\n";
                }
            }
            ?>
				</select>
				<input type="submit" id="custom_file_jump" name="custom_file_jump" value="<?php 
            _e('Edit selected file', 'thesis');
            ?>
" />
			</p>
<?php 
            if ($extension == '.php') {
                echo "\t\t\t<p class=\"alert\">" . __('<strong>Note:</strong> If you make a mistake in your code while modifying a <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> file, saving this page <em>may</em> result your site becoming temporarily unusable. Prior to editing such files, be sure to have access to the file via <acronym title="File Transfer Protocol">FTP</acronym> or other means so that you can correct the error.', 'thesis') . "</p>\n";
            }
            ?>
		</form>
		<form class="file_editor" method="post" id="template" name="template" action="<?php 
            echo admin_url('admin-post.php?action=thesis_file_editor');
            ?>
">
			<input type="hidden" id="file" name="file" value="<?php 
            echo $file;
            ?>
" />
			<p><textarea id="newcontent" name="newcontent" rows="25" cols="50" class="large-text codepress <?php 
            echo $lang;
            ?>
"><?php 
            echo $content;
            ?>
</textarea></p>
			<p>
				<input type="submit" class="save_button" id="custom_file_submit" name="custom_file_submit" value="<?php 
            thesis_save_button_text();
            ?>
" />
				<input class="color" type="text" id="handy-color-picker" name="handy-color-picker" value="ffffff" maxlength="6" />
				<label class="inline" for="handy-color-picker"><?php 
            _e('quick color reference', 'thesis');
            ?>
</label>
			</p>
		</form>
	</div>
<?php 
        } else {
            echo "<div class=\"warning\">\n\t<p><strong>" . __('Attention!', 'thesis') . '</strong> ' . __('In order to edit your custom files, you&#8217;ll need to change the name of your <code>custom-sample</code> folder to <code>custom</code>.', 'thesis') . "</p>\n</div>\n";
        }
        ?>
</div>
<?php 
    }