| 1 |
<?php |
| 2 |
/** |
| 3 |
* CryptX option page "Presentation"-Tab |
| 4 |
*/ |
| 5 |
function rw_cryptx_settings_tab_content_presentation() { |
| 6 |
$CryptX_instance = Cryptx\CryptX::getInstance(); |
| 7 |
$cryptXOptions = $CryptX_instance->loadCryptXOptionsWithDefaults(); |
| 8 |
if ( 'presentation' != rw_cryptx_getActiveTab() ) |
| 9 |
return; |
| 10 |
?> |
| 11 |
|
| 12 |
<h4><?php _e("Define CSS Options",'cryptx'); ?></h4> |
| 13 |
|
| 14 |
<table> |
| 15 |
<tr> |
| 16 |
<th><label for="cryptX_var[css_id]"><?php _e("CSS ID",'cryptx'); ?></label></th> |
| 17 |
<td><input name="cryptX_var[css_id]" value="<?php echo $cryptXOptions['css_id']; ?>" type="text" class="regular-text" /><br /><?php _e("Please be careful using this feature! IDs should be unique. You should prefer of using a css class instead.",'cryptx'); ?></td> |
| 18 |
</tr> |
| 19 |
<tr> |
| 20 |
<th><label for="cryptX_var[css_class]"><?php _e("CSS Class",'cryptx'); ?></label></th> |
| 21 |
<td><input name="cryptX_var[css_class]" value="<?php echo $cryptXOptions['css_class']; ?>" type="text" class="regular-text" /></td> |
| 22 |
</tr> |
| 23 |
</table> |
| 24 |
|
| 25 |
<h4><?php _e("Define Presentation Options",'cryptx'); ?></h4> |
| 26 |
|
| 27 |
<table> |
| 28 |
<tbody> |
| 29 |
<tr> |
| 30 |
<td><input name="cryptX_var[opt_linktext]" type="radio" id="opt_linktext" value="0" <?php checked( $cryptXOptions['opt_linktext'], 0 ); ?> /></td> |
| 31 |
<th scope="row"><label for="cryptX_var[at]"><?php _e("Replacement for '@'",'cryptx'); ?></label></th> |
| 32 |
<td><input name="cryptX_var[at]" value="<?php echo $cryptXOptions['at']; ?>" type="text" class="regular-text" /></td> |
| 33 |
</tr> |
| 34 |
<tr> |
| 35 |
<td> </td> |
| 36 |
<th scope="row"><label for="cryptX_var[dot]"><?php _e("Replacement for '.'",'cryptx'); ?></label></th> |
| 37 |
<td><input name="cryptX_var[dot]" value="<?php echo $cryptXOptions['dot']; ?>" type="text" class="regular-text" /></td> |
| 38 |
</tr> |
| 39 |
|
| 40 |
<tr class="spacer"> |
| 41 |
<td colspan="3"><hr></td> |
| 42 |
</tr> |
| 43 |
|
| 44 |
<tr> |
| 45 |
<td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext2" value="1" <?php checked( $cryptXOptions['opt_linktext'], 1 ); ?> /></td> |
| 46 |
<th><label for="cryptX_var[alt_linktext]"><?php _e("Text for link",'cryptx'); ?></label></th> |
| 47 |
<td><input name="cryptX_var[alt_linktext]" value="<?php echo $cryptXOptions['alt_linktext']; ?>" type="text" class="regular-text" /></td> |
| 48 |
</tr> |
| 49 |
|
| 50 |
<tr class="spacer"> |
| 51 |
<td colspan="3"><hr></td> |
| 52 |
</tr> |
| 53 |
|
| 54 |
<tr> |
| 55 |
<td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext3" value="2" <?php checked( $cryptXOptions['opt_linktext'], 2 ); ?> /></td> |
| 56 |
<th><label for="cryptX_var[alt_linkimage]"><?php _e("Image-URL",'cryptx'); ?></label></th> |
| 57 |
<td><input name="cryptX_var[alt_linkimage]" value="<?php echo $cryptXOptions['alt_linkimage']; ?>" type="text" class="regular-text" /></td> |
| 58 |
</tr> |
| 59 |
<tr> |
| 60 |
<td scope="row"> </td> |
| 61 |
<th><label for="cryptX_var[http_linkimage_title]"><?php _e("Title-Tag for the Image",'cryptx'); ?></label></th> |
| 62 |
<td><input name="cryptX_var[http_linkimage_title]" value="<?php echo $cryptXOptions['http_linkimage_title']; ?>" type="text" class="regular-text" /></td> |
| 63 |
</tr> |
| 64 |
|
| 65 |
<tr class="spacer"> |
| 66 |
<td colspan="3"><hr></td> |
| 67 |
</tr> |
| 68 |
|
| 69 |
<tr> |
| 70 |
<td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext4" value="3" <?php checked( $cryptXOptions['opt_linktext'], 3 ); ?>/></td> |
| 71 |
<th><label for="upload_image_button"><?php _e("Select an uploaded image",'cryptx'); ?></label></th> |
| 72 |
<td> |
| 73 |
<input id="upload_image_button" type="button" class="button" value="<?php _e( 'Upload image' ); ?>" /> |
| 74 |
<input id="remove_image_button" type="button" class="button button-link-delete hidden" value="<?php _e( 'Delete image' ); ?>" /> |
| 75 |
<span id="opt_linktext4_notice"><?php _e("You have to upload an image first before this option can be activated.",'cryptx'); ?></span> |
| 76 |
<input type='hidden' name='cryptX_var[alt_uploadedimage]' id='image_attachment_id' value='<?php echo $cryptXOptions['alt_uploadedimage']; ?>'> |
| 77 |
<div> |
| 78 |
<img id='image-preview' src='<?php echo wp_get_attachment_url( $cryptXOptions['alt_uploadedimage'] ); ?>'> |
| 79 |
</div> |
| 80 |
</td> |
| 81 |
</tr> |
| 82 |
<tr> |
| 83 |
<td> </td> |
| 84 |
<th><label for="cryptX_var[alt_linkimage_title]"><?php _e("Title-Tag for the Image",'cryptx'); ?></label></th> |
| 85 |
<td><input name="cryptX_var[alt_linkimage_title]" value="<?php echo $cryptXOptions['alt_linkimage_title']; ?>" type="text" class="regular-text" /></td> |
| 86 |
</tr> |
| 87 |
|
| 88 |
<tr class="spacer"> |
| 89 |
<td colspan="3"><hr></td> |
| 90 |
</tr> |
| 91 |
|
| 92 |
<tr> |
| 93 |
<td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext4" value="4" <?php checked( $cryptXOptions['opt_linktext'], 4 ); ?> /></td> |
| 94 |
<th colspan="2"><?php _e("Text scrambled by AntiSpamBot (<small>Try it and look at your site and check the html source!</small>)",'cryptx'); ?></th> |
| 95 |
</tr> |
| 96 |
|
| 97 |
<tr class="spacer"> |
| 98 |
<td colspan="3"><hr></td> |
| 99 |
</tr> |
| 100 |
|
| 101 |
<tr> |
| 102 |
<td scope="row"><input type="radio" name="cryptX_var[opt_linktext]" id="opt_linktext5" value="5" <?php checked( $cryptXOptions['opt_linktext'], 5 ); ?> /></td> |
| 103 |
<th><?php _e("Convert Email to PNG-image",'cryptx'); ?></th> |
| 104 |
<td><?php _e("Example with the saved options: ",'cryptx'); ?> <img src="<?php echo get_bloginfo('url'); ?>/<?php echo md5( get_bloginfo('url') ); ?>/<?php echo antispambot("CryptX@".$CryptX_instance->getDomain()); ?>" align="absmiddle" alt="<?php echo antispambot("CryptX@".$CryptX_instance->getDomain()); ?>" title="<?php echo antispambot("CryptX@".$CryptX_instance->getDomain()); ?>"></td> |
| 105 |
</tr> |
| 106 |
<tr> |
| 107 |
<td> </td> |
| 108 |
<th><label for="cryptX_var[c2i_font]"><?php _e("Font",'cryptx'); ?></label></th> |
| 109 |
<td><select name="cryptX_var[c2i_font]"> |
| 110 |
<?php |
| 111 |
foreach($CryptX_instance->getFilesInDirectory( CRYPTX_DIR_PATH . 'fonts', ["ttf"]) as $font) { |
| 112 |
printf('<option value="%1$s" %3$s>%2$s</option>', |
| 113 |
$font, |
| 114 |
str_replace(".ttf", "", $font), |
| 115 |
($cryptXOptions['c2i_font'] == $font)? "selected" : "" |
| 116 |
); |
| 117 |
} |
| 118 |
?> |
| 119 |
</select></td> |
| 120 |
</tr> |
| 121 |
<tr> |
| 122 |
<td> </td> |
| 123 |
<th><label for="cryptX_var[c2i_fontSize]"><?php _e("Font size (pixel)",'cryptx'); ?></label></th> |
| 124 |
<td><input name="cryptX_var[c2i_fontSize]" value="<?php echo $cryptXOptions['c2i_fontSize']; ?>" type="number" class="regular-text" /></td> |
| 125 |
</tr> |
| 126 |
<tr> |
| 127 |
<td> </td> |
| 128 |
<th><label for="cryptX_var[c2i_fontRGB]"><?php _e("Font color (RGB)",'cryptx'); ?></label></th> |
| 129 |
<td><input name="cryptX_var[c2i_fontRGB]" value="<?php echo $cryptXOptions['c2i_fontRGB']; ?>" type="text" class="color-field regular-text" /></td> |
| 130 |
</tr> |
| 131 |
</tbody> |
| 132 |
</table> |
| 133 |
<?php submit_button(); ?> |
| 134 |
<?php |
| 135 |
} |
| 136 |
add_action( 'rw_cryptx_settings_content', 'rw_cryptx_settings_tab_content_presentation' ); |