aiosp_common

The All In One SEO Pack aiosp common class.

Defined (1)

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

/inc/aiosp_common.php  
  1. class aiosp_common { 
  2.  
  3. /** 
  4. * aiosp_common constructor. 
  5. * These are commonly used functions that can be pulled from anywhere. 
  6. * (or in some cases they're functions waiting for a home) 
  7. */ 
  8. function __construct() { 
  9. //construct 
  10.  
  11.  
  12. /** 
  13. * @param null $p 
  14. * @return array|null|string|WP_Post 
  15. */ 
  16. static function get_blog_page( $p = null ) { 
  17. static $blog_page = ''; 
  18. static $page_for_posts = ''; 
  19. if ( null === $p ) { 
  20. global $post; 
  21. } else { 
  22. $post = $p; 
  23. if ( '' === $blog_page ) { 
  24. if ( '' === $page_for_posts ) { 
  25. $page_for_posts = get_option( 'page_for_posts' ); 
  26. if ( $page_for_posts && is_home() && ( ! is_object( $post ) || ( $page_for_posts !== $post->ID ) ) ) { 
  27. $blog_page = get_post( $page_for_posts ); 
  28.  
  29. return $blog_page; 
  30.  
  31. /** 
  32. * @param string $location 
  33. * @param string $title 
  34. * @param string $anchor 
  35. * @param string $target 
  36. * @param string $class 
  37. * @param string $id 
  38. * @return string 
  39. */ 
  40. static function get_upgrade_hyperlink( $location = '', $title = '', $anchor = '', $target = '', $class = '', $id = 'aio-pro-update' ) { 
  41.  
  42. $affiliate_id = ''; 
  43.  
  44. //call during plugins_loaded 
  45. $affiliate_id = apply_filters( 'aiosp_aff_id', $affiliate_id ); 
  46.  
  47. //build URL 
  48. $url = 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/'; 
  49. if ( $location ) { 
  50. $url .= '?loc=' . $location; 
  51. if ( $affiliate_id ) { 
  52. $url .= "?ap_id=$affiliate_id"; 
  53.  
  54. //build hyperlink 
  55. $hyperlink = '<a '; 
  56. if ( $target ) { 
  57. $hyperlink .= "target=\"$target\" "; 
  58. if ( $title ) { 
  59. $hyperlink .= "title=\"$title\" "; 
  60. if ( $id ) { 
  61. $hyperlink .= "id=\"$id\" "; 
  62.  
  63. $hyperlink .= "href=\"$url\">$anchor</a>"; 
  64.  
  65. return $hyperlink; 
  66.  
  67. static function get_upgrade_url() { 
  68. //put build URL stuff in here