New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-migrate templates: functions #454

Closed
hmpf opened this Issue Sep 2, 2016 · 8 comments

Comments

@hmpf
Contributor

hmpf commented Sep 2, 2016

Move things like all external function/method calls out of the template and into the calling page. Ditto for functions/classes defined directly in the template. If any of the previous is used to generate a variable to be printed, put it on the context ($this->data) instead.

@hmpf hmpf added this to the 1.15.0 milestone Sep 2, 2016

@hmpf hmpf self-assigned this Sep 2, 2016

@hmpf

This comment has been minimized.

Contributor

hmpf commented Sep 2, 2016

The following modules with templates do not have any troublesome functions that needs moving:

  • sanitycheck
  • metarefresh
  • authorize
  • authX509
  • cron
  • expirycheck
  • oauth
  • multiauth
  • preprodwarning

The following are trivially fixed:

  • authYubiKey
  • negotiate

The following are tricky and might need a separate branch each:

  • consent
  • consentAdmin
  • core
  • discopower
  • feide
  • memcacheMonitor
  • statistics
@hmpf

This comment has been minimized.

Contributor

hmpf commented Sep 2, 2016

The following modules have data in the template that qualifies for moving into the context of all templates:

  • multiauth: htmlentities($_SERVER['PHP_SELF'])

(Will add to list as more modules are examined.)

@hmpf hmpf changed the title from Pre-migrate templates to Pre-migrate templates: functions Sep 2, 2016

hmpf added a commit that referenced this issue Sep 6, 2016

hmpf added a commit that referenced this issue Sep 6, 2016

hmpf added a commit that referenced this issue Sep 15, 2016

@hmpf

This comment has been minimized.

Contributor

hmpf commented Oct 4, 2016

modules/consent/templates/consentform.php has a function present_attributes that is used to build up a recursive table with attributes. The recursivity makes it trickier to replace this with an included html fragment in twig, but it is much better than now when a specific style is extremely hardcoded. This function will not be touched before 1.15.

@hmpf

This comment has been minimized.

Contributor

hmpf commented Oct 4, 2016

modules/discopower/templates/disco.tpl.php has the function showEntry which is a good candidate for an included template fragment. It uses the function getTranslatedName which chooses the best translation out of several that has already been fetched from metadata. Potential ideas for replacing includeInlineTranslation.

@hmpf

This comment has been minimized.

Contributor

hmpf commented Oct 4, 2016

present_assoc and present_list in templates/includes/attributes.php are obvious candidates for included html fragments.

@hmpf

This comment has been minimized.

Contributor

hmpf commented Oct 4, 2016

present_attributes exists in two places, templates/includes/attributes.php (used in templates/hostnames.php and templates/status.php) and modules/consent/templates/consentform.php (only used there). This seems rather redundant.

@hmpf

This comment has been minimized.

Contributor

hmpf commented Oct 4, 2016

templates/post.php has a function printItem that seems to be unused.

@hmpf

This comment has been minimized.

Contributor

hmpf commented Oct 4, 2016

getBaseUrl in modules/statistics/templates/statistics.tpl.php does a lot, but quite a lot of what it does can be done by the twig filter url_encode.

hmpf added a commit that referenced this issue Oct 28, 2016

precurse added a commit to precurse/simplesamlphp that referenced this issue Nov 10, 2016

precurse added a commit to precurse/simplesamlphp that referenced this issue Nov 10, 2016

@jaimeperez jaimeperez modified the milestones: v1.16, 1.15.0 Aug 3, 2017

tvdijen added a commit to tvdijen/simplesamlphp that referenced this issue Aug 7, 2017

tvdijen added a commit to tvdijen/simplesamlphp that referenced this issue Aug 7, 2017

tvdijen added a commit to tvdijen/simplesamlphp that referenced this issue Aug 7, 2017

tvdijen added a commit to tvdijen/simplesamlphp that referenced this issue Aug 7, 2017

@thijskh thijskh modified the milestones: 1.16, 1.17 May 28, 2018

@tvdijen tvdijen modified the milestones: 1.17, 1.18 Oct 11, 2018

@thijskh thijskh closed this Nov 20, 2018

@thijskh thijskh modified the milestones: 1.18, 1.17 Nov 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment