Esempio n. 1
0
    function printAdminPage($options)
    {
        global $wpdb;
        ?>
		<div class=wrap>
		<form method="post" action="<?php 
        echo $_SERVER["REQUEST_URI"];
        ?>
">
		<?php 
        bwbsppl_nonce_field('update-suppleforms');
        ?>
		<h2>Supple Forms -> Form Settings</h2>
		<?php 
        if ($this->message) {
            echo '<div id="message" class="' . $this->msgclass . '"><p>' . $this->message . '</p></div>';
        }
        ?>
		<h3>Form Settings</h3>
		<table class="form-table">
			<tr><th><input type="submit" name="saveSuppleFormSettings" class="button-primary" value="<?php 
        _e('Save Form', 'suppleLang');
        ?>
" /></th><td><?php 
        if ($options['form_id']) {
            echo "<a href='admin.php?page=editSuppleFormFields&sppl_form_id=" . $options['form_id'] . "'>Add/Edit Fields</a>";
        } else {
            echo '&nbsp;';
        }
        ?>
</td></tr>
			<tr style='display:none;'>
				<th>Select form to edit:</th>
				<td>
					<?php 
        echo $this->getFormsDDL($options['form_id']);
        ?>
&nbsp;<input type="submit" name="showFieldSettings" tabindex="100" value="<?php 
        _e('Edit', 'suppleLang');
        ?>
" />
				</td>
			</tr>
			<tr>
				<th>Form Title:</th>
				<td>
					<input type='text' name="sppl_form_title" value='<?php 
        echo $options['form_title'];
        ?>
'/>
				</td>
			</tr>
			<tr style='display:none;'>
				<th>Post related form:</th>
				<td>
					<input type="checkbox" name="sppl_post_related" <?php 
        if ($options['post_related'] == 1) {
            echo 'checked';
        }
        ?>
> (If selected, post IDs will be stored with records)
				</td>
			</tr>
			<tr style='display:none;'>
				<th>Show on Write Post page:</th>
				<td>
					<input type="checkbox" name="sppl_write_page" <?php 
        if ($options['write_page'] == 1) {
            echo 'checked';
        }
        ?>
> (Allows editable forms in blog pages, not just Write Post)
				</td>
			</tr>
			<tr>
				<th>Hide WP custom fields:</th>
				<td>
					<input type="checkbox" name="sppl_hide_wp_customfields" <?php 
        if ($options['hide_wp_customfields'] == 1) {
            echo 'checked';
        }
        ?>
> (Remove Supple Forms custom fields from the WP custom fields edit box)
				</td>
			</tr>			
			<tr>
				<th>Placement on Write Post page:</th>
				<td>
					<select name="sppl_placement">
						<option value="0" <?php 
        if ($options['placement'] == 0) {
            echo 'selected=selected';
        }
        ?>
>After Post Editor</option>
						<option value="1" <?php 
        if ($options['placement'] == 1) {
            echo 'selected=selected';
        }
        ?>
>After Post Title</option>
						<option value="2" <?php 
        if ($options['placement'] == 2) {
            echo 'selected=selected';
        }
        ?>
>At Bottom</option>
					</select>
				</td>
			</tr>
			<tr>
				<th>Where to Store Data:<br/><span style='font-size: 9px;'>Custom Fields or <b>Custom Table<b/></span></th>
				<td>
					<input type="radio" name="sppl_use_custom_fields" value="1" <?php 
        if ($options['use_custom_fields'] == 1) {
            echo 'checked';
        }
        ?>
> WP Custom Fields<br/>
					<input type="radio" name="sppl_use_custom_fields" value="0" <?php 
        if ($options['use_custom_fields'] == 0) {
            echo 'checked';
        }
        ?>
> Custom Table<br/>
					WP Custom Fields will always be used for<br/>
					for fields that allow multiple entries.
				</td>
			</tr>
			<tr>
				<th>Custom Table Name:</th>
				<td>
					<input type='text' name="sppl_custom_tablename" value='<?php 
        echo $options['custom_tablename'];
        ?>
'/>
					<br/>- Only used if 'Custom Table' is selected above.<br/>
					- Supple Forms will prepend '<?php 
        echo $wpdb->prefix;
        ?>
supple_' to table name.
				<?php 
        if ($options['use_custom_fields'] == 1) {
            echo "<br/>- <span style='color:red;'>Custom Table not selected.</span>  Will not be used.";
        } else {
            if ($options['custom_tablename']) {
                ?>
					<br/><br/>
					Custom table name (use for sql calls in your code):
					<br/> <span style='color: red;'><?php 
                echo $wpdb->prefix . 'supple_' . $options['custom_tablename'];
                ?>
</span>
				<?php 
            } else {
                echo "<h3><span style='color:red;'>No custom table name given.</span></h3>";
            }
        }
        ?>
				</td>
			</tr>
			<tr>
				<th>
			<input type="submit" name="saveSuppleFormSettings" class="button-primary" value="<?php 
        _e('Save Form', 'suppleLang');
        ?>
" /></th>
			<td><?php 
        if ($options['form_id']) {
            echo "<a href='admin.php?page=editSuppleFormFields&sppl_form_id=" . $options['form_id'] . "'>Add/Edit Fields</a>";
        } else {
            echo '&nbsp;';
        }
        ?>
</td>
			</tr>
		</table>
</form>
</div>
<?php 
    }
