';
}
}
add_action( 'admin_head','includeTwitterCSS' );
add_action( 'wp_head', 'includeTwitterComponents' );
add_action( 'admin_menu', 'twitterAddOptionPage' );
add_action( 'init','startTwitterWidget' );
add_filter( 'the_content', 'processKeyword', '124544774' );
function processKeyword( $strContent )
{
$strContent = preg_replace( "/\[twitter\]/ise", "displayTwitterPlugin(true)", $strContent, -1, $intMatches );
if ( $intMatches > 0 )
{
$strContent = '' . $strContent;
}
return $strContent;
}
function twitterAddOptionPage()
{
add_submenu_page( 'plugins.php','Twitter Control', 'Twitter Control', 8, __FILE__, 'twitter_options_page' );
}
function includeTwitterCSS()
{
echo '';
}
// start: jQuery function to control the expansion and collapsing of the main app window
function includeTwitterComponents()
{
echo '';
if ( is_front_page() )
{
echo '';
}
}
// end: jQuery function to control the expansion and collapsing of the main app window
function twitter_options_page()
{
$strUserIdsForScript = get_option( TWITTER_USER_IDS );
$arrNames = explode( ',', $strUserIdsForScript );
$arrUseNames = array();
$strUserIdsValue = get_option( TWITTER_USER_IDS );
$strIsShow = get_option( TWITTER_SHOW_STATUS );
$strShowLogo = get_option( TWITTER_SHOW_LOGO );
$strShowAtUsername = get_option( TWITTER_SHOW_AT_USERNAME );
$intLimitNumber = (int) get_option( TWITTER_RESTRICT_TWEETS );
$intAllTweetsPageId = (int) get_option( TWITTER_PAGE_ID );
$arrPagesInfo = get_pages();
$arrPageUrls = array();
if ( false == empty( $arrPagesInfo ) )
{
foreach( $arrPagesInfo as $element )
{
$arrPageIds[] = $element->ID;
}
}
if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) )
{
if ( isset( $_POST['restrictupdate'] ) )
{
if ( isset( $_POST['restrictnumber'] ) )
{
$intLimitNumber = $_POST['restrictnumber'];
update_option( TWITTER_RESTRICT_TWEETS, $intLimitNumber );
echo '
Info updated.
';
}
}
if ( isset( $_POST['otheroptionsupdate'] ) )
{
// start: set to / not to display "@username" blogs
if ( $_POST['at'] )
{
$strShowAtUsername = 'checked';
}
else
{
$strShowAtUsername = 'unchecked';
}
// end: set to / not to display "@username" blogs
// start: set to / not to display "created by" footer
if ( $_POST['logo'] )
{
$strShowLogo = 'checked';
}
else
{
$strShowLogo = 'unchecked';
}
// end: set to / not to display "created by" footer
update_option( TWITTER_SHOW_LOGO, $strShowLogo );
update_option( TWITTER_SHOW_AT_USERNAME, $strShowAtUsername );
echo '
Info updated.
';
}
if ( isset( $_POST['usernameupdate'] ) )
{
if ( isset( $_POST[TWITTER_USER_IDS] ) )
{
if ( !( empty( $_POST[TWITTER_USER_IDS] ) ) )
{
if ( ( empty( $strUserIdsValue ) ) )
{
$strUserIdsValue = $_POST[TWITTER_USER_IDS];
$strIsShow = 'checked';
}
else
{
$strUserIdsValue = $strUserIdsValue.','.$_POST[TWITTER_USER_IDS];
$strIsShow = $strIsShow.',checked';
}
}
$arrRemoveValues = array();
$arrNamesTemp = explode( ',', $strUserIdsValue );
// start: collect the list of users to delete
foreach ( $arrNamesTemp as $strElement )
{
if ( 'delete' == $_POST['delete-'.$strElement] )
{
$arrRemoveValues[] = $strElement;
}
}
// end: collect the list of users to delete
$arrResult = array_diff( $arrNamesTemp, $arrRemoveValues );
if ( isset( $_POST['updateshownames'] ) )
{
// start: set to / not to display blogs by a specific user
$arrShowValues = array();
foreach ( $arrResult as $strElement )
{
if ( $strElement == $_POST['checkbox-'.$strElement] )
{
$arrShowValues[] = 'checked';
}
else
{
$arrShowValues[] = 'unchecked';
}
}
// end: set to / not to display blogs by a specific user
$strIsShow = implode( ",", $arrShowValues );
}
$strUserIdsValue = implode( ",", $arrResult );
// start: Save the posted values in the database
update_option( TWITTER_USER_IDS, $strUserIdsValue );
update_option( TWITTER_SHOW_STATUS, $strIsShow );
// end: Save the posted values in the database
echo '
';
}
}
}
displayTwitterOptionsPage( $strUserIdsValue, $strIsShow, $strShowAtUsername,
$strShowLogo, $intLimitNumber, $arrPageIds, $intAllTweetsPageId );
}
function displayTwitterOptionsPage( $strUserIdsValue, $strIsShow, $strShowAtUsername,
$strShowLogo, $intLimitNumber, $arrPageIds, $intAllTweetsPageId )
{
// start: setup default setting for showing the created by footer
if ( null == $strShowLogo || '' == $strShowLogo )
{
$strShowLogo = "checked";
}
// end: setup default setting for showing the created by footer
// start: display options on page
$arrNames = explode( ',', $strUserIdsValue );
$arrIsShow = explode( ',', $strIsShow );
echo '
Twitter Control
All Tweets URL
If you have setup an "All Tweets" page then please select it from the following list so that the main Twitter app can link to the correct page. For information on setting up an "All Tweets" page please see the readme.txt file that accompanies this plugin.
Update Blogs
To populate the cache file with your current registered user\'s blogs, click on the button opposite.
Please note: you will need to perform this task to reflect any changes made on registered user\'s blogs.
This process may take a few minutes to run, especially if you are collecting a large number of blogs.