Plugin Directory

Changeset 1707097


Ignore:
Timestamp:
08/02/2017 04:27:38 PM (8 years ago)
Author:
ammar.shahraki
Message:

tagging version 1.1

Location:
sloth-logo-customizer
Files:
4 added
10 edited
2 copied

Legend:

Unmodified
Added
Removed
  • sloth-logo-customizer/tags/1.1/languages/sloth-logo-customizer-fa_IR.po

    r1688279 r1707097  
    3636msgstr "یک تصویر را انتخاب کنید"
    3737
     38#: setting.php:32
     39msgid "Both url and title fields should have value"
     40msgstr "هردو فیلد عنوان و نشانی باید مقدار داشته باشند"
     41
    3842#: my-logo.php:41
    3943msgid "Login Logo"
     
    6367msgid "Empty for wordpress default values"
    6468msgstr "برای مقادیر پیش فرض وردپرس خالی بگذارید"
     69
     70#: network-setting.php:83
     71msgid "Allow blogs to override settings"
     72msgstr "به وبلاگ ها اجازه تغییر تنظیمات داده شود."
  • sloth-logo-customizer/tags/1.1/readme.txt

    r1688287 r1707097  
    55Requires at least: 4.2.4
    66Tested up to: 4.8
    7 Stable tag: trunk
     7Stable tag: 1.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support strign and url on the blog info widget.
     11Sloth 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.
    1212
    1313== Description ==
    1414
    15 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support strign and url on the blog info widget.
     15Sloth 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.
    1616
    1717Major features of Blog Post filter include:
    1818
     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.
    1920* Simplicity: In contrast with similar plugin this plugin is very simple and easy to use.
    2021* Efficiency: The plugin has a minimum processing overhead on the site.
     
    25261. Upload `sloth-logo-customizer` directory to the `/wp-content/plugins/` directory
    26272. 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.
     283. 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.
    28294. You're done!
    2930
     
    38391. Preview of the Blog Post Filter's admin page.
    39402. Persian taranslation of the Blog Post Filter's admin page.
     413. Preview of the Blog Post Filter's network admin page.
     424. Persian taranslation of the Blog Post Filter's network admin page.
    4043
    4144== Changelog ==
    4245
    43 = 1.0.0 =
     46= 1.1 =
     47* Multisite features are added.
     48
     49= 1.0 =
    4450* Fist version.
    4551
    4652== Upgrade Notice ==
    4753
    48 = 1.0.0 =
     54= 1.1 =
     55Whole source code is revised to add WordPress multisite support to the plugin.
     56
     57= 1.1 =
    4958This is the initial version.
  • sloth-logo-customizer/tags/1.1/setting.php

    r1688279 r1707097  
    33        jQuery( document ).ready( function( $ ) {
    44            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();?>');
    66                    $("#image-attachemt-id").val(0);
    77            });
     
    2424               
    2525                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                            }
    2635            });
    2736        });
     
    6271               
    6372                <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 />
    6574                <input id="upload-image-button" type="button" class="button" value="<?php _e('Update'); ?>" />
    6675                <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();?>" />
    6877               
    6978            </fieldset>
     
    7382               
    7483                <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">
    7685                <span><?php _e('Empty for wordpress default values','sloth-logo-customizer');?></span><br />
    7786               
    7887                <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();?>">
    8089                <span><?php _e('Empty for wordpress default values','sloth-logo-customizer');?></span><br />
    8190               
  • sloth-logo-customizer/tags/1.1/sloth-logo-customizer.php

    r1688279 r1707097  
    1111 */
    1212
    13 //error_reporting(E_ALL | E_STRICT);
    14 //ini_set("display_errors", 1);
     13error_reporting(E_ALL | E_STRICT);
     14ini_set("display_errors", 1);
     15
     16include_once('sloth-options.php');
     17
    1518class 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;
    1826
    1927    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'));
    3337    }
    3438   
    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');
    3796    }
    3897   
     
    4099       
    41100        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']);
    43104        }
    44105       
    45106        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');
    50113        }
    51114       
    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;
    58124           
    59125        wp_enqueue_media();
     
    63129   
    64130    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()){
    68132            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;}";
    70134            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//      }
    72144    }
    73145   
    74146    public function changeSignature(){
     147//             $url   = ($this->options->allowOverride)? $this->signatureUrl:   $this->siteSignatureUrl;
     148//             $title = ($this->allowOverride)? $this->signatureTitle: $this->siteSignatureTitle;
    75149        //$url = get_option('SlothLogoCustomizer_PoweredByURL');
    76150        //$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>";
    78152    }
    79153   
  • sloth-logo-customizer/trunk/languages/sloth-logo-customizer-fa_IR.po

    r1688279 r1707097  
    3636msgstr "یک تصویر را انتخاب کنید"
    3737
     38#: setting.php:32
     39msgid "Both url and title fields should have value"
     40msgstr "هردو فیلد عنوان و نشانی باید مقدار داشته باشند"
     41
    3842#: my-logo.php:41
    3943msgid "Login Logo"
     
    6367msgid "Empty for wordpress default values"
    6468msgstr "برای مقادیر پیش فرض وردپرس خالی بگذارید"
     69
     70#: network-setting.php:83
     71msgid "Allow blogs to override settings"
     72msgstr "به وبلاگ ها اجازه تغییر تنظیمات داده شود."
  • sloth-logo-customizer/trunk/readme.txt

    r1688287 r1707097  
    55Requires at least: 4.2.4
    66Tested up to: 4.8
    7 Stable tag: trunk
     7Stable tag: 1.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support strign and url on the blog info widget.
     11Sloth 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.
    1212
    1313== Description ==
    1414
    15 Sloth Logo customizer changes the wordpress logo on the login page and enable you to change the support strign and url on the blog info widget.
     15Sloth 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.
    1616
    1717Major features of Blog Post filter include:
    1818
     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.
    1920* Simplicity: In contrast with similar plugin this plugin is very simple and easy to use.
    2021* Efficiency: The plugin has a minimum processing overhead on the site.
     
    25261. Upload `sloth-logo-customizer` directory to the `/wp-content/plugins/` directory
    26272. 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.
     283. 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.
    28294. You're done!
    2930
     
    38391. Preview of the Blog Post Filter's admin page.
    39402. Persian taranslation of the Blog Post Filter's admin page.
     413. Preview of the Blog Post Filter's network admin page.
     424. Persian taranslation of the Blog Post Filter's network admin page.
    4043
    4144== Changelog ==
    4245
    43 = 1.0.0 =
     46= 1.1 =
     47* Multisite features are added.
     48
     49= 1.0 =
    4450* Fist version.
    4551
    4652== Upgrade Notice ==
    4753
    48 = 1.0.0 =
     54= 1.1 =
     55Whole source code is revised to add WordPress multisite support to the plugin.
     56
     57= 1.1 =
    4958This is the initial version.
  • sloth-logo-customizer/trunk/setting.php

    r1688279 r1707097  
    33        jQuery( document ).ready( function( $ ) {
    44            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();?>');
    66                    $("#image-attachemt-id").val(0);
    77            });
     
    2424               
    2525                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                            }
    2635            });
    2736        });
     
    6271               
    6372                <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 />
    6574                <input id="upload-image-button" type="button" class="button" value="<?php _e('Update'); ?>" />
    6675                <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();?>" />
    6877               
    6978            </fieldset>
     
    7382               
    7483                <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">
    7685                <span><?php _e('Empty for wordpress default values','sloth-logo-customizer');?></span><br />
    7786               
    7887                <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();?>">
    8089                <span><?php _e('Empty for wordpress default values','sloth-logo-customizer');?></span><br />
    8190               
  • sloth-logo-customizer/trunk/sloth-logo-customizer.php

    r1688279 r1707097  
    1111 */
    1212
    13 //error_reporting(E_ALL | E_STRICT);
    14 //ini_set("display_errors", 1);
     13error_reporting(E_ALL | E_STRICT);
     14ini_set("display_errors", 1);
     15
     16include_once('sloth-options.php');
     17
    1518class 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;
    1826
    1927    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'));
    3337    }
    3438   
    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');
    3796    }
    3897   
     
    4099       
    41100        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']);
    43104        }
    44105       
    45106        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');
    50113        }
    51114       
    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;
    58124           
    59125        wp_enqueue_media();
     
    63129   
    64130    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()){
    68132            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;}";
    70134            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//      }
    72144    }
    73145   
    74146    public function changeSignature(){
     147//             $url   = ($this->options->allowOverride)? $this->signatureUrl:   $this->siteSignatureUrl;
     148//             $title = ($this->allowOverride)? $this->signatureTitle: $this->siteSignatureTitle;
    75149        //$url = get_option('SlothLogoCustomizer_PoweredByURL');
    76150        //$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>";
    78152    }
    79153   
Note: See TracChangeset for help on using the changeset viewer.