PageRenderTime 39ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/content/plugins/w3-total-cache/inc/options/referrer.php

https://gitlab.com/karlen/ayo_wp
PHP | 92 lines | 84 code | 8 blank | 0 comment | 1 complexity | 3c48bdd24986d05e7985cb4a84491cb9 MD5 | raw file
  1. <?php
  2. namespace W3TC;
  3. if ( !defined( 'W3TC' ) )
  4. die();
  5. ?>
  6. <?php include W3TC_INC_DIR . '/options/common/header.php'; ?>
  7. <script type="text/javascript">/*<![CDATA[*/
  8. var referrer_themes = {};
  9. <?php foreach ( $themes as $theme_key => $theme_name ): ?>
  10. referrer_themes['<?php echo addslashes( $theme_key ); ?>'] = '<?php echo addslashes( $theme_name ); ?>';
  11. <?php endforeach; ?>
  12. /*]]>*/</script>
  13. <p>
  14. <?php _e( 'Referrer group support is always <span class="w3tc-enabled">enabled', 'w3-total-cache' ); ?></span>.
  15. </p>
  16. <form id="referrer_form" action="admin.php?page=<?php echo $this->_page; ?>" method="post">
  17. <div class="metabox-holder">
  18. <?php Util_Ui::postbox_header( __( 'Manage Referrer Groups', 'w3-total-cache' ), '', 'manage' ); ?>
  19. <p>
  20. <input id="referrer_add" type="button" class="button" value="<?php _e( 'Create a group', 'w3-total-cache' ); ?>" /> <?php _e( 'of referrers by specifying names in the referrers field. Assign a set of referrers to use a specific theme, redirect them to another domain, create referrer groups to ensure that a unique cache is created for each referrer group. Drag and drop groups into order (if needed) to determine their priority (top -&gt; down).', 'w3-total-cache' ); ?>
  21. </p>
  22. <ul id="referrer_groups">
  23. <?php $index = 0; foreach ( $groups as $group => $group_config ): $index++; ?>
  24. <li id="referrer_group_<?php echo esc_attr( $group ); ?>">
  25. <table class="form-table">
  26. <tr>
  27. <th>
  28. <?php _e( 'Group name:', 'w3-total-cache' ); ?>
  29. </th>
  30. <td>
  31. <span class="referrer_group_number"><?php echo $index; ?>.</span> <span class="referrer_group"><?php echo htmlspecialchars( $group ); ?></span> <input type="button" class="button referrer_delete" value="<?php _e( 'Delete group', 'w3-total-cache' ); ?>" />
  32. </td>
  33. </tr>
  34. <tr>
  35. <th>
  36. <label for="referrer_groups_<?php echo esc_attr( $group ); ?>_enabled"><?php _e( 'Enabled:', 'w3-total-cache' ); ?></label>
  37. </th>
  38. <td>
  39. <input type="hidden" name="referrer_groups[<?php echo esc_attr( $group ); ?>][enabled]" value="0" />
  40. <input id="referrer_groups_<?php echo esc_attr( $group ); ?>_enabled" type="checkbox" name="referrer_groups[<?php echo esc_attr( $group ); ?>][enabled]" value="1"<?php checked( $group_config['enabled'], true ); ?> />
  41. </td>
  42. </tr>
  43. <tr>
  44. <th>
  45. <label for="referrer_groups_<?php echo esc_attr( $group ); ?>_theme"><?php _e( 'Theme:', 'w3-total-cache' ); ?></label>
  46. </th>
  47. <td>
  48. <select id="referrer_groups_<?php echo esc_attr( $group ); ?>_theme" name="referrer_groups[<?php echo esc_attr( $group ); ?>][theme]">
  49. <option value=""><?php _e( '-- Pass-through --', 'w3-total-cache' ); ?></option>
  50. <?php foreach ( $themes as $theme_key => $theme_name ): ?>
  51. <option value="<?php echo esc_attr( $theme_key ); ?>"<?php selected( $theme_key, $group_config['theme'] ); ?>><?php echo htmlspecialchars( $theme_name ); ?></option>
  52. <?php endforeach; ?>
  53. </select>
  54. <br /><span class="description"><?php _e( 'Assign this group of referrers to a specific theme. Selecting "Pass-through" allows any plugin(s) (e.g. referrer plugins) to properly handle requests for these referrers. If the "redirect users to" field is not empty, this setting is ignored.', 'w3-total-cache' ); ?></span>
  55. </td>
  56. </tr>
  57. <tr>
  58. <th>
  59. <label for="referrer_groups_<?php echo esc_attr( $group ); ?>_redirect"><?php _e( 'Redirect users to:', 'w3-total-cache' ); ?></label>
  60. </th>
  61. <td>
  62. <input id="referrer_groups_<?php echo esc_attr( $group ); ?>_redirect" type="text" name="referrer_groups[<?php echo esc_attr( $group ); ?>][redirect]" value="<?php echo esc_attr( $group_config['redirect'] ); ?>" size="60" />
  63. <br /><span class="description"><?php _e( 'A 302 redirect is used to send this group of referrers to another hostname (domain).', 'w3-total-cache' ); ?></span>
  64. </td>
  65. </tr>
  66. <tr>
  67. <th>
  68. <label for="referrer_groups_<?php echo esc_attr( $group ); ?>_referrers"><?php _e( 'Referrers:', 'w3-total-cache' ); ?></label>
  69. </th>
  70. <td>
  71. <textarea id="referrer_groups_<?php echo esc_attr( $group ); ?>_referrers" name="referrer_groups[<?php echo esc_attr( $group ); ?>][referrers]" rows="10" cols="50"><?php echo esc_textarea( implode( "\r\n", (array) $group_config['referrers'] ) ); ?></textarea>
  72. <br /><span class="description"><?php _e( 'Specify the referrers for this group. Remember to escape special characters like spaces, dots or dashes with a backslash. Regular expressions are also supported.', 'w3-total-cache' ); ?></span>
  73. </td>
  74. </tr>
  75. </table>
  76. </li>
  77. <?php endforeach; ?>
  78. </ul>
  79. <div id="referrer_groups_empty" style="display: none;"><?php _e( 'No groups added. All referrers recieve the same page and minify cache results.', 'w3-total-cache' ); ?></div>
  80. <?php Util_Ui::button_config_save( 'referrers' ); ?>
  81. <?php Util_Ui::postbox_footer(); ?>
  82. </div>
  83. </form>
  84. <?php include W3TC_INC_DIR . '/options/common/footer.php'; ?>