Example #1
0
/** 
 * Add the scripts needed for the page for this plugin.
 */
function STWWT_plugin_styles_Backend()
{
    // Check on STW settings page before loading any scripts/styles - so
    // we don't break other plugins.
    if (!(isset($_GET['page']) && substr(strtoupper($_GET['page']), 0, 6) == 'STWWT_')) {
        return;
    }
    wp_enqueue_style('stwwt_admin', STWWT_plugin_getPluginPath() . 'css/stwwt_admin.css', false, STWWT_VERSION);
}
Example #2
0
/**
 * Function that shows the settings page.
 */
function STWWT_showPage_Settings()
{
    /**
     * Constant: Documentation on how the mouseover bubble works.
     */
    define('STWWT_DESC_MOUSEOVER', '
		<p><img src="' . STWWT_plugin_getPluginPath() . 'img/stw_bubble_example.png" class="stwwt_settings_bubble_example"/> 
		The Shrink The Web mouseover bubble shows a thumbnail of the website when hovered over a link on your WordPress website. 
		This gives website visitors a preview of the link before they visit the website you link to.</p>
		<p>If the "<b>Automatic</b>" is selected below, all external links will show ShrinkTheWeb preview bubbles. Use <code>class="nopopup"</code> to disable popup bubble for a specific link.</p>
		<p>If the "<b>Manual</b>" method is selected below, then you choose which links get a preview bubble by adding <code>class="stwpopup"</code> to any link where you want to show them.</p>
		<div class="stwwt_clear"></div>
	');
    /**
     * Constant: Documentation on how the embedded code works.
     */
    define('STWWT_DESC_EMBEDDED', '
		<p>The Shrink The Web embed code shows a thumbnail for any link you wrap in <code>[thumb][/thumb]</code> or <code>[stwthumb][/stwthumb]</code> tags. Any use of these tags is replaced with the thumbnail of the website included in the tags. <a href="admin.php?page=stwwt_documentation#embed">See some examples on the documentation page</a>.

	');
    /**
     * Constant: Documentation on how the pro features work.
     */
    define('STWWT_DESC_EMBEDDED_PRO', '
		<p>The following features <b>require an upgraded account</b>. You can find more details on the <a href="https://www.shrinktheweb.com/auth/order-page" target="_blank">Shrink The Web Upgrade Page</a>.</p>
		<p>These settings are <b>global</b>, so they apply to <b>all thumbnails</b> on your website. Some of these settings have a per-thumbnail override, so please read <a href="admin.php?page=stwwt_documentation">the documentation</a> on how to apply these settings to specific thumbnails.</p>
	');
    $page = new PageBuilder(true);
    $page->showPageHeader(__('Shrink The Web - Website Thumbnails - Settings', 'stwwt'), '70%');
    $page->openPane('stw_settings_main', 'Thumbnail Settings');
    $settingDetails = array('stwwt_break_main' => array('type' => 'break', 'html' => STWWT_forms_createBreakHTML('Account Settings')), 'stwwt_access_id' => array('label' => 'Access Key Id', 'type' => 'text', 'required' => true, 'cssclass' => 'stwwt_access_id', 'desc' => 'Your Shrink The Web <b>access</b> key. You can find this within your <a href="http://www.shrinktheweb.com/auth/stw-lobby" target="_blank">STW Account Details</a>.', 'validate' => array('type' => 'string', 'regexp' => '/^[A-Za-z0-9]{12,20}$/', 'error' => 'Your STW access key should only contain numbers and letters, and it\'s about 15 characters long.')), 'stwwt_secret_id' => array('label' => 'Secret Key Id', 'type' => 'text', 'required' => true, 'cssclass' => 'stwwt_access_id', 'desc' => 'Your Shrink The Web <b>secret</b> key. You can find this within your <a href="http://www.shrinktheweb.com/auth/stw-lobby" target="_blank">STW Account Details</a>.', 'validate' => array('type' => 'string', 'regexp' => '/^[A-Za-z0-9]{5,10}$/', 'error' => 'Your STW access key should only contain numbers and letters, and it\'s about 5 characters long.')), 'stwwt_account_level' => array('label' => 'Your STW Account Level', 'type' => 'custom', 'html' => false, 'desc' => 'If you change any aspects of your Shrink The Web account (such as upgrades), click on the <b>Save All Settings</b> button below to re-load what features you can use.'), 'stwwt_break_embedded' => array('type' => 'break', 'html' => STWWT_forms_createBreakHTML('Screenshot Settings', 'Save ALL Settings') . '<div class="stwwt_description">' . STWWT_DESC_EMBEDDED . '</div>'), 'stwwt_shortcode' => array('label' => 'Shortcode Syntax', 'type' => 'radio', 'data' => array('stwthumb' => '<b>[stwthumb]</b>', 'thumb' => '[thumb]'), 'default' => 'thumb'), 'stwwt_embedded_default_size' => array('label' => 'Default Screenshot Size', 'type' => 'select', 'data' => array('mcr' => 'Micro (75x56)', 'tny' => 'Tiny (90x68)', 'vsm' => 'Very Small (100x75)', 'sm' => 'Small (120x90)', 'lg' => 'Large (200x150)', 'xlg' => 'Extra Large (320x200)'), 'desc' => 'The size of the thumbnail shown by the thumbnail shortcode.', 'default' => 'lg'), 'stwwt_embedded_cache_length' => array('label' => 'Cache Length in Days', 'type' => 'select', 'data' => array('3' => '3 Days', '7' => '7 Days (recommended)', '10' => '10 Days', '14' => '14 Days', '21' => '21 Days', '30' => '30 Days'), 'desc' => 'How long you want to cache the thumbnails for.', 'account_level' => array('basic', 'plus'), 'account_denied_msg' => STWWT_ACCOUNT_UPGRADE, 'default' => 7), 'stwwt_break_embedded_pro' => array('type' => 'break', 'html' => STWWT_forms_createBreakHTML('PRO Feature Settings', 'Save ALL Settings') . '<div class="stwwt_description">' . STWWT_DESC_EMBEDDED_PRO . '</div>'), 'stwwt_embedded_pro_inside' => array('label' => 'Inside Pages Capture', 'type' => 'radio', 'data' => array('enable' => '<b>Enabled</b>', 'disable' => 'Disabled'), 'account_feature' => 'embedded_pro_inside', 'account_denied_msg' => STWWT_FEATURE_UPGRADE, 'default' => 'disable'), 'stwwt_embedded_pro_full_length' => array('label' => 'Full-length Page Captures', 'type' => 'radio', 'data' => array('enable' => '<b>Enabled</b>', 'disable' => 'Disabled'), 'account_feature' => 'embedded_pro_full_length', 'account_denied_msg' => STWWT_FEATURE_UPGRADE, 'default' => 'disable'), 'stwwt_embedded_pro_custom_quality' => array('label' => 'Custom Thumbnail Quality', 'type' => 'select', 'data' => STWWT_getQualityList(), 'desc' => 'If you want to customise the thumbnail image quality, then you can select a quality value between 1% and 100%. A value of <b>1% is the lowest quality</b>, and <b>100% is the best quality</b>.', 'account_feature' => 'embedded_pro_custom_quality', 'account_denied_msg' => STWWT_FEATURE_UPGRADE), 'stwwt_break_bubble' => array('type' => 'break', 'html' => STWWT_forms_createBreakHTML('Mouseover Bubble Settings', 'Save ALL Settings') . '<div class="stwwt_description">' . STWWT_DESC_MOUSEOVER . '</div>'), 'stwwt_bubble_method' => array('label' => 'Preview Bubbles Show Method', 'type' => 'select', 'data' => array('disable' => 'Disabled', 'automatic' => 'Automatic', 'manual' => 'Manual'), 'default' => 'disable'), 'stwwt_bubble_size' => array('label' => 'Preview Bubbles Thumbnail Size', 'type' => 'select', 'data' => array('sm' => 'Small (120x90)', 'lg' => 'Large (200x150)', 'xlg' => 'Extra Large (320x200)'), 'desc' => 'The size of the thumbnail shown in the preview bubble when a website visitor hovers over a link.', 'default' => 'lg'));
    // Show main settings form
    $settings = new STWSettingsForm($settingDetails, STWWT_SETTINGS_KEY, 'stwwt_settings');
    $settings->setSaveButtonLabel('Save ALL Settings');
    $settings->show();
    // #### Support section
    $page->showPageMiddle('27%');
    $yes = sprintf('<img src="%simg/icon_%s.png" />', STWWT_plugin_getPluginPath(), 'tick');
    $no = sprintf('<img src="%simg/icon_%s.png" />', STWWT_plugin_getPluginPath(), 'cross');
    // Feature check
    $accountSettings = TidySettings_getSettings(STWWT_SETTINGS_KEY_ACCOUNT);
    if ($accountSettings) {
        $page->openPane('stw_settings_support', 'Your Account Features');
        ?>
			<table id="stwwt_feature_comp">
				<thead>
					<tr>
						<th>Feature</th>
						<th>Your Account</th>
					</tr>
				</thead>
				<tbody>										
					<?php 
        // Now show the features
        unset($accountSettings['account_type']);
        // So we can just loop through settings.
        foreach ($accountSettings as $settingName => $enabled) {
            switch ($settingName) {
                case 'embedded_pro_inside':
                    printf('<tr><th>%s</th><td>%s</td></tr>', 'Inside Pages Capture', 1 == $enabled ? $yes : $no);
                    break;
                case 'embedded_pro_full_length':
                    printf('<tr><th>%s</th><td>%s</td></tr>', 'Full Length Capture', 1 == $enabled ? $yes : $no);
                    break;
                case 'embedded_pro_custom_size':
                    printf('<tr><th>%s</th><td>%s</td></tr>', 'Custom Sizes', 1 == $enabled ? $yes : $no);
                    break;
                case 'embedded_pro_custom_quality':
                    printf('<tr><th>%s</th><td>%s</td></tr>', 'Custom Quality', 1 == $enabled ? $yes : $no);
                    break;
                    // Don't show feature
                // Don't show feature
                default:
                    break;
            }
        }
        ?>
					
				</tbody>
			</table>
	
		<?php 
        $page->closePane();
    }
    // end of your feature list
    $page->openPane('stw_settings_support', 'Get a STW Account...');
    ?>
	<div id="stwwt_signup">
			<a href="http://www.shrinktheweb.com/user/register" target="_blank">
				<img src="http://www.shrinktheweb.com/uploads/stw-banners/shrinktheweb-234x60.gif" alt="Website Thumbnail Provider" class="stwwt_settings_banner" width="234" height="60" alt="Register for a free account with Shrink The Web">
			</a>
			
			<div class="stwwt_settings_banner_text">
				<span>Need an account?</span>
				<a href="http://www.shrinktheweb.com/user/register" target="_blank" class="button-primary">Register for FREE</a>
			</div>
		</div>

	<?php 
    $page->closePane();
    // Support
    $page->openPane('stw_settings_support', 'Help &amp; Support');
    ?>
	<p>If you've got a problem with the plugin, please follow the following steps.</p>
	<ol>
		<li>Check the <a href="http://wordpress.org/extend/plugins/shrinktheweb-website-preview-plugin/faq/" target="_blank">Frequently Asked Questions</a> on WordPress.org. Your issue might already be answered or resolved.</li>
		<li>Check the <a href="http://wordpress.org/tags/shrinktheweb-website-preview-plugin?forum_id=10" target="_blank">plugin support forum</a> on WordPress.org. Someone might have had the same issue, and fixed it already.</li>
		<li>If you think the problem is a <b>plugin problem</b>, please raise the problem in the <a href="http://wordpress.org/tags/shrinktheweb-website-preview-plugin?forum_id=10" target="_blank">plugin support forum</a> on WordPress.org, including <b>as much detail as possible</b>, including any <b>error messages</b>.</li>
		<li>If you think the problem is a <b>STW or STW account problem</b>, please raise the problem in the <a href="http://www.shrinktheweb.com/forum" target="_blank">STW support forum</a>, including <b>as much detail as possible</b>, including any <b>error messages</b>.</li>
	</ol>
	
	<br/>
	<div class="stwwt_title">A word about the plugin authors...</div>
	<p>This plugin and the <a href="http://www.shrinktheweb.com" target="_blank">Shrink The Web</a> service has been developed and is provided by <a href="http://www.neosys.net/profile.htm" target="_blank">Neosys Consulting, Inc.</a></p>
	<?php 
    $page->closePane();
    $page->showPageFooter();
}