Function of php echo $this->escapeHtml($this->getUsername()How to escape output data?Validation of review's textfield, nothing seems to worksHow to validate Tiny MCE Editor in frontend custom form and how to do for uploading image from my PC in TinyMCE Editor in Magento1.9Recently product view not workingWhere is content of <?php echo $this->getChildHtml('left') ?>?How display success message after submit the form particular product catalog?Form Validation magentoPhp code and html within echoPopup form validation in magento2<?php echo $this->getChildHtml('order_totals') ?> finding pathWhere is content of <?php echo $this->getChildHtml('methods') ?>
Graduate student with abysmal English writing skills, how to help
Should disabled buttons give feedback when clicked?
Are there any sports for which the world's best player is female?
Confirming the Identity of a (Friendly) Reviewer After the Reviews
Why didn't Thanos kill all the Dwarves on Nidavellir?
Optimization terminology: "Exact" v. "Approximate"
LED glows slightly during soldering
Why return a static pointer instead of an out parameter?
What specific instant in time in the MCU has been depicted the most times?
Single word for "refusing to move to next activity unless present one is completed."
Addressing unnecessary daily meetings with manager?
How to befriend private nested class
Is English unusual in having no second person plural form?
How would vampires avoid contracting diseases?
Integer Lists of Noah
Why does wrapping aluminium foil around my food help it keep warm, even though aluminium is a good conductor?
Swapping "Good" and "Bad"
Why are they 'nude photos'?
Does throwing a penny at a train stop the train?
Why doesn't sea level show seasonality?
Is anyone advocating the promotion of homosexuality in UK schools?
Word meaning to destroy books
What's the point of having a RAID 1 configuration over incremental backups to a secondary drive?
What does the phrase "head down the rat's hole" mean here?
Function of php echo $this->escapeHtml($this->getUsername()
How to escape output data?Validation of review's textfield, nothing seems to worksHow to validate Tiny MCE Editor in frontend custom form and how to do for uploading image from my PC in TinyMCE Editor in Magento1.9Recently product view not workingWhere is content of <?php echo $this->getChildHtml('left') ?>?How display success message after submit the form particular product catalog?Form Validation magentoPhp code and html within echoPopup form validation in magento2<?php echo $this->getChildHtml('order_totals') ?> finding pathWhere is content of <?php echo $this->getChildHtml('methods') ?>
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have the below piece of code
<ul class="form-list">
<li>
<label for="login-email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
<div class="input-box">
<input type="text" class="input-text required-entry validate-email" id="login-email" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" />
</div>
</li>
<li>
<label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
<div class="input-box">
<input type="password" class="input-text required-entry" id="login-password" name="login[password]" />
</div>
</li>
<?php echo $this->getChildHtml('form.additional.info'); ?>
</ul>
While most of the above are clear, I am struggling to understand the use of the below line
<?php echo $this->escapeHtml($this->getUsername()) ?>
Why couldn't I have just done
<?php echo $this->getUsername()?>
If it is a blank form that is seeking input, then what is being echoed?
Thanks for the help
magento-1.9 php
add a comment |
I have the below piece of code
<ul class="form-list">
<li>
<label for="login-email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
<div class="input-box">
<input type="text" class="input-text required-entry validate-email" id="login-email" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" />
</div>
</li>
<li>
<label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
<div class="input-box">
<input type="password" class="input-text required-entry" id="login-password" name="login[password]" />
</div>
</li>
<?php echo $this->getChildHtml('form.additional.info'); ?>
</ul>
While most of the above are clear, I am struggling to understand the use of the below line
<?php echo $this->escapeHtml($this->getUsername()) ?>
Why couldn't I have just done
<?php echo $this->getUsername()?>
If it is a blank form that is seeking input, then what is being echoed?
Thanks for the help
magento-1.9 php
Just to clarify, I am looking for the meaning of the $this->escapeHtml ..why couldnt I have simply done <?php echo $this->getUsername()?>
– Vinu D
Jul 14 '15 at 19:13
add a comment |
I have the below piece of code
<ul class="form-list">
<li>
<label for="login-email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
<div class="input-box">
<input type="text" class="input-text required-entry validate-email" id="login-email" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" />
</div>
</li>
<li>
<label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
<div class="input-box">
<input type="password" class="input-text required-entry" id="login-password" name="login[password]" />
</div>
</li>
<?php echo $this->getChildHtml('form.additional.info'); ?>
</ul>
While most of the above are clear, I am struggling to understand the use of the below line
<?php echo $this->escapeHtml($this->getUsername()) ?>
Why couldn't I have just done
<?php echo $this->getUsername()?>
If it is a blank form that is seeking input, then what is being echoed?
Thanks for the help
magento-1.9 php
I have the below piece of code
<ul class="form-list">
<li>
<label for="login-email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
<div class="input-box">
<input type="text" class="input-text required-entry validate-email" id="login-email" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" />
</div>
</li>
<li>
<label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
<div class="input-box">
<input type="password" class="input-text required-entry" id="login-password" name="login[password]" />
</div>
</li>
<?php echo $this->getChildHtml('form.additional.info'); ?>
</ul>
While most of the above are clear, I am struggling to understand the use of the below line
<?php echo $this->escapeHtml($this->getUsername()) ?>
Why couldn't I have just done
<?php echo $this->getUsername()?>
If it is a blank form that is seeking input, then what is being echoed?
Thanks for the help
magento-1.9 php
magento-1.9 php
edited Jul 2 at 9:32
Andhi Irawan
4641 gold badge8 silver badges20 bronze badges
4641 gold badge8 silver badges20 bronze badges
asked Jul 14 '15 at 18:28
Vinu DVinu D
761 silver badge10 bronze badges
761 silver badge10 bronze badges
Just to clarify, I am looking for the meaning of the $this->escapeHtml ..why couldnt I have simply done <?php echo $this->getUsername()?>
– Vinu D
Jul 14 '15 at 19:13
add a comment |
Just to clarify, I am looking for the meaning of the $this->escapeHtml ..why couldnt I have simply done <?php echo $this->getUsername()?>
– Vinu D
Jul 14 '15 at 19:13
Just to clarify, I am looking for the meaning of the $this->escapeHtml ..why couldnt I have simply done <?php echo $this->getUsername()?>
– Vinu D
Jul 14 '15 at 19:13
Just to clarify, I am looking for the meaning of the $this->escapeHtml ..why couldnt I have simply done <?php echo $this->getUsername()?>
– Vinu D
Jul 14 '15 at 19:13
add a comment |
1 Answer
1
active
oldest
votes
Mage_Core_Model_Abstract::escapeHtml($data)
is used to convert special characters to HTML entities from the passing data. That means it is used to avoid cross-site scripting (XSS) via special characters
The code $this->escapeHtml($this->getUserName())
is equivalent to
htmlspecialchars($this->getUserName(), ENT_COMPAT, 'UTF-8', false);
This is needed here because, when you have submitted the login form with wrong credentials, then Magento will populate the username field with previous POSTed username. But also it makes sure, there is no special characters present in the username field by enclosing user_name
in escapeHtml()
function.
There are also similar functions available in Mage_Core_Helper_Abstract
and in Mage_Core_Model_Abstract
classes. It will worth if you have a look over there. If you are lazy, then go through this.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f74413%2ffunction-of-php-echo-this-escapehtmlthis-getusername%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Mage_Core_Model_Abstract::escapeHtml($data)
is used to convert special characters to HTML entities from the passing data. That means it is used to avoid cross-site scripting (XSS) via special characters
The code $this->escapeHtml($this->getUserName())
is equivalent to
htmlspecialchars($this->getUserName(), ENT_COMPAT, 'UTF-8', false);
This is needed here because, when you have submitted the login form with wrong credentials, then Magento will populate the username field with previous POSTed username. But also it makes sure, there is no special characters present in the username field by enclosing user_name
in escapeHtml()
function.
There are also similar functions available in Mage_Core_Helper_Abstract
and in Mage_Core_Model_Abstract
classes. It will worth if you have a look over there. If you are lazy, then go through this.
add a comment |
Mage_Core_Model_Abstract::escapeHtml($data)
is used to convert special characters to HTML entities from the passing data. That means it is used to avoid cross-site scripting (XSS) via special characters
The code $this->escapeHtml($this->getUserName())
is equivalent to
htmlspecialchars($this->getUserName(), ENT_COMPAT, 'UTF-8', false);
This is needed here because, when you have submitted the login form with wrong credentials, then Magento will populate the username field with previous POSTed username. But also it makes sure, there is no special characters present in the username field by enclosing user_name
in escapeHtml()
function.
There are also similar functions available in Mage_Core_Helper_Abstract
and in Mage_Core_Model_Abstract
classes. It will worth if you have a look over there. If you are lazy, then go through this.
add a comment |
Mage_Core_Model_Abstract::escapeHtml($data)
is used to convert special characters to HTML entities from the passing data. That means it is used to avoid cross-site scripting (XSS) via special characters
The code $this->escapeHtml($this->getUserName())
is equivalent to
htmlspecialchars($this->getUserName(), ENT_COMPAT, 'UTF-8', false);
This is needed here because, when you have submitted the login form with wrong credentials, then Magento will populate the username field with previous POSTed username. But also it makes sure, there is no special characters present in the username field by enclosing user_name
in escapeHtml()
function.
There are also similar functions available in Mage_Core_Helper_Abstract
and in Mage_Core_Model_Abstract
classes. It will worth if you have a look over there. If you are lazy, then go through this.
Mage_Core_Model_Abstract::escapeHtml($data)
is used to convert special characters to HTML entities from the passing data. That means it is used to avoid cross-site scripting (XSS) via special characters
The code $this->escapeHtml($this->getUserName())
is equivalent to
htmlspecialchars($this->getUserName(), ENT_COMPAT, 'UTF-8', false);
This is needed here because, when you have submitted the login form with wrong credentials, then Magento will populate the username field with previous POSTed username. But also it makes sure, there is no special characters present in the username field by enclosing user_name
in escapeHtml()
function.
There are also similar functions available in Mage_Core_Helper_Abstract
and in Mage_Core_Model_Abstract
classes. It will worth if you have a look over there. If you are lazy, then go through this.
edited Apr 13 '17 at 12:54
Community♦
1
1
answered Jul 15 '15 at 2:23
Rajeev K TomyRajeev K Tomy
14.7k5 gold badges45 silver badges91 bronze badges
14.7k5 gold badges45 silver badges91 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f74413%2ffunction-of-php-echo-this-escapehtmlthis-getusername%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Just to clarify, I am looking for the meaning of the $this->escapeHtml ..why couldnt I have simply done <?php echo $this->getUsername()?>
– Vinu D
Jul 14 '15 at 19:13