Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Fix: Use alternative syntax in view scripts #384

Conversation

localheinz
Copy link
Member

This PR

  • adds a few semicolons (for consistency)
  • uses alternative syntax in view scripts (also for consistency)
  • removes an assignment and a condition with effect, but no use
  • while at it, escapes a few unescaped strings in the view templates affected above

<?php $socialSignIn = true; ?>
<?php foreach ($this->options->getEnabledProviders() as $provider): ?>
<?php if ($socialSignIn): ?>
<?php $socialSignIn = false; ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

someone know for this var is used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some

magic

?

Removing it in a second!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this was mostly copied from

<?php
$socialSignIn = true;
foreach ($this->options->getEnabledProviders() as $provider) {
    if ($socialSignIn) {
        echo '<h1>Social Sign In</h1>';
        $socialSignIn = false;
    }
    echo '<dd>' . $this->socialSignInButton($provider, $this->redirect) . '</dd>';
}
if ($this->options->getSocialLoginOnly() == false) {
    echo $this->zfcUserLogin;
}

See https://github.com/SocalNick/ScnSocialAuth/blob/master/view/scn-social-auth/user/login.phtml#L1-L12.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like its safe to

bye

@localheinz
Copy link
Member Author

@ins0

Thank you for reviewing, implemented the suggested changes!

@localheinz localheinz force-pushed the fix/alternative-syntax-in-view-scripts branch from aea0663 to b8b481a Compare February 10, 2015 19:27
@Ocramius
Copy link
Member

This requires a rebase

@localheinz localheinz force-pushed the fix/alternative-syntax-in-view-scripts branch from cc0f1f1 to facbce4 Compare February 16, 2015 10:30
@localheinz
Copy link
Member Author

@Ocramius

Rebased!

Thanks a lot for reviewing everything!

<div class="alert alert-block">No modules have been submitted yet</div>
<?php else: ?>
<?php foreach ($modules as $module): ?>
<?php echo $this->moduleView([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this helper require so many parameters? Isn't it easier to pass in $module instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius

That's what I plan to resolve next! 😉

@@ -11,7 +11,7 @@
</div>
</div>
<?php foreach ($this->flashMessenger()->getMessages() as $message): ?>
<h3 class="zf-green"><?php echo $message ?></h3>
<h3 class="zf-green"><?php echo $this->escapeHtml($message); ?></h3>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius

Escaping for now, would like to re-iterate on this and use the FlashMessenger directly, as suggested!
Also, I would like to use http://getbootstrap.com/components/#alerts, what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be done in a different MR then (with screenshots 'n stuff, so someone with better taste than me can deal with it :-) )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would like to do this if @localheinz agrees - as i allready implemented this on a diff project (personal) 😼 :

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ins0

Sure, go ahead!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ins0

If you do, please have a look at places where classes are missing:

<div class="alert alert-block">No modules found</div>

which results in

screen shot 2015-02-17 at 16 16 38

vs.

<div class="alert alert-info alert-block">No modules found</div>

which would result in

screen shot 2015-02-17 at 16 16 56

💡 Just as an idea, in Getting Real from 37signals, there's a chapter The Blank State - I think we could improve on that.

Ocramius added a commit that referenced this pull request Feb 17, 2015
…w-scripts

Fix: Use alternative syntax in view scripts
@Ocramius Ocramius merged commit 707b642 into zendframework:master Feb 17, 2015
@localheinz localheinz deleted the fix/alternative-syntax-in-view-scripts branch February 17, 2015 15:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants