WPSEO_Help_Center_Item

Class WPSEO_Help_Center_Item.

Defined (1)

The class is defined in the following location(s).

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