/wp-content/plugins/wordpress-seo/admin/class-help-center-item.php

https://bitbucket.org/carloskikea/helpet · PHP · 96 lines · 41 code · 15 blank · 40 comment · 5 complexity · 39665cd05b8e2e9e82a048f962d5d9fe MD5 · raw file

  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Options\Tabs
  6. */
  7. /**
  8. * Class WPSEO_Help_Center_Item
  9. */
  10. class WPSEO_Help_Center_Item {
  11. /** @var string Identifier for this tab. */
  12. private $identifier;
  13. /** @var string Label to display. */
  14. private $label;
  15. /** @var string The dashicon classname to display in front of the label. */
  16. private $dashicon;
  17. /** @var array Optional arguments. */
  18. private $args = array();
  19. /**
  20. * WPSEO_Help_Center_Item constructor.
  21. *
  22. * @param string $identifier Unique identifier for this tab.
  23. * @param string $label Label to display.
  24. * @param array $args Optional. Settings for this tab.
  25. * @param string $dashicon Optional. The classname of the dahsicon to put in front of the label.
  26. */
  27. public function __construct( $identifier, $label, $args = array(), $dashicon = '' ) {
  28. $this->identifier = $identifier;
  29. $this->label = $label;
  30. $this->dashicon = $dashicon;
  31. $this->args = $args;
  32. }
  33. /**
  34. * Get the label.
  35. *
  36. * @return string
  37. */
  38. public function get_label() {
  39. return $this->label;
  40. }
  41. /**
  42. * Get the identifier.
  43. *
  44. * @return string
  45. */
  46. public function get_identifier() {
  47. return $this->identifier;
  48. }
  49. /**
  50. * Get the dashicon.
  51. *
  52. * @return string
  53. */
  54. public function get_dashicon() {
  55. return $this->dashicon;
  56. }
  57. /**
  58. * Get the content of this tab.
  59. *
  60. * @return mixed|string
  61. */
  62. public function get_content() {
  63. if ( ! empty( $this->args['content'] ) ) {
  64. return $this->args['content'];
  65. }
  66. if ( ! empty( $this->args['callback'] ) ) {
  67. return call_user_func_array( $this->args['callback'], array( $this ) );
  68. }
  69. if ( ! empty( $this->args['view'] ) ) {
  70. $view = $this->args['view'];
  71. if ( substr( $view, - 4 ) === '.php' ) {
  72. $view = substr( $view, 0, - 4 );
  73. }
  74. if ( ! empty( $this->args['view_arguments'] ) ) {
  75. extract( $this->args['view_arguments'] );
  76. }
  77. include WPSEO_PATH . 'admin/views/' . $view . '.php';
  78. }
  79. return '';
  80. }
  81. }