Esempio n. 2
0
    /**
     * Displays the Add/Edit form for HTML Snips
     *
     * Snips let you build complex HTML templates for 
     * displaying your field data within a post
     * 
     */
    function showSnipsForm()
    {
        global $wpdb;
        $snipsDDL = $this->getSnipsDDL($this->snip_id);
        if ($this->snip_id) {
            $snipOptions = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . SUPPLESNIPSTABLE . ' WHERE snip_id = %d', $this->snip_id), ARRAY_A);
            if ($snipOptions) {
                if (get_magic_quotes_gpc()) {
                    $snipOptions['snip'] = stripslashes($snipOptions['snip']);
                    $snipOptions['css'] = stripslashes($snipOptions['css']);
                    $snipOptions['lists'] = stripslashes($snipOptions['lists']);
                }
            }
        }
        ?>
		<div class=wrap>
		<form method="post" action="<?php 
        echo $_SERVER["REQUEST_URI"];
        ?>
">
		<?php 
        bwbsppl_nonce_field('update-supplesnips');
        ?>
		<h2>Supple Forms -> HTML Snips Editor</h2>
		
		<?php 
        if ($this->message) {
            echo '<div id="message" class="' . $this->msgclass . '"><p>' . $this->message . '</p></div>';
        }
        ?>
		
		<h3>Add/Edit HTML Snips</h3>
<table class="form-table"><tr>
<tr>
<th><input type="submit" name="saveSuppleSnip" class="button-primary" tabindex="20" value="<?php 
        _e('Save Snip', 'suppleLang');
        ?>
" /></th>
<td>&nbsp;</td>
</tr>

<th>Select Snip to edit:</th><td><?php 
        echo $snipsDDL;
        ?>
&nbsp;<input type="submit" name="showSnipSettings" tabindex="100" value="<?php 
        _e('Edit', 'suppleLang');
        ?>
" /></td></tr>

<tr>
	<th>Snip name:</th>
	<td>
		<input type='text' name="sppl_snip_name" value='<?php 
        echo $snipOptions['snip_name'];
        ?>
'/>
		<ol><li>Used in shortcodes to display snip: <span style='color:red;'>[supple snip='<?php 
        if ($snipOptions['snip_name']) {
            echo $snipOptions['snip_name'];
        } else {
            echo 'my_snip';
        }
        ?>
']</span></li>
		<li>Use letters, numbers, and underscore ( _ ) only</li></ol>
	</td>
</tr>
<tr>
	<th>Auto-add to posts:<br/><span style='font-size: 9px;'>Not implemented at this time.</span></th>
	<td>
		<input type="radio" name="sppl_auto_add" value="0" <?php 
        if ($snipOptions['auto_add'] == 0) {
            echo 'checked';
        }
        ?>
 disabled> No auto-add<br/>
		<input type="radio" name="sppl_auto_add" value="1" <?php 
        if ($snipOptions['auto_add'] == 1) {
            echo 'checked';
        }
        ?>
 disabled> Add before content<br/>
		<input type="radio" name="sppl_auto_add" value="2" <?php 
        if ($snipOptions['auto_add'] == 1) {
            echo 'checked';
        }
        ?>
 disabled> Add to end of content<br/>
		Not implemented at this time...
	</td>
</tr>
<tr>
<th id='sppl_snip'>List of values:</th>
	<td>
		HTML snippet<br/>
		<textarea name="sppl_snip" cols="45" rows="6"><?php 
        echo htmlentities($snipOptions['snip']);
        ?>
</textarea>
		<br/>1) Use standard HTML to format your display<br/>2) Show field values with tags like: <span style='color:red;'>[my_field]</span>
	</td>
</tr>

<th id='sppl_css'>CSS:</th>
	<td>
		Enter as normal CSS for use with classes/IDs in your snips:<br/>
		<textarea name="sppl_css" cols="45" rows="4"><?php 
        echo htmlentities($snipOptions['css']);
        ?>
</textarea>
	</td>
</tr>
<tr>
	<th>Multi-value fields formats:</th>
	<td>
		<textarea name="sppl_lists" cols="15" rows="3"><?php 
        echo htmlentities($snipOptions['lists']);
        ?>
</textarea>
		<br/>Format multi-value fields as lists by entering formats from below. Place each format on a new line, and enter formats in order for each multi-value field used in snip. <br/>Enter only one format to use same for all multi-value fields.<h3>Formats:</h3><ul><li><b>ol</b> - will turn values for a field into an ordered list</li>
		<li><b>ul</b> - unordered list</li>
		<li><b>br</b> - new line</li>
		<li><b>", "</b> (without the quotation marks) - will separate items with comma and space </li>
		<li><b>any other delimiter</b> - only 'ol', 'ul', and 'br' will be transformed into tags</li>
		</ul>
		
	</td>
</tr>

<tr>
<th><input type="submit" name="saveSuppleSnip" class="button-primary" tabindex="20" value="<?php 
        _e('Save Snip', 'suppleLang');
        ?>
" /></th>
<td>&nbsp;
</td>
</tr>
</table>
</form>
<br/>
<?php 
    }