예제 #1
0
function weaverii_save_post_fields($post_id)
{
    // for backward compatibility, we will retain the ttw prefix names so old sites will still work with per page options - mostly...
    $default_post_fields = array('ttw_category', 'ttw_tag', 'ttw_onepost', 'ttw_orderby', 'ttw_order', 'ttw_author', 'ttw_posts_per_page', 'hide_sidebar_primary', 'hide_sidebar_right', 'hide_sidebar_left', 'top-widget-area', 'bottom-widget-area', 'sitewide-top-widget-area', 'sitewide-bottom-widget-area', 'wvr_post_type', 'ttw-hide-page-title', 'ttw-hide-site-title', 'ttw-hide-menus', 'ttw-hide-header-image', 'ttw-hide-footer', 'ttw-hide-header', 'ttw_hide_sticky', 'ttw-force-post-full', 'ttw-force-post-excerpt', 'ttw-show-post-avatar', 'ttw-favorite-post', 'ttw_show_extra_areas', 'ttw_hide_sidebars', 'bodyclass', 'ttw_show_replace_primary', 'ttw_replace_right', 'ttw_replace_left', 'hide_top_post_meta', 'hide_bottom_post_meta', 'ttw-show-featured', 'ttw-hide-featured-header', 'ttw-stay-on-page', 'ttw-hide-on-menu', 'wvr_show_pp_featured_img', 'ttw_hide_pp_infotop', 'ttw_hide_pp_infobot', 'ttw_show_replace_alternative', 'ttw_per_post_style', 'hide_visual_editor', 'wvr_masonry_span2', 'hide_post_bubble', 'hide_post_title', 'post_add_link', 'hide_post_format_label', 'wvr_page_layout', 'wvr_pwp_type', 'wvr_pwp_cols', 'ttw-hide-header-widget', 'wvr-hide-page-infobar', 'pp_post_filter', 'wvr-hide-on-menu-logged-in', 'wvr-hide-on-menu-logged-out', 'wvr-hide-on-mobile', 'wvr_hide_n_posts', 'wvr_fullposts', 'replace_horiz_header', 'wvr_pwp_masonry', 'wvr_pwp_compact', 'wvr_pwp_compact_posts');
    if (weaverii_allow_multisite()) {
        array_push($default_post_fields, 'wvr_raw_html');
    }
    $all_post_fields = $default_post_fields;
    if (isset($_POST['wii_post_meta'])) {
        foreach ($all_post_fields as $post_field) {
            if (isset($_POST[$post_field])) {
                $data = stripslashes($_POST[$post_field]);
                if ($post_field == 'ttw_show_extra_areas' || $post_field == 'ttw_replace_right' || $post_field == 'ttw_replace_left') {
                    $data = strtolower($data);
                    // force to lower case
                }
                if (get_post_meta($post_id, $post_field) == '') {
                    add_post_meta($post_id, $post_field, weaverii_filter_textarea($data), true);
                } else {
                    if ($data != get_post_meta($post_id, $post_field, true)) {
                        update_post_meta($post_id, $post_field, weaverii_filter_textarea($data));
                    } else {
                        if ($data == '') {
                            delete_post_meta($post_id, $post_field, get_post_meta($post_id, $post_field, true));
                        }
                    }
                }
            } else {
                delete_post_meta($post_id, $post_field, get_post_meta($post_id, $post_field, true));
            }
        }
    }
}
예제 #2
0
function weaverii_pro_saverestore()
{
    /* admin tab for saving and restoring theme */
    $weaverii_theme_dir = weaverii_f_uploads_base_dir() . 'weaverii-theme/';
    ?>
    <div class="wvr-option-subheader">Save/Restore Settings using Files on your site host (&#9679;Pro)</div>
    <h4>You can save all your current settings in a backup file:</h4>
    <ol style="font-size: 90%">
     <li>Save <em>all</em> your current settings in a backup file on your site's file system (in <?php 
    echo $weaverii_theme_dir;
    ?>
). Automatically names the backup file to include current date and time.
     Survives Weaver II Theme updates. -or-</li>
    <li>Save only <em>theme related</em> settings to a file you name on your Site's file system (in <?php 
    echo $weaverii_theme_dir;
    ?>
.</li>
    </ol>
<?php 
    if (weaverii_allow_multisite()) {
        ?>
    <h4>You can restore a saved theme or backup file by:</h4>
    <ol style="font-size: 90%">
    <li>Restoring a theme/backup that you saved in a file on your site (to current settings). -or-</li>
    <li>Uploading a theme/backup from a file saved on your own computer (to current settings). </li>
    </ol>
<?php 
    }
    if (!weaverii_allow_multisite()) {
        ?>
    <h4>You will be unable to restore your saved file directly</h4>
    <p>Since this is a WordPress Multi-site installation, you are restricted from uploading
    a Weaver II theme/backup from a saved file. However, the save file capability gives you the ability
    to save your work so you can transfer it to a WordPress site where you have full admin
    capabilities (non-Multi-site installation, for example), or to share with others. Please
    note that you <em>can</em> save your settings in the WordPress Database which will allow you
    to explore other predefined themes without losing your work.
    </p>
<?php 
    }
    ?>
  <br />
    <div class="wvr-option-subheader">Save All Current Settings in Backup File (&#9679;Pro)</div><br />
     <strong>Backup</strong> <u>all</u> current options in a <strong>file</strong> on your
     WordPress Site's <em><?php 
    echo $weaverii_theme_dir;
    ?>
</em> directory named 'weaverii_backup_yyyy-mm-dd-hhmm.w2b'
     where the last part is a GMT based date and time stamp.
<?php 
    if (weaverii_allow_multisite()) {
        ?>
    You will be able to restore this theme later using the <strong>Restore Saved Theme/Backup</strong> section.
<?php 
    }
    ?>
    Please be sure you've saved any changes you might have made.<br />
     <form enctype="multipart/form-data" name='backup-settings' method='post'>
	<span class='submit'><input name='backup_settings' type='submit' value='Backup All Current Settings'/></span>
    <?php 
    weaverii_nonce_field('backup_settings');
    ?>
    </form><br />

    <div class="wvr-option-subheader">Save Current Theme Related Settings to File (&#9679;Pro)</div><br />
     <strong>Save</strong> current <em>theme related</em> settings, either by downloading
    to <strong>your computer</strong> or saving a <strong>file</strong> on your WordPress Site's <em><?php 
    echo $weaverii_theme_dir;
    ?>
</em> directory.
<?php 
    if (weaverii_allow_multisite()) {
        ?>
    You will be able to restore this theme later using the <strong>Restore Saved Theme/Backup</strong> section.
<?php 
    }
    ?>
    <em>Theme related</em> settings include most standard Weaver settings <em>except</em>: Site Copyright, SEO settings,
    Weaver Pro HTML Insert areas, Background Images, FavIcons, and Weaver II Pro shortcode settings.<br /><br />

  <strong>Save as file on this website's server</strong>
 <p>Please provide a name for your file, then click the "Save File" button. <b>Warning:</b> Duplicate names will
    automatically overwrite existing file without notification.</p>
 <form enctype="multipart/form-data" name='savetheme' method='post'><table cellspacing='10' cellpadding='5'>
    <tr>
    <td>Name for saved theme: <input type="text" name="savethemename" size="30" />&nbsp;<small>(Please use a meaningful
    name - do not provide file extension. Name might be altered to standard form.)</small></td></tr>
	<tr>
	<td><span class='submit'><input name='filesavetheme' type='submit' value='Save Theme in File'/></span>&nbsp;&nbsp;
	<strong>Save Theme in File</strong> - <small>Theme will be saved in <em><?php 
    echo $weaverii_theme_dir;
    ?>
</em>
	directory on your site server.</small></td>
        </tr>
    </table>
    <?php 
    weaverii_nonce_field('filesavetheme');
    ?>
 </form><br />

<?php 
    if (weaverii_allow_multisite()) {
        ?>


    <div class="wvr-option-subheader">Restore Saved Theme/Backup from file (&#9679;Pro)</div><br />
    You can restore a previously saved theme (.w2t) or backup (.w2b) file directly from your WordPress
    Site's <em><?php 
        echo $weaverii_theme_dir;
        ?>
</em> directory, or from a file saved on your computer.
    Note: after you restore a saved theme, it will be loaded into the current settings. A <em>theme</em> restore will
    replace only settings that are not site-specific. A <em>backup</em> file will replace all current settings.
    If you've uploaded the theme from your computer, you might then want to also save a local copy on your
    website server.<br /><br />

    <form enctype="multipart/form-data" name='localrestoretheme' method='post'><table cellspacing='10' cellpadding='5'>
    <table>
    <tr><td><strong>Restore from file saved on this website's server</strong></td></tr>
    <tr>
        <td>Select theme/backup file: <?php 
        weaverii_subtheme_list('wii_restorename');
        ?>
&nbsp;Note: <strong>.w2t</strong> are Theme definitions. <strong>.w2b</strong> are full backups. (Restores to current settings.)</td></tr>
	<tr>
	<td><span class='submit'><input name='restoretheme' type='submit' value='Restore Theme/Backup'/></span>&nbsp;&nbsp;
	<strong>Restore</strong> a theme/backup you've previously saved on your site's <em><?php 
        echo $weaverii_theme_dir;
        ?>
</em> directory. Will replace current settings.</td>
    </tr>
        <tr><td>&nbsp;</td></tr>
    </table>
    <?php 
        weaverii_nonce_field('restoretheme');
        ?>
    </form>

<div class="wvr-option-subheader">Save Settings for Alternate Mobile Theme (&#9679;Pro)<?php 
        weaverii_help_link('help.html#AltMobileTheme', 'Help on Alternate Mobile Theme');
        ?>
</div>
<p>This will save your current settings to a special Mobile Settings database entry. You can use this to create a totally
separate style used when the site is viewed from a Mobile device. You <strong>must</strong> enable the
<em>Use Alternate Mobile Theme</em> option on the Advanced:Mobile tab for these settings to be used. <strong>IMPORTANT!</strong> Be sure to save backup copies of both your normal and mobile theme settings using one of the above
save to file options. You will need them to be able to tweak the alternate mobile theme settings.</p>
  <form name="wii_save_mobile_form" method="post"
	<span class="submit"><input type="submit" name="save_mobiletheme" value="Save Settings for Mobile View"/></span>
	<strong>Save all current settings in Alternate Mobile Theme Settings.</strong>
<?php 
        weaverii_nonce_field('save_mobiletheme');
        ?>
    </form>


    <form enctype="multipart/form-data" name='themenames' method='post'>
    <div class="wvr-option-subheader">Theme Name and Description (&#9679;Pro)</div>
        <p>You can change the name an description of your current settings if you would like to create a new theme
	theme file for sharing with others, or for you own identification.
	</p>
	<input name="wii_themename" id="wii_themename" value="<?php 
        echo weaverii_getopt('wii_themename');
        ?>
" />
	<br />
	<textarea name="wii_theme_description" id="_wii_favicon_url" rows=2 style="width: 350px"><?php 
        echo esc_textarea(weaverii_getopt('wii_theme_description'));
        ?>
</textarea>
	<br />
        <span class='submit'><input name='renametheme' type='submit' value='Save Theme Name and Description'/></span>
        <?php 
        weaverii_nonce_field('renametheme');
        ?>
    </form>
    <br />

    <form enctype="multipart/form-data" name='maintaintheme' method='post'>
    <div class="wvr-option-subheader" >Subtheme and Backup File Maintenance (&#9679;Pro)</div><br />
        <?php 
        weaverii_subtheme_list('selectName');
        ?>

        <span class='submit'><input name='deletetheme' type='submit' value='Delete Subtheme/Backup File'/></span>
          <strong>Warning!</strong> This action can't be undone, so be sure you mean to delete a file!
	  <?php 
        weaverii_nonce_field('deletetheme');
        ?>
    </form>
<?php 
    }
    ?>
    <br />
<?php 
}
예제 #3
0
function weaverii_adv_head_section()
{
    weaverii_hide_advanced('begin');
    ?>
<div class="wvr-option-header">The Site &lt;HEAD&gt; Section
<?php 
    weaverii_help_link('help.html#HeadSection', 'Help for site HEAD section');
    ?>
</div><br />
<p>
	This tab allows you to define custom code and style rules to the &lt;HEAD&gt; Section of every page on your site.
</p>

<?php 
    if (weaverii_allow_multisite()) {
        ?>

	<p><small>PLEASE NOTE: Only minimal validation is made on the field values, so be careful not to use invalid code.
	Invalid code is usually harmless, but it can make your site display incorrectly. If your site looks broken after make changes here,
	 please double check that what you entered uses valid HTML or CSS rules.</small></p>

    <a name="advancedcss" id="advancedcss"></a>
	<div class="wvr-option-subheader">Custom CSS Rules</div><br />

	<!-- ======== -->
	<span style="color:#6666FF;"><b>Add your own custom CSS Rules to Weaver II's style rules</b></span><br/>
	<p>
		This section allows you to add new CSS Rules to your theme to enhance or override the styling set using
		Weaver's Main Options. For example, Weaver's documentation includes many <em>CSS Snippets</em> that allow you
		to find tune the look of your site. You simply add whatever CSS Rules you need into the box below. Include the
		complete rule. You do <em>not</em> need to add &lt;style&gt; HTML tags to bracket your rules.</p>
	<p>
		Rules you add here
		will be the <em>last</em> CSS Rules included by Weaver, and thus override all other Weaver generated CSS rules.
		It is possible that other plugins might generate CSS that comes after these rules.
	</p>
<textarea name="<?php 
        weaverii_sapi_main_name('wii_add_css');
        ?>
" rows=7 style="width: 95%"><?php 
        weaverii_esc_textarea(weaverii_getopt('wii_add_css'));
        ?>
</textarea>

<br /><br /><?php 
        weaverii_sapi_submit();
        ?>
<br /><br />

		<!-- ======== -->

	<a name="headsection" id="headsection"></a>
	<div class="wvr-option-subheader">&lt;HEAD&gt; Section</div><br/>

<p>
	This input area allows you to enter custom HTML such as &lt;link&gt; and &lt;meta&gt; statements, or JavaScript code to your site.
	Code entered into this box is included right before the &lt;/HEAD&gt; HTML tag on each page of your site.
    Shortcodes are not supported in this option.
    We recommend using dedicated WordPress plugins to add things like ad tracking, SEO tags, Facebook code, and the like.
	<small>Note: Use the "Custom CSS Rules" option above to add custom CSS Rules to your site.</small>
</p>
<p>
	You can also add code to the &lt;HEAD&gt; section on a per page basis using the per page options from the page editor.
</p>
<?php 
        $head = weaverii_getopt('wii_head_opts');
        if ($head != '' || weaverii_init_base() || function_exists('weaverii_tx_head_opts')) {
            ?>
				<textarea name="<?php 
            weaverii_sapi_main_name('wii_head_opts');
            ?>
" rows=2 style="width: 95%"><?php 
            weaverii_esc_textarea($head);
            ?>
</textarea>

<?php 
        } else {
            // WordPress 3.9 standards compliance: Themes are no longer allowed to add JavaScript via the wp_head action.
            // After a long discussion on the Theme Reviewers mail list, the consent was reached that for backward compatibility,
            // the previous option could be displayed IF a previous setting was already present (i.e., $head != ''), or the user
            // had installed the theme support plugin, or the premium version of the theme is used.
            ?>
<p style="color:red;">Due to WordPress.org theme standards (since WP 3.9), this option is not supported
by Weaver II Free. You must install the <em>Weaver II Theme Extras</em> plugin, or have <em>Weaver II Pro</em> to add
code to this option.
</p>
<?php 
        }
        ?>
    <br />
	 <small>Weaver II will <em>always</em> load the jQuery Library.</small>
	<!-- ===================================================== -->
    <br />
	<br />

	<a name="headsection" id="headsection"></a>
	<div class="wvr-option-subheader">&lt;HEAD&gt; Section (Advanced Alternative - &diams;)</div>

<p>
	<small>Same as normal &lt;HEAD&gt; box above, but works like other &diams; options - it survives changing
	the subtheme from the Weaver II Subthemes tab, and is saved only on a full backup Save. This option is
	not commonly used, and is intended for more advanced Weaver II users to add &lt;script&gt; and &lt;style&gt;
	blocks to the &lt;head&gt; section.
	</small>
</p>
				<textarea name="<?php 
        weaverii_sapi_main_name('_wii_althead_opts');
        ?>
" rows=2 style="width: 95%"><?php 
        weaverii_esc_textarea(weaverii_getopt('_wii_althead_opts'));
        ?>
</textarea>
<br />
<br />
<?php 
        if (weaverii_init_base()) {
            ?>
	<div class="wvr-option-header">Actions and Filters
<?php 
            weaverii_help_link('help.html#ActionsFilters', 'Help for Actions and Filters');
            ?>
</div><br />
	<p><strong>This Option for Advanced Users!</strong> You can add arbitrary PHP code here. This option is intended to allow
	you to add WordPress Actions and Filters to your own site. This PHP code is executed at the very
	beginning of the theme's header.php template file before any site HTML is emitted. Do NOT bracket the code with &lt;?php and ?&gt;. See the Help file for more technical details.</p>

	<textarea name="<?php 
            weaverii_sapi_main_name('_phpactions');
            ?>
" rows=2 style="width: 95%"><?php 
            echo stripslashes(wp_check_invalid_utf8(addslashes(weaverii_getopt('_phpactions'))));
            ?>
</textarea>

<?php 
        } else {
            echo "<p><strong>Weaver II Pro Feature:</strong> <em>Actions and Filters</em> allows\n\tyou to add arbitrary PHP code to support WordPress Actions and Filters on your own site.</p> ";
        }
    }
    // not multisite
    weaverii_hide_advanced('end');
}