Genesis Favicon Uploader - Version 0.1.1

Version Description

  • Fixed: An issue with the way the the file type was detected. In some cases depending on hosted server the string would be broken before reaching the file extension.
  • Added: Additonal error messages.
Download this release

Release Info

Developer cochran
Plugin Icon wp plugin Genesis Favicon Uploader
Version 0.1.1
Comparing to
See all releases

Version 0.1.1

favicons/README.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ The favicons folder will hold all favicon.ico files
2
+ uploaded through the plugin. In a MultiSite environment the
3
+ blog id will append to the file name. "favicon-{blog_ID}.ico"
4
+
genesis-favicon-uploader.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Genesis Favicon uploader
4
+ Plugin URI: http://genesistutorials.com/plug-ins/genesis-post-teasers/
5
+ Description: Upload your own favicon!
6
+ Version: .1.1b
7
+ Author: Christopher Cochran
8
+ Author URI: http://christophercochran.me
9
+ */
10
+
11
+ register_activation_hook(__FILE__, 'favicon_up_activation_check');
12
+ function favicon_up_activation_check() {
13
+
14
+ $theme_info = get_theme_data(TEMPLATEPATH.'/style.css');
15
+
16
+ // need to find a way to check active themes is MultiSites - This does not work in new 3.1 network panel.
17
+ if( basename(TEMPLATEPATH) != 'genesis' ) {
18
+ deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
19
+ wp_die('Sorry, you can\'t activate unless you have installed <a href="http://www.studiopress.com/themes/genesis">Genesis</a>');
20
+ }
21
+
22
+ }
23
+
24
+ add_action('admin_menu', 'favicon_up_settings_init', 15);
25
+ function favicon_up_settings_init() {
26
+ add_submenu_page('genesis', __('Upload Favicon','favicon_up'), __('Upload Favicon','favicon_up'), 'manage_options', 'upload-favicon', 'favicon_upload_settings_admin');
27
+ }
28
+
29
+ add_action('wp', 'favicon_up_genesis_option_logic');
30
+ function favicon_up_genesis_option_logic() {
31
+ global $blog_id;
32
+
33
+ if ( !is_multisite() ) {
34
+ $favicon_name = 'favicon.ico';
35
+ } else {
36
+ $favicon_name = 'favicon-'.$blog_id.'.ico';
37
+ }
38
+
39
+ $favicon_DIR = WP_PLUGIN_DIR.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)) . 'favicons/';
40
+ $favicon_check = $favicon_DIR . $favicon_name;
41
+
42
+ $check = $favicon_check ;
43
+
44
+ if ( file_exists($check) ) {
45
+ add_filter('genesis_favicon_url', 'favicon_up_favicon_url');
46
+ }
47
+ }
48
+
49
+ function favicon_up_favicon_url() {
50
+ global $blog_id;
51
+ $favicon_path = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)) . 'favicons/';
52
+
53
+ if ( !is_multisite() ) {
54
+ $favicon = $favicon_path .'favicon.ico';
55
+ } else {
56
+ $favicon = $favicon_path .'favicon-'.$blog_id.'.ico';
57
+ }
58
+
59
+ return $favicon;
60
+ }
61
+
62
+
63
+ function favicon_upload_settings_admin() {
64
+ global $blog_id;
65
+
66
+ $favicon_DIR = WP_PLUGIN_DIR.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)) . 'favicons/';
67
+ $favicon_check = $favicon_DIR . basename( $_FILES['uploadedfile']['name']);
68
+ $favicon_path = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)) . 'favicons/';
69
+
70
+ $extensions = array("ico");
71
+
72
+ $check = $favicon_check;
73
+
74
+ if ( !is_multisite() ) {
75
+ $favicon = $favicon_path . 'favicon.ico';
76
+ $favicon_file = $favicon_DIR . 'favicon.ico';
77
+ } else {
78
+ $favicon = $favicon_path . 'favicon-'.$blog_id.'.ico';
79
+ $favicon_file = $favicon_DIR . 'favicon-'.$blog_id.'.ico';
80
+ }
81
+
82
+ $maybe_ico = pathinfo( $check, PATHINFO_EXTENSION );
83
+ ?>
84
+
85
+ <div class="wrap">
86
+
87
+ <?php screen_icon('tools'); ?>
88
+ <h2><?php _e('Genesis - Favicon Uploader', 'favicon_up'); ?></h2>
89
+
90
+ <?php
91
+
92
+ if ( is_writable( $favicon_DIR ) == false ) {
93
+ echo '<p style="color:red;"><strong>Sorry, "<u>' . $favicon_DIR . '</u>" is not writeable on the server.</strong></p>';
94
+ }
95
+
96
+ if( move_uploaded_file( $_FILES['uploadedfile']['tmp_name'], $check ) ) {
97
+
98
+ if ( $maybe_ico != 'ico' ) {
99
+ echo '<p style="color:red;"><strong>Sorry, you tried to upload a ".' . $maybe_ico . '" file. <br />Currently at this time only file type supported is ".ico."</strong></p>';
100
+ unlink ($check);
101
+ } elseif ( $maybe_ico == 'ico' && is_multisite() ) {
102
+ rename($favicon_DIR .'favicon.ico', $favicon_DIR .'favicon-'.$blog_id.'.ico');
103
+ echo '<p style="color:green;"><img src="'.$favicon.'" /> <-- Awesome Check it out! It worked. I hope so anyways. You should see your uploaded favicon beside this text.</p>';
104
+ } else {
105
+ echo '<p style="color:green;"><img src="'.$favicon.'" /> <-- Awesome Check it out! It worked. I hope so anyways. You should see your uploaded favicon beside this text.</p>';
106
+ }
107
+
108
+ } elseif ( file_exists($favicon_file) ) {
109
+ echo '<p><img src="'.$favicon.'" /> <-- Awesome Check it out! It worked. I hope so anyways. You should see your uploaded favicon beside this text. <br />If you are tired of the current favicon upload another!</p>';
110
+ } else {
111
+ echo '<p>Upload your favicon below. If you only have a .png, .gif, or .jpg check out <a href="http://converticon.com/">http://converticon.com/</a> to convert it to an .ico file.</p>';
112
+ }
113
+ ?>
114
+
115
+ <form enctype="multipart/form-data" method="post" action="<?php echo admin_url('admin.php?page=upload-favicon'); ?>">
116
+ <?php wp_nonce_field('favicon-upload'); ?>
117
+ <input type="hidden" name="favicon-upload" value="1" />
118
+ <label for="uploadedfile"><?php echo sprintf( __('Upload File: <span class="description">(Maximum Size: %s)</span>', 'favicon_up'), ini_get('post_max_size') ); ?></label>
119
+ <input type="file" id="uploadedfile" name="uploadedfile" size="30" />
120
+ <input type="submit" class="button" value="<?php _e('Upload Favicon', 'favicon_up'); ?>" />
121
+ </form>
122
+
123
+ <p class="description">*NOTE Make sure your file name is favicon.ico before uploading.</p>
124
+
125
+ </div>
126
+
127
+ <?php
128
+ }
readme.txt ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Genesis Favicon Uploader ===
2
+ Contributors: cochran
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TLKVZFHV64ZS4&lc=US&item_name=Christopher%20Cochran&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
+ Tags: Favicon, Favicon uploader, genesis
5
+ Requires at least: 3.0
6
+ Tested up to: 3.0.3
7
+ Stable tag: trunk
8
+
9
+ Adds a theme option page to genesis to allow the user to upload a favicon without ftping into the themes folders. - The Genesis Theme Framework is Required.
10
+
11
+ == Description ==
12
+ Simply upload your "favicon.ico" file for any Genesis site from an options page. No need to FTP. Great for MultiSite networks. - The Genesis Theme Framework is Required.
13
+ It will not make you a cup of joe. Sorry =(.
14
+
15
+ == Installation ==
16
+ 1. Upload the entire 'genesis-favicon-uploader' folder to the '/wp-content/plugins/' directory
17
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
18
+ 3. Navigate to the 'Favicon Uploader' tab under the genesis menu.
19
+ 4. Upload your favicon.ico!
20
+
21
+ == Frequently Asked Questions ==
22
+ = What file type does this support? =
23
+ Currently only supports .ico files but already working on an update that will accept .png, .gif and .jpeg
24
+
25
+ == Screenshots ==
26
+
27
+ 1. Upload Page
28
+
29
+
30
+ == Changelog ==
31
+ = 0.1 =
32
+ * Initial Beta Release
33
+
34
+ = 0.1.0.1 =
35
+ * Fixed: File check message shows you uploaded a favicon on activation before uploading.
36
+
37
+ = 0.1.1 =
38
+ * Fixed: An issue with the way the the file type was detected. In some cases depending on hosted server the string would be broken before reaching the file extension.
39
+ * Added: Additonal error messages.
40
+
screenshot-1.jpg ADDED
Binary file