PageRenderTime 26ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/adminimize/inc-options/links_options.php

https://bitbucket.org/wiseintegration/wisetracker-wp
PHP | 184 lines | 169 code | 9 blank | 6 comment | 4 complexity | f1e78d81fc22f276173ea3b2c52c850c MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0
  1. <?php
  2. /**
  3. * @package Adminimize
  4. * @subpackage Link Options
  5. * @author Frank Bültge
  6. */
  7. if ( ! function_exists( 'add_action' ) ) {
  8. echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
  9. exit;
  10. }
  11. ?>
  12. <div id="poststuff" class="ui-sortable meta-box-sortables">
  13. <div class="postbox">
  14. <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>"><br /></div>
  15. <h3 class="hndle" id="links_options"><?php esc_attr_e( 'Links options', 'adminimize' ); ?></h3>
  16. <div class="inside">
  17. <br class="clear" />
  18. <table summary="config_edit_links" class="widefat">
  19. <colgroup>
  20. <?php
  21. $col = 0;
  22. foreach ( $user_roles_names as $role_name ) {
  23. echo '<col class="col' . $col . '">' . "\n";
  24. $col ++;
  25. }
  26. ?>
  27. </colgroup>
  28. <thead>
  29. <tr>
  30. <th><?php esc_attr_e( 'Option', 'adminimize' ); ?></th>
  31. <?php
  32. foreach ( $user_roles_names as $role_name ) { ?>
  33. <th><?php esc_attr_e( 'Deactivate for', 'adminimize' );
  34. echo '<br/>' . $role_name; ?></th>
  35. <?php } ?>
  36. </tr>
  37. <tr>
  38. <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td>
  39. <?php
  40. foreach ( $user_roles as $role_slug ) {
  41. echo '<td class="num">';
  42. echo '<input id="select_all" class="links_options_' . $role_slug
  43. . '" type="checkbox" name="" value="" />';
  44. echo '</td>' . "\n";
  45. } ?>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. <?php
  50. foreach ( $user_roles as $role ) {
  51. $disabled_link_option_[ $role ] = _mw_adminimize_get_option_value(
  52. 'mw_adminimize_disabled_link_option_' . $role . '_items'
  53. );
  54. }
  55. $link_options = array(
  56. '#namediv',
  57. '#addressdiv',
  58. '#descriptiondiv',
  59. '#linkcategorydiv',
  60. '#linktargetdiv',
  61. '#linkxfndiv',
  62. '#linkadvanceddiv',
  63. '#misc-publishing-actions'
  64. );
  65. $link_options_names = array(
  66. esc_attr__( 'Name' ),
  67. esc_attr__( 'Web Address' ),
  68. esc_attr__( 'Description' ),
  69. esc_attr__( 'Categories' ),
  70. esc_attr__( 'Target' ),
  71. esc_attr__( 'Link Relationship (XFN)' ),
  72. esc_attr__( 'Advanced' ),
  73. esc_attr__( 'Publish Actions', 'adminimize' )
  74. );
  75. $_mw_adminimize_own_link_values = _mw_adminimize_get_option_value( '_mw_adminimize_own_link_values' );
  76. $_mw_adminimize_own_link_values = preg_split( "/\r\n/", $_mw_adminimize_own_link_values );
  77. foreach ( (array) $_mw_adminimize_own_link_values as $key => $_mw_adminimize_own_link_value ) {
  78. $_mw_adminimize_own_link_value = trim( $_mw_adminimize_own_link_value );
  79. $link_options[] = $_mw_adminimize_own_link_value;
  80. }
  81. $_mw_adminimize_own_link_options = _mw_adminimize_get_option_value( '_mw_adminimize_own_link_options' );
  82. $_mw_adminimize_own_link_options = preg_split( "/\r\n/", $_mw_adminimize_own_link_options );
  83. foreach ( (array) $_mw_adminimize_own_link_options as $key => $_mw_adminimize_own_link_option ) {
  84. $_mw_adminimize_own_link_option = trim( $_mw_adminimize_own_link_option );
  85. $link_options_names[] = $_mw_adminimize_own_link_option;
  86. }
  87. $x = 0;
  88. foreach ( $link_options as $index => $link_option ) {
  89. if ( $link_option != '' ) {
  90. $checked_user_role_ = array();
  91. foreach ( $user_roles as $role ) {
  92. $checked_user_role_[ $role ] = ( isset( $disabled_link_option_[ $role ] )
  93. && in_array(
  94. $link_option, $disabled_link_option_[ $role ]
  95. ) ) ? ' checked="checked"' : '';
  96. }
  97. echo '<tr>' . "\n";
  98. echo '<td>' . $link_options_names[ $index ] . ' <span>(' . $link_option . ')</span> </td>' . "\n";
  99. foreach ( $user_roles as $role ) {
  100. echo '<td class="num">';
  101. echo '<input id="check_post' . $role . $x . '" class="links_options_'
  102. . preg_replace( '/[^a-z0-9_-]+/', '', $role ) . '" type="checkbox"'
  103. . $checked_user_role_[ $role ] . ' name="mw_adminimize_disabled_link_option_'
  104. . $role . '_items[]" value="' . $link_option . '" />';
  105. echo '</td>' . "\n";
  106. }
  107. echo '</tr>' . "\n";
  108. $x ++;
  109. }
  110. }
  111. ?>
  112. </tbody>
  113. </table>
  114. <?php
  115. //your own global options
  116. ?>
  117. <br style="margin-top: 10px;" />
  118. <table summary="config_edit_post" class="widefat">
  119. <thead>
  120. <tr>
  121. <th><?php esc_attr_e( 'Your own Link options', 'adminimize' );
  122. echo '<br />';
  123. esc_attr_e( 'Option name', 'adminimize' ); ?></th>
  124. <th><?php echo '<br />';
  125. esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
  126. </tr>
  127. </thead>
  128. <tbody>
  129. <tr valign="top">
  130. <td colspan="2"><?php esc_attr_e(
  131. 'It is possible to add your own IDs or classes from elements and tags. You can find IDs and classes with the FireBug Add-on for Firefox. Assign a value and the associate name per line.',
  132. 'adminimize'
  133. ); ?></td>
  134. </tr>
  135. <tr valign="top">
  136. <td>
  137. <textarea name="_mw_adminimize_own_link_options" cols="60" rows="3" id="_mw_adminimize_own_link_options" style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
  138. '_mw_adminimize_own_link_options'
  139. ); ?></textarea>
  140. <br />
  141. <?php esc_attr_e(
  142. 'Possible nomination for ID or class. Separate multiple nominations through a carriage return.',
  143. 'adminimize'
  144. ); ?>
  145. </td>
  146. <td>
  147. <textarea class="code" name="_mw_adminimize_own_link_values" cols="60" rows="3" id="_mw_adminimize_own_link_values" style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
  148. '_mw_adminimize_own_link_values'
  149. ); ?></textarea>
  150. <br />
  151. <?php esc_attr_e(
  152. 'Possible IDs or classes. Separate multiple values through a carriage return.', 'adminimize'
  153. ); ?>
  154. </td>
  155. </tr>
  156. </tbody>
  157. </table>
  158. <p id="submitbutton">
  159. <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" />
  160. <input class="button button-primary" type="submit" name="_mw_adminimize_save" value="<?php esc_attr_e(
  161. 'Update Options', 'adminimize'
  162. ); ?> &raquo;" /><input type="hidden" name="page_options" value="'dofollow_timeout'" />
  163. </p>
  164. <p>
  165. <a class="alignright button" href="javascript:void(0);" onclick="window.scrollTo(0,0);" style="margin:3px 0 0 30px;"><?php esc_attr_e(
  166. 'scroll to top', 'adminimize'
  167. ); ?></a><br class="clear" /></p>
  168. </div>
  169. </div>
  170. </div>