| 60 | | add_action("load-$page", array(&$this, 'admin_load')); |
| 61 | | add_action("load-$page", array(&$this, 'take_action'), 49); |
| 62 | | add_action("load-$page", array(&$this, 'handle_upload'), 49); |
| | 60 | add_action( "load-$page", array( &$this, 'admin_load' ) ); |
| | 61 | add_action( "load-$page", array( &$this, 'take_action' ), 49 ); |
| | 62 | add_action( "load-$page", array( &$this, 'handle_upload' ), 49 ); |
| 120 | | if ( isset($_POST['background-color']) ) { |
| 121 | | $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']); |
| 122 | | if ( strlen($color) == 6 || strlen($color) == 3 ) |
| 123 | | set_theme_mod('background_color', $color); |
| | 120 | if ( isset( $_POST['background-color'] ) ) { |
| | 121 | $color = preg_replace( '/[^0-9a-fA-F]/', '', $_POST['background-color'] ); |
| | 122 | if ( strlen( $color ) == 6 || strlen( $color ) == 3 ) |
| | 123 | set_theme_mod( 'background_color', $color ); |
| 154 | | <tr valign="top"> |
| 155 | | <th scope="row"><?php _e('Current Image'); ?></th> |
| 156 | | <td> |
| 157 | | <style type="text/css"> |
| 158 | | #custom-background-image { |
| 159 | | background-color: #<?php echo get_background_color()?>; |
| 160 | | <?php if ( get_background_image() ) { ?> |
| 161 | | background: url(<?php echo get_theme_mod('background_image_thumb', ''); ?>); |
| 162 | | background-repeat: <?php echo get_theme_mod('background_repeat', 'no-repeat'); ?>; |
| 163 | | background-position: top <?php echo get_theme_mod('background_position', 'left'); ?>; |
| 164 | | background-attachment: <?php echo get_theme_mod('background_position', 'fixed'); ?>; |
| 165 | | <?php } ?> |
| 166 | | } |
| 167 | | </style> |
| 168 | | <div id="custom-background-image"> |
| 169 | | <?php if ( get_background_image() ) { ?> |
| 170 | | <img class="custom-background-image" src="<?php echo get_theme_mod('background_image_thumb', ''); ?>" style="visibility:hidden;" /><br /> |
| 171 | | <img class="custom-background-image" src="<?php echo get_theme_mod('background_image_thumb', ''); ?>" style="visibility:hidden;" /> |
| 172 | | <?php } ?> |
| 173 | | <br class="clear" /> |
| 174 | | </div> |
| 175 | | <?php } ?> |
| 176 | | </td> |
| 177 | | </tr> |
| 178 | | <?php if ( get_background_image() ) : ?> |
| 179 | | <tr valign="top"> |
| 180 | | <th scope="row"><?php _e('Remove Image'); ?></th> |
| 181 | | <td><p><?php _e('This will remove the background image. You will not be able to restore any customizations.') ?></p> |
| 182 | | <form method="post" action=""> |
| 183 | | <?php wp_nonce_field('custom-background'); ?> |
| 184 | | <input type="submit" class="button" name="remove-background" value="<?php esc_attr_e('Remove Background'); ?>" /> |
| 185 | | </form> |
| 186 | | </td> |
| 187 | | </tr> |
| 188 | | <?php endif; ?> |
| | 154 | <tr valign="top"> |
| | 155 | <th scope="row"><?php _e( 'Current Image' ); ?></th> |
| | 156 | <td> |
| | 157 | <style type="text/css"> |
| | 158 | #custom-background-image { |
| | 159 | background-color: #<?php echo get_background_color()?>; |
| | 160 | <?php if ( get_background_image() ) { ?> |
| | 161 | background: url(<?php echo get_theme_mod( 'background_image_thumb', '' ); ?>); |
| | 162 | background-repeat: <?php echo get_theme_mod( 'background_repeat', 'no-repeat' ); ?>; |
| | 163 | background-position: top <?php echo get_theme_mod( 'background_position', 'left' ); ?>; |
| | 164 | background-attachment: <?php echo get_theme_mod( 'background_position', 'fixed' ); ?>; |
| | 165 | <?php } ?> |
| | 166 | } |
| | 167 | </style> |
| | 168 | <div id="custom-background-image"> |
| | 169 | <?php if ( get_background_image() ) { ?> |
| | 170 | <img class="custom-background-image" src="<?php echo get_theme_mod( 'background_image_thumb', '' ); ?>" style="visibility:hidden;" /><br /> |
| | 171 | <img class="custom-background-image" src="<?php echo get_theme_mod( 'background_image_thumb', '' ); ?>" style="visibility:hidden;" /> |
| | 172 | <?php } ?> |
| | 173 | <br class="clear" /> |
| | 174 | </div> |
| | 175 | <?php } ?> |
| | 176 | </td> |
| | 177 | </tr> |
| 190 | | <?php if ( defined( 'BACKGROUND_IMAGE' ) ) : // Show only if a default background image exists ?> |
| 191 | | <tr valign="top"> |
| 192 | | <th scope="row"><?php _e('Restore Original Image'); ?></th> |
| 193 | | <td><p><?php _e('This will restore the original background image. You will not be able to restore any customizations.') ?></p> |
| 194 | | <form method="post" action=""> |
| 195 | | <?php wp_nonce_field('custom-background'); ?> |
| 196 | | <input type="submit" class="button" name="reset-background" value="<?php esc_attr_e('Restore Original Image'); ?>" /> |
| 197 | | </form> |
| 198 | | </td> |
| 199 | | </tr> |
| 200 | | </form> |
| 201 | | <?php endif; ?> |
| 202 | | <tr valign="top"> |
| 203 | | <th scope="row"><?php _e('Upload Image'); ?></th> |
| 204 | | <td><form enctype="multipart/form-data" id="uploadForm" method="POST" action=""> |
| 205 | | <label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" /> |
| 206 | | <input type="hidden" name="action" value="save" /> |
| 207 | | <?php wp_nonce_field('custom-background') ?> |
| 208 | | <p class="submit"> |
| 209 | | <input type="submit" value="<?php esc_attr_e('Upload'); ?>" /> |
| 210 | | </p> |
| 211 | | </form> |
| 212 | | </td> |
| | 179 | <?php if ( get_background_image() ) : ?> |
| | 180 | <tr valign="top"> |
| | 181 | <th scope="row"><?php _e( 'Remove Image' ); ?></th> |
| | 182 | <td> |
| | 183 | <p><?php _e( 'This will remove the background image. You will not be able to restore any customizations.' ) ?></p> |
| | 184 | <form method="post" action=""> |
| | 185 | <?php wp_nonce_field( 'custom-background' ); ?> |
| | 186 | <input type="submit" class="button" name="remove-background" value="<?php esc_attr_e( 'Remove Background' ); ?>" /> |
| | 187 | </form> |
| | 188 | </td> |
| | 189 | </tr> |
| | 190 | <?php endif; ?> |
| | 191 | |
| | 192 | <?php if ( defined( 'BACKGROUND_IMAGE' ) ) : // Show only if a default background image exists ?> |
| | 193 | <tr valign="top"> |
| | 194 | <th scope="row"><?php _e( 'Restore Original Image' ); ?></th> |
| | 195 | <td> |
| | 196 | <p><?php _e( 'This will restore the original background image. You will not be able to restore any customizations.' ) ?></p> |
| | 197 | <form method="post" action=""> |
| | 198 | <?php wp_nonce_field( 'custom-background'); ?> |
| | 199 | <input type="submit" class="button" name="reset-background" value="<?php esc_attr_e( 'Restore Original Image' ); ?>" /> |
| | 200 | </form> |
| | 201 | </td> |
| | 202 | </tr> |
| | 203 | <?php endif; ?> |
| | 204 | |
| | 205 | <tr valign="top"> |
| | 206 | <th scope="row"><?php _e( 'Upload Image' ); ?></th> |
| | 207 | <td> |
| | 208 | <form enctype="multipart/form-data" id="uploadForm" method="post" action=""> |
| | 209 | <p> |
| | 210 | <label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br/> |
| | 211 | <input type="file" id="upload" name="import" /> |
| | 212 | <input type="hidden" name="action" value="save" /> |
| | 213 | <?php wp_nonce_field( 'custom-background' ) ?> |
| | 214 | <input type="submit" class="button" value="<?php esc_attr_e( 'Upload' ); ?>" /> |
| | 215 | </p> |
| | 216 | </form> |
| | 217 | </td> |
| 220 | | <tr valign="top"> |
| 221 | | <th scope="row"><?php _e( 'Background Color' ); ?></th> |
| 222 | | <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend> |
| 223 | | <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()) ?>" /> |
| 224 | | <input type="button" class="button" value="<?php esc_attr_e('Select a Color'); ?>" id="pickcolor" /> |
| | 225 | <tr valign="top"> |
| | 226 | <th scope="row"><?php _e( 'Background Color' ); ?></th> |
| | 227 | <td> |
| | 228 | <fieldset> |
| | 229 | <legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend> |
| | 230 | <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr( get_background_color() ) ?>" /> |
| | 231 | <input type="button" class="button" value="<?php esc_attr_e( 'Select a Color' ); ?>" id="pickcolor" /> |
| 230 | | <tr valign="top"> |
| 231 | | <th scope="row"><?php _e( 'Background Position' ); ?></th> |
| 232 | | <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend> |
| 233 | | <label> |
| 234 | | <input name="background-position" type="radio" value="left" <?php checked('left', get_theme_mod('background_position', 'left')); ?> /> |
| 235 | | <?php _e('Left') ?> |
| 236 | | </label> |
| 237 | | <label> |
| 238 | | <input name="background-position" type="radio" value="center" <?php checked('center', get_theme_mod('background_position', 'left')); ?> /> |
| 239 | | <?php _e('Center') ?> |
| 240 | | </label> |
| 241 | | <label> |
| 242 | | <input name="background-position" type="radio" value="right" <?php checked('right', get_theme_mod('background_position', 'left')); ?> /> |
| 243 | | <?php _e('Right') ?> |
| 244 | | </label> |
| 245 | | </fieldset></td> |
| 246 | | </tr> |
| | 238 | <tr valign="top"> |
| | 239 | <th scope="row"><?php _e( 'Background Position' ); ?></th> |
| | 240 | <td> |
| | 241 | <fieldset> |
| | 242 | <legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend> |
| | 243 | <label> |
| | 244 | <input name="background-position" type="radio" value="left" <?php checked( 'left', get_theme_mod( 'background_position', 'left' ) ); ?> /> |
| | 245 | <?php _e( 'Left' ) ?> |
| | 246 | </label> |
| | 247 | <label> |
| | 248 | <input name="background-position" type="radio" value="center" <?php checked( 'center', get_theme_mod( 'background_position', 'left' ) ); ?> /> |
| | 249 | <?php _e( 'Center' ) ?> |
| | 250 | </label> |
| | 251 | <label> |
| | 252 | <input name="background-position" type="radio" value="right" <?php checked( 'right', get_theme_mod( 'background_position', 'left' ) ); ?> /> |
| | 253 | <?php _e( 'Right' ) ?> |
| | 254 | </label> |
| | 255 | </fieldset> |
| | 256 | </td> |
| | 257 | </tr> |
| 248 | | <tr valign="top"> |
| 249 | | <th scope="row"><?php _e( 'Repeat' ); ?></th> |
| 250 | | <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Repeat' ); ?></span></legend> |
| 251 | | <label> |
| 252 | | <select name="background-repeat"> |
| 253 | | <option value="no-repeat" <?php selected('no-repeat', get_theme_mod('background_repeat', 'repeat')); ?> ><?php _e('No repeat'); ?></option> |
| 254 | | <option value="repeat" <?php selected('repeat', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile'); ?></option> |
| 255 | | <option value="repeat-x" <?php selected('repeat-x', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile Horizontally'); ?></option> |
| 256 | | <option value="repeat-y" <?php selected('repeat-y', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile Vertically'); ?></option> |
| 257 | | </select> |
| 258 | | </label> |
| 259 | | </fieldset></td> |
| 260 | | </tr> |
| | 259 | <tr valign="top"> |
| | 260 | <th scope="row"><?php _e( 'Repeat' ); ?></th> |
| | 261 | <td> |
| | 262 | <fieldset> |
| | 263 | <legend class="screen-reader-text"><span><?php _e( 'Repeat' ); ?></span></legend> |
| | 264 | <label> |
| | 265 | <select name="background-repeat"> |
| | 266 | <option value="no-repeat" <?php selected( 'no-repeat', get_theme_mod( 'background_repeat', 'repeat' ) ); ?> ><?php _e( 'No repeat' ); ?></option> |
| | 267 | <option value="repeat" <?php selected( 'repeat', get_theme_mod( 'background_repeat', 'repeat' ) ); ?>><?php _e( 'Tile' ); ?></option> |
| | 268 | <option value="repeat-x" <?php selected( 'repeat-x', get_theme_mod( 'background_repeat', 'repeat' ) ); ?>><?php _e( 'Tile Horizontally' ); ?></option> |
| | 269 | <option value="repeat-y" <?php selected( 'repeat-y', get_theme_mod( 'background_repeat', 'repeat' ) ); ?>><?php _e( 'Tile Vertically' ); ?></option> |
| | 270 | </select> |
| | 271 | </label> |
| | 272 | </fieldset> |
| | 273 | </td> |
| | 274 | </tr> |
| 262 | | <tr valign="top"> |
| 263 | | <th scope="row"><?php _e( 'Attachment' ); ?></th> |
| 264 | | <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Attachment' ); ?></span></legend> |
| 265 | | <label> |
| 266 | | <input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', 'fixed')); ?> /> |
| 267 | | <?php _e('Scroll') ?> |
| 268 | | </label> |
| 269 | | <label> |
| 270 | | <input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', 'fixed')); ?> /> |
| 271 | | <?php _e('Fixed') ?> |
| 272 | | </label> |
| 273 | | </fieldset></td> |
| 274 | | </tr> |
| 275 | | |
| | 276 | <tr valign="top"> |
| | 277 | <th scope="row"><?php _e( 'Attachment' ); ?></th> |
| | 278 | <td> |
| | 279 | <fieldset> |
| | 280 | <legend class="screen-reader-text"><span><?php _e( 'Attachment' ); ?></span></legend> |
| | 281 | <label> |
| | 282 | <input name="background-attachment" type="radio" value="scroll" <?php checked( 'scroll', get_theme_mod( 'background_attachment', 'fixed' ) ); ?> /> |
| | 283 | <?php _e( 'Scroll' ) ?> |
| | 284 | </label> |
| | 285 | <label> |
| | 286 | <input name="background-attachment" type="radio" value="fixed" <?php checked( 'fixed', get_theme_mod( 'background_attachment', 'fixed' ) ); ?> /> |
| | 287 | <?php _e( 'Fixed' ) ?> |
| | 288 | </label> |
| | 289 | </fieldset> |
| | 290 | </td> |
| | 291 | </tr> |