nxs_getURL

The NextScripts: Social Networks Auto-Poster nxs getURL function.

Description

nxs_getURL( $options, $postID, (string) $addURLParams = '' ); 

Parameters (3)

0. $options
The options.
1. $postid
The postid.
2. $addurlparams (string)
The addurlparams.

Usage

  1. if ( !function_exists( 'nxs_getURL' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextscripts-social-networks-auto-poster/inc/nxs_functions_adv.php'; 
  3.  
  4. // The options. 
  5. $options = null; 
  6.  
  7. // The postid. 
  8. $postid = null; 
  9.  
  10. // The addurlparams. 
  11. $addurlparams = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = nxs_getURL($options, $postid, $addurlparams); 
  15.  

Defined (1)

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

/inc/nxs_functions_adv.php  
  1. if (!function_exists("nxs_getURL")) { function nxs_getURL($options, $postID, $addURLParams='') { global $plgn_NS_SNAutoPoster; $gOptions = $plgn_NS_SNAutoPoster->nxs_options;  
  2. if (!isset($options['urlToUse']) || trim($options['urlToUse'])=='') $myurl = trim(get_post_meta($postID, 'snap_MYURL', true)); 
  3. $ssl = (!empty($gOptions['ht']) && $gOptions['ht'] == ord('h')); if (!empty($myurl)) $options['urlToUse'] = $myurl; 
  4. if ((isset($options['urlToUse']) && trim($options['urlToUse'])!='') || $ssl) { $options['atchUse'] = 'F'; } else $options['urlToUse'] = get_permalink($postID);  
  5. $options['urlToUse'] = $ssl?$gOptions['useSSLCert']:$options['urlToUse']; // $addURLParams = trim($gOptions['addURLParams']);  
  6. if($addURLParams!='') $options['urlToUse'] .= (strpos($options['urlToUse'], '?')!==false?'&':'?').$addURLParams; $forceSURL = trim(get_post_meta($postID, '_snap_forceSURL', true)); 
  7. if (empty($forceSURL)) $forceSURL = !empty($options['forceSURL']); else $forceSURL = $forceSURL =='1'; if (!empty($options['suUName'])) $forceSURL = false; //## SU does not allow Shorteners 
  8. if ($gOptions['forcessl'] == 'N') $options['urlToUse'] = str_ireplace('https', 'http', $options['urlToUse']);  
  9. if ($gOptions['forcessl'] == 'S') $options['urlToUse'] = str_ireplace('http', 'https', str_ireplace('https', 'http', $options['urlToUse'])); 
  10. if ($forceSURL) $options['urlToUse'] = nxs_mkShortURL($options['urlToUse'], $postID); return $options; 
  11. }}