Source Code Documentation


s2member-pro\includes\classes\lock-icons-in.inc.php


  1. <?php
  2. /**
  3. * Pro Lock Icons ( inner processing routines ).
  4. *
  5. * Copyright: © 2009-2011
  6. * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
  7. * ( coded in the USA )
  8. *
  9. * This WordPress® plugin ( s2Member Pro ) is comprised of two parts:
  10. *
  11. * o (1) Its PHP code is licensed under the GPL license, as is WordPress®.
  12. * You should have received a copy of the GNU General Public License,
  13. * along with this software. In the main directory, see: /licensing/
  14. * If not, see: {@link http://www.gnu.org/licenses/}.
  15. *
  16. * o (2) All other parts of ( s2Member Pro ); including, but not limited to:
  17. * the CSS code, some JavaScript code, images, and design;
  18. * are licensed according to the license purchased.
  19. * See: {@link http://www.s2member.com/prices/}
  20. *
  21. * Unless you have our prior written consent, you must NOT directly or indirectly license,
  22. * sub-license, sell, resell, or provide for free; part (2) of the s2Member Pro Module;
  23. * or make an offer to do any of these things. All of these things are strictly
  24. * prohibited with part (2) of the s2Member Pro Module.
  25. *
  26. * Your purchase of s2Member Pro includes free lifetime upgrades via s2Member.com
  27. * ( i.e. new features, bug fixes, updates, improvements ); along with full access
  28. * to our video tutorial library: {@link http://www.s2member.com/videos/}
  29. *
  30. * @package s2Member\Lock_Icons
  31. * @since 1.5
  32. */
  33. if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
  34. exit("Do not access this file directly.");
  35. /**/
  36. if (!class_exists ("c_ws_plugin__s2member_pro_lock_icons_in"))
  37. {
  38. /**
  39. * Pro Lock Icons ( inner processing routines ).
  40. *
  41. * @package s2Member\Lock_Icons
  42. * @since 1.5
  43. */
  44. class c_ws_plugin__s2member_pro_lock_icons_in
  45. {
  46. /**
  47. * The "(s2)" column header, attaching an ID to it as well.
  48. *
  49. * @package s2Member\Lock_Icons
  50. * @since 1.5
  51. *
  52. * @param array $cols Array of columns passed through by a Filter.
  53. * @return array Merged array of columns, including the one for `(s2)`.
  54. */
  55. public static function _lock_icons_return_column ($cols = FALSE)
  56. {
  57. return array_merge ($cols, array ("ws_plugin__s2member_pro_lock_icons" => "(s2)"));
  58. }
  59. /**
  60. * Status for Tags.
  61. *
  62. * @package s2Member\Lock_Icons
  63. * @since 1.5
  64. *
  65. * @param str $value Existing value for this data column.
  66. * @param str $column_name Column ID/Name. We need to look at this to fill the `(s2)` column.
  67. * @param int|str $id Expecting a numeric Tag ID to be passed through by the Filter.
  68. * @return str If `(s2)` column, return status. Else, existing ``$value``.
  69. */
  70. public static function _lock_icons_return_value_tags ($value = FALSE, $column_name = FALSE, $id = FALSE)
  71. {
  72. return ($column_name === "ws_plugin__s2member_pro_lock_icons") ? c_ws_plugin__s2member_pro_lock_icons_in::_return_lock_icons_description (c_ws_plugin__s2member_ptags_sp::check_specific_ptag_level_access ($id, false)) : $value;
  73. }
  74. /**
  75. * Status for Categories.
  76. *
  77. * @package s2Member\Lock_Icons
  78. * @since 1.5
  79. *
  80. * @param str $value Existing value for this data column.
  81. * @param str $column_name Column ID/Name. We need to look at this to fill the `(s2)` column.
  82. * @param int|str $id Expecting a numeric Category ID to be passed through by the Filter.
  83. * @return str If `(s2)` column, return status. Else, existing ``$value``.
  84. */
  85. public static function _lock_icons_return_value_categories ($value = FALSE, $column_name = FALSE, $id = FALSE)
  86. {
  87. return ($column_name === "ws_plugin__s2member_pro_lock_icons") ? c_ws_plugin__s2member_pro_lock_icons_in::_return_lock_icons_description (c_ws_plugin__s2member_catgs_sp::check_specific_catg_level_access ($id, false)) : $value;
  88. }
  89. /**
  90. * Status for Pages, these are handled separately.
  91. *
  92. * @package s2Member\Lock_Icons
  93. * @since 1.5
  94. *
  95. * @param str $column_name Column ID/Name. We need to look at this to fill the `(s2)` column.
  96. * @param int|str $id Expecting a numeric Page ID to be passed by the Action Hook.
  97. * @return null
  98. */
  99. public static function _lock_icons_echo_value_pages ($column_name = FALSE, $id = FALSE)
  100. {
  101. echo ($column_name === "ws_plugin__s2member_pro_lock_icons") ? c_ws_plugin__s2member_pro_lock_icons_in::_return_lock_icons_description (c_ws_plugin__s2member_pages_sp::check_specific_page_level_access ($id, false)) : "";
  102. }
  103. /**
  104. * Status for all other Post Types, including Custom Post Types; but excluding Pages.
  105. *
  106. * @package s2Member\Lock_Icons
  107. * @since 1.5
  108. *
  109. * @param str $column_name Column ID/Name. We need to look at this to fill the `(s2)` column.
  110. * @param int|str $id Expecting a numeric Post ID to be passed by the Action Hook.
  111. * @return null
  112. */
  113. public static function _lock_icons_echo_value_post_types ($column_name = FALSE, $id = FALSE)
  114. {
  115. echo ($column_name === "ws_plugin__s2member_pro_lock_icons") ? c_ws_plugin__s2member_pro_lock_icons_in::_return_lock_icons_description (c_ws_plugin__s2member_posts_sp::check_specific_post_level_access ($id, false)) : "";
  116. }
  117. /**
  118. * CSS styles for Lock Icon columns.
  119. *
  120. * @package s2Member\Lock_Icons
  121. * @since 1.5
  122. *
  123. * @return null
  124. */
  125. public static function _lock_icons_echo_css ()
  126. {
  127. $css = '<style type="text/css">';
  128. $css .= 'th.column-ws_plugin__s2member_pro_lock_icons, td.column-ws_plugin__s2member_pro_lock_icons { width: 45px; text-align:center; }';
  129. $css .= '</style>';
  130. /**/
  131. echo apply_filters ("_ws_plugin__s2member_pro_lock_icons_echo_css", $css, get_defined_vars ());
  132. }
  133. /**
  134. * Translates a return array into a string description.
  135. *
  136. * @package s2Member\Lock_Icons
  137. * @since 1.5
  138. *
  139. * @param array $array Expects an array returned by one of s2Member's security routines.
  140. * @return str A verbose string representation of the return array details.
  141. */
  142. public static function _return_lock_icons_description ($array = FALSE)
  143. {
  144. $dir_url = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
  145. /**/
  146. if (isset ($array["s2member_level_req"]))
  147. $req = 'Requires Membership Level #' . $array["s2member_level_req"];
  148. /**/
  149. else if (isset ($array["s2member_ccap_req"]))
  150. $req = 'Requires Custom Capabilities';
  151. /**/
  152. else if (isset ($array["s2member_sp_req"]))
  153. $req = 'Requires Specific Post/Page Access';
  154. /**/
  155. $desc = ($req) ? '<img src="' . esc_attr ($dir_url) . '/images/lock-icon.png" style="cursor:help; width:16px; border:0;" title="' . esc_attr ($req) . '" />' : '<span style="cursor:help;" title="Publicly Available">&mdash;</span>';
  156. /**/
  157. return apply_filters ("_ws_plugin__s2member_pro_return_lock_icons_description", $desc, get_defined_vars ());
  158. }
  159. }
  160. }
  161. ?>

s2member-pro\includes\classes\lock-icons-in.inc.php

Source Code Documentation