PluginProbe
Code Embed / 1.5.1
Code Embed v1.5.1
2.6.4 2.6.3 2.6.2 2.6.1 trunk 1.0 1.1 1.2 1.3 1.4.1 1.5.1 1.6.1 2.0.2 2.1.2 2.2.2 2.3.9 2.4 2.5.1 2.5.2 2.6
simple-embed-code / simple-code-embed-options.php

simple-code-embed-options.php in Code Embed 1.5.1, at simple-code-embed-options.php

81 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Code Embed Options
4 *
5 * Allow the user to change the default options
6 *
7 * @package Artiss-Code-Embed
8 * @since 1.4
9 *
10 * @uses artiss_code_embed_help Return help text
11 */
12 ?>
13 <div class="wrap">
14 <?php screen_icon(); ?>
15 <h2>Artiss Code Embed Options</h2>
16 <?php
17 // If options have been updated on screen, update the database
18 if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'code-embed-profile' , 'code_embed_profile_nonce' ) ) ) {
19
20 // Update the options array from the form fields. Strip invalid tags.
21 $options[ 'opening_ident' ] = strtoupper( trim( $_POST[ 'code_embed_opening' ], '[]<>' ) );
22 $options[ 'keyword_ident' ] = strtoupper( trim( $_POST[ 'code_embed_keyword' ], '[]<>' ) );
23 $options[ 'closing_ident' ] = strtoupper( trim( $_POST[ 'code_embed_closing' ], '[]<>' ) );
24
25 // If any fields are blank assign default values
26 if ( $options[ 'opening_ident' ] == "" ) {$options[ 'opening_ident' ] = "%";}
27 if ( $options[ 'keyword_ident' ] == "" ) {$options[ 'keyword_ident' ] = "CODE";}
28 if ( $options[ 'closing_ident' ] == "" ) {$options[ 'closing_ident' ] = "%";}
29
30 update_option( 'artiss_code_embed', $options );
31 }
32
33 // Fetch options into an array
34 $options = get_code_embed_paras();
35 ?>
36
37 <form method="post" action="<?php echo get_bloginfo('wpurl').'/wp-admin/options-general.php?page=artiss-code-embed-settings&amp;updated=true' ?>">
38
39 <?php _e( '<h3>Identifier Format</h3>Specify the format that will be used to define the way the code is embedded in your post.<br/>The formats are case insensitive and characters &lt; &gt [ ] are invalid.' ); ?>
40
41 <table class="form-table">
42
43 <tr>
44 <th scope="row"><?php _e('Keyword'); ?></th>
45 <td><input type="text" size="12" maxlength="12" name="code_embed_keyword" value="<?php echo $options['keyword_ident']; ?>"/>&nbsp;<span class="description">The keyword that is used to name the custom field and then place in your post where the code should be embedded. A suffix on any type can then be placed on the end.</span></td>
46 </tr>
47
48 <tr>
49 <th scope="row"><?php _e('Opening Identifier'); ?></th>
50 <td><input type="text" size="4" maxlength="4" name="code_embed_opening" value="<?php echo $options['opening_ident']; ?>"/>&nbsp;<span class="description">The character(s) that must be placed in the post before the keyword to uniquely identify it.</span></td>
51 </tr>
52
53 <tr>
54 <th scope="row"><?php _e('Closing Identifier'); ?></th>
55 <td><input type="text" size="4" maxlength="4" name="code_embed_closing" value="<?php echo $options['closing_ident']; ?>"/>&nbsp;<span class="description">The character(s) that must be placed in the post after the keyword to uniquely identify it.</span></td>
56 </tr>
57
58 </table>
59
60 <?php wp_nonce_field( 'code-embed-profile', 'code_embed_profile_nonce', true, true ); ?>
61
62 <br/><input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Settings'); ?>"/>
63
64 </form>
65
66 <?php
67
68 _e( '<h3>How to Embed</h3>' );
69 _e( '<p>To add a custom field containing embed code simple name it <strong>'.$options[ 'keyword_ident'].'x</strong>, where <strong>x</strong> is any suffix you wish. The code to embed is then added as the field value.</p>' );
70 _e( '<p>Then, to add the code into your post simple add <strong>'.$options[ 'opening_ident'].$options[ 'keyword_ident']."x".$options[ 'closing_ident'].'</strong> where you wish it to appear. <strong>x</strong> is the suffix you used for the custom field name.</p>' );
71 _e( '<p>For example, I may add a custom field named <strong>'.$options[ 'keyword_ident'].'1</strong>, where the value is the code I wish to embed. I would then in my post add <strong>'.$options[ 'opening_ident'].$options[ 'keyword_ident']."1".$options[ 'closing_ident'].'</strong> where I wish the code to then appear.</p>' );
72
73 _e( '<h3>Support Information</h3>' );
74 if ( !function_exists( 'add_contextual_help' ) ) {
75 _e( artiss_code_embed_help() );
76 } else {
77 _e( '<p>Useful support information and links can be found by clicking on the Help tab at the top right-hand of the screen.</p>' );
78 }
79 ?>
80
81 </div>