PluginProbe
Code Embed / 1.6.1
Code Embed v1.6.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 / includes / code-embed-options.php

code-embed-options.php in Code Embed 1.6.1, at includes/code-embed-options.php

82 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 ace_get_embed_paras Get the options
11 * @uses ace_help Return help text
12 */
13 ?>
14 <div class="wrap">
15 <?php screen_icon(); ?>
16 <h2>Artiss Code Embed Options</h2>
17 <?php
18 // If options have been updated on screen, update the database
19 if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'code-embed-profile' , 'code_embed_profile_nonce' ) ) ) {
20
21 // Update the options array from the form fields. Strip invalid tags.
22 $options[ 'opening_ident' ] = strtoupper( trim( $_POST[ 'code_embed_opening' ], '[]<>' ) );
23 $options[ 'keyword_ident' ] = strtoupper( trim( $_POST[ 'code_embed_keyword' ], '[]<>' ) );
24 $options[ 'closing_ident' ] = strtoupper( trim( $_POST[ 'code_embed_closing' ], '[]<>' ) );
25
26 // If any fields are blank assign default values
27 if ( $options[ 'opening_ident' ] == "" ) {$options[ 'opening_ident' ] = "%";}
28 if ( $options[ 'keyword_ident' ] == "" ) {$options[ 'keyword_ident' ] = "CODE";}
29 if ( $options[ 'closing_ident' ] == "" ) {$options[ 'closing_ident' ] = "%";}
30
31 update_option( 'artiss_code_embed', $options );
32 }
33
34 // Fetch options into an array
35 $options = ace_get_embed_paras();
36 ?>
37
38 <form method="post" action="<?php echo get_bloginfo('wpurl').'/wp-admin/options-general.php?page=code-embed-options&amp;updated=true' ?>">
39
40 <?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.' ); ?>
41
42 <table class="form-table">
43
44 <tr>
45 <th scope="row"><?php _e( 'Keyword' ); ?></th>
46 <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>
47 </tr>
48
49 <tr>
50 <th scope="row"><?php _e( 'Opening Identifier' ); ?></th>
51 <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>
52 </tr>
53
54 <tr>
55 <th scope="row"><?php _e( 'Closing Identifier' ); ?></th>
56 <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>
57 </tr>
58
59 </table>
60
61 <?php wp_nonce_field( 'code-embed-profile', 'code_embed_profile_nonce', true, true ); ?>
62
63 <br/><input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Settings' ); ?>"/>
64
65 </form>
66
67 <?php
68
69 _e( '<h3>How to Embed</h3>' );
70 _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>' );
71 _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>' );
72 _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>' );
73
74 _e( '<h3>Support Information</h3>' );
75 if ( !function_exists( 'add_contextual_help' ) ) {
76 _e( ace_options_help() );
77 } else {
78 _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>' );
79 }
80 ?>
81
82 </div>