Changeset 1707097
- Timestamp:
- 08/02/2017 04:27:38 PM (8 years ago)
- Location:
- sloth-logo-customizer
- Files:
-
- 4 added
- 10 edited
- 2 copied
-
tags/1.0 (copied) (copied from sloth-logo-customizer/trunk)
-
tags/1.1 (copied) (copied from sloth-logo-customizer/trunk)
-
tags/1.1/languages/sloth-logo-customizer-fa_IR.mo (modified) (previous)
-
tags/1.1/languages/sloth-logo-customizer-fa_IR.po (modified) (2 diffs)
-
tags/1.1/network-setting.php (added)
-
tags/1.1/readme.txt (modified) (3 diffs)
-
tags/1.1/setting.php (modified) (4 diffs)
-
tags/1.1/sloth-logo-customizer.php (modified) (3 diffs)
-
tags/1.1/sloth-options.php (added)
-
trunk/languages/sloth-logo-customizer-fa_IR.mo (modified) (previous)
-
trunk/languages/sloth-logo-customizer-fa_IR.po (modified) (2 diffs)
-
trunk/network-setting.php (added)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/setting.php (modified) (4 diffs)
-
trunk/sloth-logo-customizer.php (modified) (3 diffs)
-
trunk/sloth-options.php (added)
Legend:
- Unmodified
- Added
- Removed
-
sloth-logo-customizer/tags/1.1/languages/sloth-logo-customizer-fa_IR.po
r1688279 r1707097 36 36 msgstr "یک تصویر را انتخاب کنید" 37 37 38 #: setting.php:32 39 msgid "Both url and title fields should have value" 40 msgstr "هردو فیلد عنوان و نشانی باید مقدار داشته باشند" 41 38 42 #: my-logo.php:41 39 43 msgid "Login Logo" … … 63 67 msgid "Empty for wordpress default values" 64 68 msgstr "برای مقادیر پیش فرض وردپرس خالی بگذارید" 69 70 #: network-setting.php:83 71 msgid "Allow blogs to override settings" 72 msgstr "به وبلاگ ها اجازه تغییر تنظیمات داده شود." -
sloth-logo-customizer/tags/1.1/readme.txt
r1688287 r1707097 5 5 Requires at least: 4.2.4 6 6 Tested up to: 4.8 7 Stable tag: trunk7 Stable tag: 1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support stri gnand url on the blog info widget.11 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support string and url on the blog info widget. 12 12 13 13 == Description == 14 14 15 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support stri gnand url on the blog info widget.15 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support string and url on the blog info widget. 16 16 17 17 Major features of Blog Post filter include: 18 18 19 * Support Multisite: It supports single or multisite installation of wordpress. In multisite installation site admin could allow blogs to change logo and signature or not. 19 20 * Simplicity: In contrast with similar plugin this plugin is very simple and easy to use. 20 21 * Efficiency: The plugin has a minimum processing overhead on the site. … … 25 26 1. Upload `sloth-logo-customizer` directory to the `/wp-content/plugins/` directory 26 27 2. Activate the plugin through the 'Plugins' menu in WordPress 27 3. Go to the `login logo` page in the Appearance section and select the new logo and support information.28 3. Go to the `login logo` page in the Appearance section in blog setting page or `login logo` page in `Setting` section in network admin page and select the new logo and support information. 28 29 4. You're done! 29 30 … … 38 39 1. Preview of the Blog Post Filter's admin page. 39 40 2. Persian taranslation of the Blog Post Filter's admin page. 41 3. Preview of the Blog Post Filter's network admin page. 42 4. Persian taranslation of the Blog Post Filter's network admin page. 40 43 41 44 == Changelog == 42 45 43 = 1.0.0 = 46 = 1.1 = 47 * Multisite features are added. 48 49 = 1.0 = 44 50 * Fist version. 45 51 46 52 == Upgrade Notice == 47 53 48 = 1.0.0 = 54 = 1.1 = 55 Whole source code is revised to add WordPress multisite support to the plugin. 56 57 = 1.1 = 49 58 This is the initial version. -
sloth-logo-customizer/tags/1.1/setting.php
r1688279 r1707097 3 3 jQuery( document ).ready( function( $ ) { 4 4 jQuery('#clear-image-button').on('click', function( event ){ 5 $("#image-preview").attr('src', '<?php echo $ defaultIconURL;?>');5 $("#image-preview").attr('src', '<?php echo $this->options->getDefaultLogoUrl();?>'); 6 6 $("#image-attachemt-id").val(0); 7 7 }); … … 24 24 25 25 fileFrame.open(); 26 }); 27 28 jQuery('div#poweredBy button').on('click', function(){ 29 var title = "" == $("input#title").val(); 30 var url = "" == $("input#url").val(); 31 if((title && !url) || (!title && url)){ 32 alert("<?php _e('Both url and title fields should have value','sloth-logo-customizer');?>"); 33 return false; 34 } 26 35 }); 27 36 }); … … 62 71 63 72 <label for="upload-image-button"><?php _e('Logo');?></label> 64 <img id="image-preview" src="<?php echo $ savedAttachmentURL;?>" class="dashicons dashicons-wordpress" /> <br />73 <img id="image-preview" src="<?php echo $this->options->getLogoUrl();?>" class="dashicons dashicons-wordpress" /> <br /> 65 74 <input id="upload-image-button" type="button" class="button" value="<?php _e('Update'); ?>" /> 66 75 <input id="clear-image-button" type="button" class="button" value="<?php _e('Clear'); ?>" /> 67 <input type="hidden" name="imageAttachmentId" id="image-attachemt-id" value="<?php echo $ savedAttachmentPostId;?>" />76 <input type="hidden" name="imageAttachmentId" id="image-attachemt-id" value="<?php echo $this->options->getBlogLogoPostId();?>" /> 68 77 69 78 </fieldset> … … 73 82 74 83 <label for="url"><?php _e('Support URL', 'sloth-logo-customizer');?></label> 75 <input id="url" type="text" name="url" value="<?php echo $this-> signatureUrl;?>" placeholder="http://www.wordpress.org" dir="ltr">84 <input id="url" type="text" name="url" value="<?php echo $this->options->getBlogSignatureUrl();?>" placeholder="<?php echo $this->options->getSiteSignatureUrlPlaceholder();?>" dir="ltr"> 76 85 <span><?php _e('Empty for wordpress default values','sloth-logo-customizer');?></span><br /> 77 86 78 87 <label for="title"><?php _e('Support Title', 'sloth-logo-customizer');?></label> 79 <input id="title" type="text" name="title" value="<?php echo $this-> signatureTitle;?>" placeholder="<?php _e('Wordpress.org', 'sloth-logo-customizer');?>">88 <input id="title" type="text" name="title" value="<?php echo $this->options->getBlogSignatureTitle();?>" placeholder="<?php echo $this->options->getSiteSignatureTitlePlaceholder();?>"> 80 89 <span><?php _e('Empty for wordpress default values','sloth-logo-customizer');?></span><br /> 81 90 -
sloth-logo-customizer/tags/1.1/sloth-logo-customizer.php
r1688279 r1707097 11 11 */ 12 12 13 //error_reporting(E_ALL | E_STRICT); 14 //ini_set("display_errors", 1); 13 error_reporting(E_ALL | E_STRICT); 14 ini_set("display_errors", 1); 15 16 include_once('sloth-options.php'); 17 15 18 class SlothLogoCustomizer{ 16 public $signatureUrl; 17 public $signatureTitle; 19 private $options; 20 21 // public $allowOverride; 22 // public $siteSignatureUrl; 23 // public $siteSignatureTitle; 24 // public $signatureUrl; 25 // public $signatureTitle; 18 26 19 27 public function __construct(){ 20 add_option("SlothLogoCustomizer_PoweredByURL", "", "", 'no'); 21 add_option("SlothLogoCustomizer_PoweredByTitle", " ", "", 'no'); 22 add_option("SlothLogoCustomizer_imageAttachmentId", "0", "", 'no'); 23 24 add_action('admin_menu', array(&$this, 'adminPage')); 25 add_action('login_head', array(&$this, 'changeLogo')); 26 add_action('plugins_loaded', array(&$this,'loadTextDomain')); 27 28 $this->signatureUrl = get_option('SlothLogoCustomizer_PoweredByURL'); 29 $this->signatureTitle = get_option('SlothLogoCustomizer_PoweredByTitle'); 30 31 if(trim($this->signatureUrl) != "" && trim($this->signatureTitle) != "") 32 add_filter('widget_meta_poweredby',array(&$this, 'changeSignature')); 28 $this->options = new SlothOptions(); 29 30 add_action('admin_menu', array(&$this, 'blogAdminPage')); 31 add_action('network_admin_menu', array($this, 'networkAdminPage')); 32 add_action('login_head', array(&$this, 'changeLogo')); 33 add_action('plugins_loaded', array(&$this,'loadTextDomain')); 34 35 if($this->options->isSignatureChanged()) 36 add_filter('widget_meta_poweredby',array(&$this, 'changeSignature')); 33 37 } 34 38 35 public function adminPage(){ 36 add_theme_page(__('Login Logo', 'sloth-logo-customizer'), __('Login Logo', 'sloth-logo-customizer'), 'edit_theme_options', 'slothLogo', array(&$this, 'setting') ); 39 public function blogAdminPage(){ 40 if(is_multisite() && !$this->options->getAllowOverride()) 41 return; 42 43 add_theme_page( 44 __('Login Logo', 'sloth-logo-customizer'), 45 __('Login Logo', 'sloth-logo-customizer'), 46 'edit_theme_options', 47 'slothLogo', 48 array(&$this, 'setting') 49 ); 50 } 51 52 public function networkAdminPage(){ 53 add_submenu_page( 54 'settings.php', 55 __('Login Logo', 'sloth-logo-customizer'), 56 __('Login Logo', 'sloth-logo-customizer'), 57 'edit_theme_options', 58 'sloth_logo_setting', 59 array(&$this, 'networkSetting') 60 ); 61 } 62 63 public function networkSetting(){ 64 if(isset($_POST['imageAttachmentId']) && $_POST['imageAttachmentId']!=''){ 65 $this->options->setSiteLogoUrl($_POST['imageAttachmentId']); 66 // update_site_option('SlothLogoCustomizer_SiteImageAttachmentId', $_POST['imageAttachmentId']); 67 // $url = wp_get_attachment_url($_POST['imageAttachmentId']); 68 // update_site_option('SlothLogoCustomizer_SiteImageAttachmentURL', $url); 69 } 70 71 if(isset($_POST['poweredBy']) && $_POST['poweredBy']=='yes'){ 72 $override = (isset($_POST['allowOverride']) && $_POST['allowOverride']=='true')? true: false; 73 $this->options->setAllowOverride($override); 74 $this->options->setSiteSignatureTitle($_POST['title']); 75 $this->options->setSiteSignatureUrl($_POST['url']); 76 // update_site_option('SlothLogoCustomizer_AllowOverride', $override); 77 // update_site_option('SlothLogoCustomizer_SitePoweredByURL', $_POST['url']); 78 // update_site_option('SlothLogoCustomizer_SitePoweredByTitle', $_POST['title']); 79 // $this->allowOverride = get_site_option('SlothLogoCustomizer_AllowOverride'); 80 // $this->siteSignatureUrl = get_site_option('SlothLogoCustomizer_SitePoweredByURL'); 81 // $this->siteSignatureTitle = get_site_option('SlothLogoCustomizer_SitePoweredByTitle'); 82 //print_r($_POST); 83 //die($this->allowOverride); 84 } 85 86 // $defaultIconURL = plugin_dir_url( __FILE__ ) . 'wordpress-logo.png'; 87 // $savedAttachmentPostId = get_site_option( 'SlothLogoCustomizer_SiteImageAttachmentId', 0 ); 88 // if($savedAttachmentPostId!=0) 89 // $savedAttachmentURL = wp_get_attachment_url( $savedAttachmentPostId ); 90 // else 91 // $savedAttachmentURL = $defaultIconURL; 92 93 wp_enqueue_media(); 94 95 require('network-setting.php'); 37 96 } 38 97 … … 40 99 41 100 if(isset($_POST['imageAttachmentId']) && $_POST['imageAttachmentId']!=''){ 42 update_option('SlothLogoCustomizer_imageAttachmentId', $_POST['imageAttachmentId']); 101 $this->options->setBlogLogo($_POST['imageAttachmentId']); 102 //echo $_POST['imageAttachmentId']; 103 // update_option('SlothLogoCustomizer_imageAttachmentId', $_POST['imageAttachmentId']); 43 104 } 44 105 45 106 if(isset($_POST['poweredBy']) && $_POST['poweredBy']=='yes'){ 46 update_option('SlothLogoCustomizer_PoweredByURL', $_POST['url']); 47 update_option('SlothLogoCustomizer_PoweredByTitle', $_POST['title']); 48 $this->signatureUrl = get_option('SlothLogoCustomizer_PoweredByURL'); 49 $this->signatureTitle = get_option('SlothLogoCustomizer_PoweredByTitle'); 107 $this->options->setBlogSignatureTitle($_POST['title']); 108 $this->options->setBlogSignatureUrl($_POST['url']); 109 // update_option('SlothLogoCustomizer_PoweredByURL', $_POST['url']); 110 // update_option('SlothLogoCustomizer_PoweredByTitle', $_POST['title']); 111 // $this->signatureUrl = get_option('SlothLogoCustomizer_PoweredByURL'); 112 // $this->signatureTitle = get_option('SlothLogoCustomizer_PoweredByTitle'); 50 113 } 51 114 52 $defaultIconURL = plugin_dir_url( __FILE__ ) . 'wordpress-logo.png'; 53 $savedAttachmentPostId = get_option( 'SlothLogoCustomizer_imageAttachmentId', 0 ); 54 if($savedAttachmentPostId!=0) 55 $savedAttachmentURL = wp_get_attachment_url( $savedAttachmentPostId ); 56 else 57 $savedAttachmentURL = $defaultIconURL; 115 // $defaultIconURL = plugin_dir_url( __FILE__ ) . 'wordpress-logo.png'; 116 // $savedAttachmentPostId = get_option( 'SlothLogoCustomizer_imageAttachmentId', 0 ); 117 // $networkIconPostId = get_site_option('SlothLogoCustomizer_SiteImageAttachmentId', 0); 118 // if($savedAttachmentPostId!=0) 119 // $savedAttachmentURL = wp_get_attachment_url( $savedAttachmentPostId ); 120 // else if($networkIconPostId != 0) 121 // $savedAttachmentURL = get_site_option('SlothLogoCustomizer_SiteImageAttachmentURL', 0); 122 // else 123 // $savedAttachmentURL = $defaultIconURL; 58 124 59 125 wp_enqueue_media(); … … 63 129 64 130 public function changeLogo(){ 65 $savedAttachmentPostId = get_option( 'SlothLogoCustomizer_imageAttachmentId', 0 ); 66 $savedAttachmentURL = wp_get_attachment_url( $savedAttachmentPostId ); 67 if($savedAttachmentPostId != 0){ 131 if($this->options->isLogoChanged()){ 68 132 echo '<style type="text/css">'; 69 echo "h1 a {background-image: url({$ savedAttachmentURL}) !important;}";133 echo "h1 a {background-image: url({$this->options->getLogoUrl()}) !important;}"; 70 134 echo '</style>'; 71 } 135 } 136 137 // $savedAttachmentPostId = get_option( 'SlothLogoCustomizer_imageAttachmentId', 0 ); 138 // $savedAttachmentURL = wp_get_attachment_url( $savedAttachmentPostId ); 139 // if($savedAttachmentPostId != 0){ 140 // echo '<style type="text/css">'; 141 // echo "h1 a {background-image: url({$savedAttachmentURL}) !important;}"; 142 // echo '</style>'; 143 // } 72 144 } 73 145 74 146 public function changeSignature(){ 147 // $url = ($this->options->allowOverride)? $this->signatureUrl: $this->siteSignatureUrl; 148 // $title = ($this->allowOverride)? $this->signatureTitle: $this->siteSignatureTitle; 75 149 //$url = get_option('SlothLogoCustomizer_PoweredByURL'); 76 150 //$title = get_option('SlothLogoCustomizer_PoweredByTitle'); 77 echo "<li><a href='{$this->signatureUrl}'>{$this->signatureTitle}</a></li>";151 echo "<li><a href='{$this->options->getSignatureUrl()}'>{$this->options->getSignatureTitle()}</a></li>"; 78 152 } 79 153 -
sloth-logo-customizer/trunk/languages/sloth-logo-customizer-fa_IR.po
r1688279 r1707097 36 36 msgstr "یک تصویر را انتخاب کنید" 37 37 38 #: setting.php:32 39 msgid "Both url and title fields should have value" 40 msgstr "هردو فیلد عنوان و نشانی باید مقدار داشته باشند" 41 38 42 #: my-logo.php:41 39 43 msgid "Login Logo" … … 63 67 msgid "Empty for wordpress default values" 64 68 msgstr "برای مقادیر پیش فرض وردپرس خالی بگذارید" 69 70 #: network-setting.php:83 71 msgid "Allow blogs to override settings" 72 msgstr "به وبلاگ ها اجازه تغییر تنظیمات داده شود." -
sloth-logo-customizer/trunk/readme.txt
r1688287 r1707097 5 5 Requires at least: 4.2.4 6 6 Tested up to: 4.8 7 Stable tag: trunk7 Stable tag: 1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support stri gnand url on the blog info widget.11 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support string and url on the blog info widget. 12 12 13 13 == Description == 14 14 15 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support stri gnand url on the blog info widget.15 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support string and url on the blog info widget. 16 16 17 17 Major features of Blog Post filter include: 18 18 19 * Support Multisite: It supports single or multisite installation of wordpress. In multisite installation site admin could allow blogs to change logo and signature or not. 19 20 * Simplicity: In contrast with similar plugin this plugin is very simple and easy to use. 20 21 * Efficiency: The plugin has a minimum processing overhead on the site. … … 25 26 1. Upload `sloth-logo-customizer` directory to the `/wp-content/plugins/` directory 26 27 2. Activate the plugin through the 'Plugins' menu in WordPress 27 3. Go to the `login logo` page in the Appearance section and select the new logo and support information.28 3. Go to the `login logo` page in the Appearance section in blog setting page or `login logo` page in `Setting` section in network admin page and select the new logo and support information. 28 29 4. You're done! 29 30 … … 38 39 1. Preview of the Blog Post Filter's admin page. 39 40 2. Persian taranslation of the Blog Post Filter's admin page. 41 3. Preview of the Blog Post Filter's network admin page. 42 4. Persian taranslation of the Blog Post Filter's network admin page. 40 43 41 44 == Changelog == 42 45 43 = 1.0.0 = 46 = 1.1 = 47 * Multisite features are added. 48 49 = 1.0 = 44 50 * Fist version. 45 51 46 52 == Upgrade Notice == 47 53 48 = 1.0.0 = 54 = 1.1 = 55 Whole source code is revised to add WordPress multisite support to the plugin. 56 57 = 1.1 = 49 58 This is the initial version. -
sloth-logo-customizer/trunk/setting.php
r1688279 r1707097 3 3 jQuery( document ).ready( function( $ ) { 4 4 jQuery('#clear-image-button').on('click', function( event ){ 5 $("#image-preview").attr('src', '<?php echo $ defaultIconURL;?>');5 $("#image-preview").attr('src', '<?php echo $this->options->getDefaultLogoUrl();?>'); 6 6 $("#image-attachemt-id").val(0); 7 7 }); … … 24 24 25 25 fileFrame.open(); 26 }); 27 28 jQuery('div#poweredBy button').on('click', function(){ 29 var title = "" == $("input#title").val(); 30 var url = "" == $("input#url").val(); 31 if((title && !url) || (!title && url)){ 32 alert("<?php _e('Both url and title fields should have value','sloth-logo-customizer');?>"); 33 return false; 34 } 26 35 }); 27 36 }); … … 62 71 63 72 <label for="upload-image-button"><?php _e('Logo');?></label> 64 <img id="image-preview" src="<?php echo $ savedAttachmentURL;?>" class="dashicons dashicons-wordpress" /> <br />73 <img id="image-preview" src="<?php echo $this->options->getLogoUrl();?>" class="dashicons dashicons-wordpress" /> <br /> 65 74 <input id="upload-image-button" type="button" class="button" value="<?php _e('Update'); ?>" /> 66 75 <input id="clear-image-button" type="button" class="button" value="<?php _e('Clear'); ?>" /> 67 <input type="hidden" name="imageAttachmentId" id="image-attachemt-id" value="<?php echo $ savedAttachmentPostId;?>" />76 <input type="hidden" name="imageAttachmentId" id="image-attachemt-id" value="<?php echo $this->options->getBlogLogoPostId();?>" /> 68 77 69 78 </fieldset> … … 73 82 74 83 <label for="url"><?php _e('Support URL', 'sloth-logo-customizer');?></label> 75 <input id="url" type="text" name="url" value="<?php echo $this-> signatureUrl;?>" placeholder="http://www.wordpress.org" dir="ltr">84 <input id="url" type="text" name="url" value="<?php echo $this->options->getBlogSignatureUrl();?>" placeholder="<?php echo $this->options->getSiteSignatureUrlPlaceholder();?>" dir="ltr"> 76 85 <span><?php _e('Empty for wordpress default values','sloth-logo-customizer');?></span><br /> 77 86 78 87 <label for="title"><?php _e('Support Title', 'sloth-logo-customizer');?></label> 79 <input id="title" type="text" name="title" value="<?php echo $this-> signatureTitle;?>" placeholder="<?php _e('Wordpress.org', 'sloth-logo-customizer');?>">88 <input id="title" type="text" name="title" value="<?php echo $this->options->getBlogSignatureTitle();?>" placeholder="<?php echo $this->options->getSiteSignatureTitlePlaceholder();?>"> 80 89 <span><?php _e('Empty for wordpress default values','sloth-logo-customizer');?></span><br /> 81 90 -
sloth-logo-customizer/trunk/sloth-logo-customizer.php
r1688279 r1707097 11 11 */ 12 12 13 //error_reporting(E_ALL | E_STRICT); 14 //ini_set("display_errors", 1); 13 error_reporting(E_ALL | E_STRICT); 14 ini_set("display_errors", 1); 15 16 include_once('sloth-options.php'); 17 15 18 class SlothLogoCustomizer{ 16 public $signatureUrl; 17 public $signatureTitle; 19 private $options; 20 21 // public $allowOverride; 22 // public $siteSignatureUrl; 23 // public $siteSignatureTitle; 24 // public $signatureUrl; 25 // public $signatureTitle; 18 26 19 27 public function __construct(){ 20 add_option("SlothLogoCustomizer_PoweredByURL", "", "", 'no'); 21 add_option("SlothLogoCustomizer_PoweredByTitle", " ", "", 'no'); 22 add_option("SlothLogoCustomizer_imageAttachmentId", "0", "", 'no'); 23 24 add_action('admin_menu', array(&$this, 'adminPage')); 25 add_action('login_head', array(&$this, 'changeLogo')); 26 add_action('plugins_loaded', array(&$this,'loadTextDomain')); 27 28 $this->signatureUrl = get_option('SlothLogoCustomizer_PoweredByURL'); 29 $this->signatureTitle = get_option('SlothLogoCustomizer_PoweredByTitle'); 30 31 if(trim($this->signatureUrl) != "" && trim($this->signatureTitle) != "") 32 add_filter('widget_meta_poweredby',array(&$this, 'changeSignature')); 28 $this->options = new SlothOptions(); 29 30 add_action('admin_menu', array(&$this, 'blogAdminPage')); 31 add_action('network_admin_menu', array($this, 'networkAdminPage')); 32 add_action('login_head', array(&$this, 'changeLogo')); 33 add_action('plugins_loaded', array(&$this,'loadTextDomain')); 34 35 if($this->options->isSignatureChanged()) 36 add_filter('widget_meta_poweredby',array(&$this, 'changeSignature')); 33 37 } 34 38 35 public function adminPage(){ 36 add_theme_page(__('Login Logo', 'sloth-logo-customizer'), __('Login Logo', 'sloth-logo-customizer'), 'edit_theme_options', 'slothLogo', array(&$this, 'setting') ); 39 public function blogAdminPage(){ 40 if(is_multisite() && !$this->options->getAllowOverride()) 41 return; 42 43 add_theme_page( 44 __('Login Logo', 'sloth-logo-customizer'), 45 __('Login Logo', 'sloth-logo-customizer'), 46 'edit_theme_options', 47 'slothLogo', 48 array(&$this, 'setting') 49 ); 50 } 51 52 public function networkAdminPage(){ 53 add_submenu_page( 54 'settings.php', 55 __('Login Logo', 'sloth-logo-customizer'), 56 __('Login Logo', 'sloth-logo-customizer'), 57 'edit_theme_options', 58 'sloth_logo_setting', 59 array(&$this, 'networkSetting') 60 ); 61 } 62 63 public function networkSetting(){ 64 if(isset($_POST['imageAttachmentId']) && $_POST['imageAttachmentId']!=''){ 65 $this->options->setSiteLogoUrl($_POST['imageAttachmentId']); 66 // update_site_option('SlothLogoCustomizer_SiteImageAttachmentId', $_POST['imageAttachmentId']); 67 // $url = wp_get_attachment_url($_POST['imageAttachmentId']); 68 // update_site_option('SlothLogoCustomizer_SiteImageAttachmentURL', $url); 69 } 70 71 if(isset($_POST['poweredBy']) && $_POST['poweredBy']=='yes'){ 72 $override = (isset($_POST['allowOverride']) && $_POST['allowOverride']=='true')? true: false; 73 $this->options->setAllowOverride($override); 74 $this->options->setSiteSignatureTitle($_POST['title']); 75 $this->options->setSiteSignatureUrl($_POST['url']); 76 // update_site_option('SlothLogoCustomizer_AllowOverride', $override); 77 // update_site_option('SlothLogoCustomizer_SitePoweredByURL', $_POST['url']); 78 // update_site_option('SlothLogoCustomizer_SitePoweredByTitle', $_POST['title']); 79 // $this->allowOverride = get_site_option('SlothLogoCustomizer_AllowOverride'); 80 // $this->siteSignatureUrl = get_site_option('SlothLogoCustomizer_SitePoweredByURL'); 81 // $this->siteSignatureTitle = get_site_option('SlothLogoCustomizer_SitePoweredByTitle'); 82 //print_r($_POST); 83 //die($this->allowOverride); 84 } 85 86 // $defaultIconURL = plugin_dir_url( __FILE__ ) . 'wordpress-logo.png'; 87 // $savedAttachmentPostId = get_site_option( 'SlothLogoCustomizer_SiteImageAttachmentId', 0 ); 88 // if($savedAttachmentPostId!=0) 89 // $savedAttachmentURL = wp_get_attachment_url( $savedAttachmentPostId ); 90 // else 91 // $savedAttachmentURL = $defaultIconURL; 92 93 wp_enqueue_media(); 94 95 require('network-setting.php'); 37 96 } 38 97 … … 40 99 41 100 if(isset($_POST['imageAttachmentId']) && $_POST['imageAttachmentId']!=''){ 42 update_option('SlothLogoCustomizer_imageAttachmentId', $_POST['imageAttachmentId']); 101 $this->options->setBlogLogo($_POST['imageAttachmentId']); 102 //echo $_POST['imageAttachmentId']; 103 // update_option('SlothLogoCustomizer_imageAttachmentId', $_POST['imageAttachmentId']); 43 104 } 44 105 45 106 if(isset($_POST['poweredBy']) && $_POST['poweredBy']=='yes'){ 46 update_option('SlothLogoCustomizer_PoweredByURL', $_POST['url']); 47 update_option('SlothLogoCustomizer_PoweredByTitle', $_POST['title']); 48 $this->signatureUrl = get_option('SlothLogoCustomizer_PoweredByURL'); 49 $this->signatureTitle = get_option('SlothLogoCustomizer_PoweredByTitle'); 107 $this->options->setBlogSignatureTitle($_POST['title']); 108 $this->options->setBlogSignatureUrl($_POST['url']); 109 // update_option('SlothLogoCustomizer_PoweredByURL', $_POST['url']); 110 // update_option('SlothLogoCustomizer_PoweredByTitle', $_POST['title']); 111 // $this->signatureUrl = get_option('SlothLogoCustomizer_PoweredByURL'); 112 // $this->signatureTitle = get_option('SlothLogoCustomizer_PoweredByTitle'); 50 113 } 51 114 52 $defaultIconURL = plugin_dir_url( __FILE__ ) . 'wordpress-logo.png'; 53 $savedAttachmentPostId = get_option( 'SlothLogoCustomizer_imageAttachmentId', 0 ); 54 if($savedAttachmentPostId!=0) 55 $savedAttachmentURL = wp_get_attachment_url( $savedAttachmentPostId ); 56 else 57 $savedAttachmentURL = $defaultIconURL; 115 // $defaultIconURL = plugin_dir_url( __FILE__ ) . 'wordpress-logo.png'; 116 // $savedAttachmentPostId = get_option( 'SlothLogoCustomizer_imageAttachmentId', 0 ); 117 // $networkIconPostId = get_site_option('SlothLogoCustomizer_SiteImageAttachmentId', 0); 118 // if($savedAttachmentPostId!=0) 119 // $savedAttachmentURL = wp_get_attachment_url( $savedAttachmentPostId ); 120 // else if($networkIconPostId != 0) 121 // $savedAttachmentURL = get_site_option('SlothLogoCustomizer_SiteImageAttachmentURL', 0); 122 // else 123 // $savedAttachmentURL = $defaultIconURL; 58 124 59 125 wp_enqueue_media(); … … 63 129 64 130 public function changeLogo(){ 65 $savedAttachmentPostId = get_option( 'SlothLogoCustomizer_imageAttachmentId', 0 ); 66 $savedAttachmentURL = wp_get_attachment_url( $savedAttachmentPostId ); 67 if($savedAttachmentPostId != 0){ 131 if($this->options->isLogoChanged()){ 68 132 echo '<style type="text/css">'; 69 echo "h1 a {background-image: url({$ savedAttachmentURL}) !important;}";133 echo "h1 a {background-image: url({$this->options->getLogoUrl()}) !important;}"; 70 134 echo '</style>'; 71 } 135 } 136 137 // $savedAttachmentPostId = get_option( 'SlothLogoCustomizer_imageAttachmentId', 0 ); 138 // $savedAttachmentURL = wp_get_attachment_url( $savedAttachmentPostId ); 139 // if($savedAttachmentPostId != 0){ 140 // echo '<style type="text/css">'; 141 // echo "h1 a {background-image: url({$savedAttachmentURL}) !important;}"; 142 // echo '</style>'; 143 // } 72 144 } 73 145 74 146 public function changeSignature(){ 147 // $url = ($this->options->allowOverride)? $this->signatureUrl: $this->siteSignatureUrl; 148 // $title = ($this->allowOverride)? $this->signatureTitle: $this->siteSignatureTitle; 75 149 //$url = get_option('SlothLogoCustomizer_PoweredByURL'); 76 150 //$title = get_option('SlothLogoCustomizer_PoweredByTitle'); 77 echo "<li><a href='{$this->signatureUrl}'>{$this->signatureTitle}</a></li>";151 echo "<li><a href='{$this->options->getSignatureUrl()}'>{$this->options->getSignatureTitle()}</a></li>"; 78 152 } 79 153
Note: See TracChangeset
for help on using the changeset viewer.