Detecting if NuSEO.PHP is loaded and enabled
To detect if NuSEO.PHP is loaded and enabled, use the following code snippet:
PHP Code:
$is_nuseo_enabled = ( isset( $GLOBALS['nuseo_config'] ) && ($GLOBALS['nuseo_config']['enabled'] == 1) );
Detecting if a specific NuSEO.PHP module is enabled
Example detecting if
NuSEO.PHP vBulletin Module is enabled:
PHP Code:
$is_nuseo_vbulletin_enabled = ( isset( $GLOBALS['nuseo_config'] ) && ($GLOBALS['nuseo_config']['enabled'] == 1) && $GLOBALS['nuseo_config']['vbulletin_enabled'] );
Example detecting if NuSEO.PHP phpFox Module is enabled:
PHP Code:
$is_nuseo_phpfox_enabled = ( isset( $GLOBALS['nuseo_config'] ) && ($GLOBALS['nuseo_config']['enabled'] == 1) && $GLOBALS['nuseo_config']['phpfox_enabled'] );
Rewriting all URLs in an html text
If you have a piece of html output in a variable, you can have NuSEO.PHP rewrite its URLs by calling nuseo_process_html:
PHP Code:
$output = nuseo_process_html( $output );
Notice that this function will rewrite URLs for all
NuSEO.PHP Modules enabled. For instance if vBulletin and phpFox Modules are enabled, all vBulletin and phpFox URLs will be rewritten.
Converting a string into a URL
You can use the following function to take any string and convert it into a URL like series of keywords. NuSEO.PHP uses this internally to generate all URLs out of the page's title.
PHP Code:
$url_str = nuseo_str_to_url( $title );
For instance, if $title has 'Startrek Enterprise History', nuseo_str_to_url will return 'startrek-enterprise-history'.
Notice that this function will follow the URL Generation Settings specified in NuSEO.PHP's Admin CP. For instance it will use the separator selected, or remove stopwords if specified, or translate non-english characters using the corresponding mapping, etc.
vBulletin Specific API
Getting a Forum's URL
PHP Code:
$forum_url = nuseo_vbulletin_get_forum_url( $forumid );
Where $forumid is the numeric id of the forum.
If you would like to get the URL for a specific forum page, use:
PHP Code:
$forum_url = nuseo_vbulletin_get_forum_url( $forumid, $pagenumber );
Getting a Thread's URL
PHP Code:
$thread_url = nuseo_vbulletin_get_thread_url( $threadid );
Where $threadid is the numeric id of the thread.