function widget_controlView($is_admin = false) { global $DiamondCache; // Title if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_p_title']; update_option('wgt_title', $option); } $wgt_title = get_option('wgt_title'); echo '<input type="hidden" name="wgt_post_hidden" value="success" />'; echo '<label for="wgt_p_title">' . __('Widget Title', 'diamond') . ':<br /><input id="wgt__ptitle" name="wgt_p_title" type="text" value="' . $wgt_title . '" /></label>'; if ($_POST['wgt_post_hidden']) { $DiamondCache->addSettings('recent-posts', 'expire', $_POST['diamond_p_cache']); } $dccache = $DiamondCache->getSettings('recent-posts', 'expire'); if ($dccache == '') { $dccache = 120; } echo '<br />'; echo '<label for="diamond_p_cache">' . __('Cache Expire Time (sec)', 'diamond') . ':<br /><input id="diamond_p_cache" name="diamond_p_cache" type="text" value="' . $dccache . '" /></label>'; // Count if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_count']; update_option('wgt_count', $option); } $wgt_count = get_option('wgt_count'); echo '<br /><label for="wgt_number">' . __('Posts count', 'diamond') . ':<br /><input id="wgt_count" name="wgt_count" type="text" value="' . $wgt_count . '" /></label>'; // miss blogs if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_miss']; $tmp = ''; $sep = ''; if (isset($option) && $option != '') { foreach ($option as $op) { $tmp .= $sep . $op; $sep = ';'; } } update_option('wgt_miss', $tmp); } $wgt_miss = get_option('wgt_miss'); $miss = split(';', $wgt_miss); echo '<br /><label for="wgt_miss">' . __('Exclude blogs: (The first 50 blogs)', 'diamond'); $blog_list = get_blog_list(0, 50); echo '<br />'; foreach ($blog_list as $blog) { echo '<input id="wgt_miss_' . $blog['blog_id'] . '" name="wgt_miss[]" type="checkbox" value="' . $blog['blog_id'] . '" '; if (in_array($blog['blog_id'], $miss)) { echo ' checked="checked" '; } echo ' />'; echo get_blog_option($blog['blog_id'], 'blogname'); echo '<br />'; } echo '</label>'; //Whitelist if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_white']; $tmp = ''; $sep = ''; if (isset($option) && $option != '') { foreach ($option as $op) { $tmp .= $sep . $op; $sep = ';'; } } update_option('wgt_white', $tmp); } $wgt_white = get_option('wgt_white'); $miss = split(';', $wgt_white); echo '<br /><label for="wgt_white">' . __('White List: (The first 50 blogs)', 'diamond'); $blog_list = get_blog_list(0, 50); echo '<br />'; foreach ($blog_list as $blog) { echo '<input id="wgt_white_' . $blog['blog_id'] . '" name="wgt_white[]" type="checkbox" value="' . $blog['blog_id'] . '" '; if (in_array($blog['blog_id'], $miss)) { echo ' checked="checked" '; } echo ' />'; echo get_blog_option($blog['blog_id'], 'blogname'); echo '<br />'; } echo '</label>'; // Format if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_format']; if (!isset($option) || $option == '') { $option = '<strong>{title}</strong> - {date}'; } update_option('wgt_format', get_format_code($option)); } $wgt_format = htmlentities(str_replace('\\"', '"', get_format_txt(get_option('wgt_format')))); echo '<label for="wgt_number">' . __('Format string', 'diamond') . ':<br /><input id="wgt_format" name="wgt_format" type="text" value="' . $wgt_format . '" /></label><br />'; echo '{title} - ' . __('The post\'s title', 'diamond') . '<br />'; echo '{title_txt} - ' . __('The post\'s title', 'diamond') . ' ' . __('(without link)', 'diamond') . '<br />'; echo '{excerpt} - ' . __('The post\'s excerpt', 'diamond') . '<br />'; echo '{date} - ' . __('The post\'s date', 'diamond') . '<br />'; echo '{author} - ' . __('The post\'s author', 'diamond') . '<br />'; echo '{avatar} - ' . __('Author\'s avatar', 'diamond') . '<br />'; echo '{blog} - ' . __('The post\'s blog name', 'diamond') . '<br />'; echo '{blog_link} - ' . __('The post\'s blog link', 'diamond') . '<br />'; echo '{blog_url} - ' . __('The post\'s blog url', 'diamond') . '<br />'; echo '{more} - ' . __('The "Read More" link', 'diamond') . '<br />'; echo '<br />'; if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_avsize']; update_option('wgt_avsize', $option); } $wgt_avsize = get_option('wgt_avsize'); echo '<label for="wgt_avsize">' . __('Avatar Size (px)', 'diamond') . ':<br /><input id="wgt_avsize" name="wgt_avsize" type="text" value="' . $wgt_avsize . '" /></label>'; echo '<br />'; if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_defav']; update_option('wgt_defav', $option); } $wgt_defav = get_option('wgt_defav'); echo '<label for="wgt_defav">' . __('Default Avatar URL', 'diamond') . ':<br /><input id="wgt_defav" name="wgt_defav" type="text" value="' . $wgt_defav . '" /></label>'; echo '<br />'; if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_mtext']; if (!isset($option) || $option == '') { $option = __('Read More', 'diamond'); } update_option('wgt_mtext', $option); } $wgt_mtext = get_option('wgt_mtext'); echo '<label for="wgt_mtext">' . __('"Read More" link text', 'diamond') . ':<br /><input id="wgt_mtext" name="wgt_mtext" type="text" value="' . $wgt_mtext . '" /></label>'; echo '<br />'; if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_dt']; update_option('wgt_dt', $option); } $wgt_dt = get_option('wgt_dt'); if (!isset($wgt_dt) || trim($wgt_dt) == '') { $wgt_dt = 'M. d. Y.'; update_option('wgt_dt', $wgt_dt); } echo '<label for="wgt_dt">' . __('DateTime format (<a href="http://php.net/manual/en/function.date.php" target="_blank">manual</a>)', 'diamond') . ':<br /><input id="wgt_dt" name="wgt_dt" type="text" value="' . $wgt_dt . '" /></label>'; echo '<br />'; if (!$is_admin) { echo '<br />'; _e('if you like this widget then', 'diamond'); echo ': <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40amegrant%2ehu&lc=HU&item_name=Diamond%20Multisite%20WordPress%20Widget¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted" target="_blank">'; _e('Buy me a beer!', 'diamond'); echo '</a><br />'; } if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_post_limit']; update_option('wgt_post_limit', $option); } $wgt_post_limit = get_option('wgt_post_limit'); if (!isset($wgt_post_limit) || trim($wgt_post_limit) == '') { $wgt_post_limit = 0; update_option('wgt_post_limit', $wgt_post_limit); } echo '<label for="wgt_post_limit">' . __('Maximum posts per blog (0 for unlimited)', 'diamond') . ':<br /><input id="wgt_post_limit" name="wgt_post_limit" type="text" value="' . $wgt_post_limit . '" /></label>'; echo '<br />'; }
function widget_controlView($is_admin = false) { global $DiamondCache; $options = get_option('diamond_bloglist_options'); // Title if ($_POST['diamond_bloglist_hidden']) { $option = $_POST['wgt_title']; $options['diamond_bloglist_title'] = $option; } $wgt_title = $options['diamond_bloglist_title']; echo '<input type="hidden" name="diamond_bloglist_hidden" value="success" />'; echo '<label for="wgt_title">' . __('Widget Title', 'diamond') . ':<br /><input id="wgt_title" name="wgt_title" type="text" value="' . $wgt_title . '" /></label>'; if ($_POST['diamond_bloglist_hidden']) { $DiamondCache->addSettings('bloglist', 'expire', $_POST['diamond_b_cache']); } $dccache = $DiamondCache->getSettings('bloglist', 'expire'); if ($dccache == '') { $dccache = 120; } echo '<br />'; echo '<label for="diamond_b_cache">' . __('Cache Expire Time (sec)', 'diamond') . ':<br /><input id="diamond_b_cache" name="diamond_b_cache" type="text" value="' . $dccache . '" /></label>'; // Count if ($_POST['diamond_bloglist_hidden']) { $option = $_POST['wgt_count']; $options['diamond_bloglist_count'] = $option; } $wgt_count = $options['diamond_bloglist_count']; echo '<br /><label for="wgt_number">' . __('Blogs count', 'diamond') . ':<br /><input id="wgt_count" name="wgt_count" type="text" value="' . $wgt_count . '" /></label>'; // miss blogs if ($_POST['diamond_bloglist_hidden']) { $option = $_POST['wgt_miss']; $tmp = ''; $sep = ''; if (isset($option) && $option != '') { foreach ($option as $op) { $tmp .= $sep . $op; $sep = ';'; } } $options['diamond_bloglist_miss'] = $tmp; } $wgt_miss = $options['diamond_bloglist_miss']; $miss = split(';', $wgt_miss); echo '<br /><label for="wgt_miss">' . __('Exclude blogs: (The first 50 blogs)', 'diamond'); $blog_list = get_blog_list(0, 50); echo '<br />'; foreach ($blog_list as $blog) { echo '<input id="wgt_miss_' . $blog['blog_id'] . '" name="wgt_miss[]" type="checkbox" value="' . $blog['blog_id'] . '" '; if (in_array($blog['blog_id'], $miss)) { echo ' checked="checked" '; } echo ' />'; echo get_blog_option($blog['blog_id'], 'blogname'); echo '<br />'; } echo '</label>'; // whitelist if ($_POST['diamond_bloglist_hidden']) { $option = $_POST['wgt_white']; $tmp = ''; $sep = ''; if (isset($option) && $option != '') { foreach ($option as $op) { $tmp .= $sep . $op; $sep = ';'; } } $options['diamond_bloglist_white'] = $tmp; } $wgt_miss = $options['diamond_bloglist_white']; $miss = split(';', $wgt_miss); echo '<br /><label for="wgt_white">' . __('Whitelist: (The first 50 blogs)', 'diamond'); $blog_list = get_blog_list(0, 50); echo '<br />'; foreach ($blog_list as $blog) { echo '<input id="wgt_white_' . $blog['blog_id'] . '" name="wgt_white[]" type="checkbox" value="' . $blog['blog_id'] . '" '; if (in_array($blog['blog_id'], $miss)) { echo ' checked="checked" '; } echo ' />'; echo get_blog_option($blog['blog_id'], 'blogname'); echo '<br />'; } echo '</label>'; // Format if ($_POST['diamond_bloglist_hidden']) { $option = $_POST['wgt_format']; if (!isset($option) || $option == '') { $option = '<strong>{title}</strong>'; } $options['diamond_bloglist_format'] = get_format_code($option); } $wgt_format = htmlentities(str_replace('\\"', '"', get_format_txt($options['diamond_bloglist_format']))); echo '<label for="wgt_number">' . __('Format string', 'diamond') . ':<br /><input id="wgt_format" name="wgt_format" type="text" value="' . $wgt_format . '" /></label><br />'; echo '{title} - ' . __('The blog\'s title', 'diamond') . '<br />'; echo '{title_txt} - ' . __('The blog\'s title', 'diamond') . ' ' . __('(without link)', 'diamond') . '<br />'; echo '{description} - ' . __('The blog\'s description', 'diamond') . '<br />'; echo '{reg} - ' . __('The registration\'s date', 'diamond') . '<br />'; echo '{last_update} - ' . __('The blog\'s last update date', 'diamond') . '<br />'; echo '{avatar} - ' . __('Author\'s avatar', 'diamond') . '<br />'; echo '{postcount} - ' . __('The blog\'s posts count', 'diamond') . '<br />'; echo '{comment_count} - ' . __('The blog\'s comment count - only works with Order by comment count', 'diamond') . '<br />'; echo '{more} - ' . __('The "Read More" link', 'diamond') . '<br />'; echo '<br />'; if ($_POST['diamond_bloglist_hidden']) { $options['diamond_bloglist_order'] = $_POST['diamond_bloglist_order']; } if (!$options['diamond_bloglist_order'] || $options['diamond_bloglist_order'] == '') { $options['diamond_bloglist_order'] = 0; } $dor = $options['diamond_bloglist_order']; if ($_POST['diamond_bloglist_hidden']) { $options['diamond_bloglist_order_by'] = $_POST['diamond_bloglist_order_by']; } if (!$options['diamond_bloglist_order_by'] || $options['diamond_bloglist_order_by'] == '') { $options['diamond_bloglist_order_by'] = 0; } $dorb = $options['diamond_bloglist_order_by']; echo '<label for="diamond_bloglist_order">' . __('Sort Order', 'diamond') . ':<br />'; echo '</label>'; echo '<select id="diamond_bloglist_order" name="diamond_bloglist_order">'; echo '<option value="0" ' . ($dor == 0 ? 'selected="selected"' : '') . '>' . __('By Domain', 'diamond') . '</option>'; echo '<option value="1" ' . ($dor == 1 ? 'selected="selected"' : '') . '>' . __('By Reg. Date', 'diamond') . '</option>'; echo '<option value="2" ' . ($dor == 2 ? 'selected="selected"' : '') . '>' . __('By Last Update', 'diamond') . '</option>'; echo '<option value="3" ' . ($dor == 3 ? 'selected="selected"' : '') . '>' . __('By Post Count', 'diamond') . '</option>'; echo '<option value="4" ' . ($dor == 4 ? 'selected="selected"' : '') . '>' . __('By Comment Count', 'diamond') . '</option>'; echo '</select>'; echo '<select id="diamond_bloglist_order_by" name="diamond_bloglist_order_by">'; echo '<option value="0" ' . ($dorb == 0 ? 'selected="selected"' : '') . '>' . __('Ascending', 'diamond') . '</option>'; echo '<option value="1" ' . ($dorb == 1 ? 'selected="selected"' : '') . '>' . __('Descending', 'diamond') . '</option>'; echo '</select>'; echo '<br />'; echo '<br />'; if ($_POST['diamond_bloglist_hidden']) { $option = $_POST['wgt_mtext']; if (!isset($option) || $option == '') { $option = __('Read More', 'diamond'); } $options['diamond_bloglist_mtext'] = $option; } $wgt_mtext = $options['diamond_bloglist_mtext']; echo '<label for="wgt_mtext">' . __('"Read More" link text', 'diamond') . ':<br /><input id="wgt_mtext" name="wgt_mtext" type="text" value="' . $wgt_mtext . '" /></label>'; echo '<br />'; if ($_POST['diamond_bloglist_hidden']) { $option = $_POST['wgt_dt']; $options['diamond_bloglist_dt'] = $option; } $wgt_dt = $options['diamond_bloglist_dt']; if (!isset($wgt_dt) || trim($wgt_dt) == '') { $wgt_dt = __('M. d. Y.', 'diamond'); $options['diamond_bloglist_dt'] = $wgt_dt; } echo '<label for="wgt_dt">' . __('DateTime format (<a href="http://php.net/manual/en/function.date.php" target="_blank">manual</a>)', 'diamond') . ':<br /><input id="wgt_dt" name="wgt_dt" type="text" value="' . $wgt_dt . '" /></label>'; echo '<br />'; if ($_POST['diamond_bloglist_hidden']) { $option = $_POST['wgt_min_post_count']; $options['diamond_bloglist_min_post_count'] = $option; } $wgt_diamond_bloglist_min_post_count = $options['diamond_bloglist_min_post_count']; if (!isset($wgt_diamond_bloglist_min_post_count) || trim($wgt_diamond_bloglist_min_post_count) == '') { $wgt_diamond_bloglist_min_post_count = ''; $options['diamond_bloglist_min_post_count'] = $wgt_diamond_bloglist_min_post_count; } echo '<label for="wgt_min_post_count">' . __('The minimum number of posts that the blog should contain to be listed', 'diamond') . ':<br /><input id="wgt_min_post_count" name="wgt_min_post_count" type="text" value="' . $wgt_diamond_bloglist_min_post_count . '" /></label>'; echo '<br />'; if ($_POST['diamond_bloglist_hidden']) { $option = $_POST['wgt_comment_age']; $options['diamond_bloglist_comment_age'] = $option; } $wgt_diamond_bloglist_comment_age = $options['diamond_bloglist_comment_age']; if (!isset($wgt_diamond_bloglist_comment_age) || trim($wgt_diamond_bloglist_comment_age) == '') { $wgt_diamond_bloglist_comment_age = ''; $options['diamond_bloglist_comment_age'] = $wgt_diamond_bloglist_comment_age; } echo '<label for="wgt_comment_age">' . __('The maximum ages of comments in days if using order by comment count', 'diamond') . ':<br /><input id="wgt_comment_age" name="wgt_comment_age" type="text" value="' . $wgt_diamond_bloglist_comment_age . '" /></label>'; echo '<br />'; if ($_POST['diamond_bloglist_hidden']) { update_option('diamond_bloglist_options', $options); } if (!$is_admin) { echo '<br />'; _e('if you like this widget then', 'diamond'); echo ': <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40amegrant%2ehu&lc=HU&item_name=Diamond%20Multisite%20WordPress%20Widget¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted" target="_blank">'; _e('Buy me a beer!', 'diamond'); echo '</a><br />'; } }