Пример #1
0
 function init()
 {
     global $wp_version;
     global $advman_engine;
     $ads = $advman_engine->getAds();
     if (!empty($ads)) {
         $widgets = array();
         foreach ($ads as $id => $ad) {
             if (!empty($ad->name)) {
                 $i = substr(md5($ad->name), 0, 10);
                 $widgets[$i] = $ad;
             }
         }
         foreach ($widgets as $id => $ad) {
             $n = __('Ad: ', 'advman') . $ad->name;
             $description = __('An ad from the Advertising Manager plugin');
             $args = array('name' => $n, 'description' => $description);
             if (function_exists('wp_register_sidebar_widget')) {
                 //$id, $name, $output_callback, $options = array()
                 wp_register_sidebar_widget("advman-{$id}", $n, array('Advman_Widget', 'widget'), $args, $ad->name);
                 wp_register_widget_control("advman-{$id}", $n, array('Advman_Widget', 'widget_control'), null, null, $ad->name);
             } elseif (function_exists('register_sidebar_module')) {
                 register_sidebar_module($n, array('Advman_Widget', 'sbm_widget'), "advman-{$id}", $args);
                 register_sidebar_module_control($n, array('Advman_Widget', 'widget_control'), "advman-{$id}");
             }
         }
     }
 }
Пример #2
0
{
    if (isset($_POST['latest_posts_module'])) {
        sbm_update_option('hide_asides', isset($_POST['latest_posts_module']['hide_asides']));
        if (isset($_POST['latest_posts_module']['num_posts'])) {
            sbm_update_option('num_posts', $_POST['latest_posts_module']['num_posts']);
        }
    }
    ?>
		<p><label for="latest-posts-module-num-posts"><?php 
    _e('Number of posts:', 'k2_domain');
    ?>
</label> <input id="latest-posts-module-num-posts" name="latest_posts_module[num_posts]" type="text" value="<?php 
    echo sbm_get_option('num_posts');
    ?>
" size="2" /></p>

		<p><label for="latest-posts-module-hide-asides"><?php 
    _e('Exclude Asides from list:', 'k2_domain');
    ?>
</label> <input id="latest-posts-module-hide-asides" name="latest_posts_module[hide_asides]" type="checkbox"<?php 
    if (sbm_get_option('hide_asides')) {
        ?>
 checked="checked"<?php 
    }
    ?>
 /></p>
	<?php 
}
register_sidebar_module('Latest Posts', 'latest_posts_sidebar_module', 'sb-latest', array('num_posts' => 10, 'hide_asides' => false));
register_sidebar_module_control('Latest Posts', 'latest_posts_sidebar_module_control');
Пример #3
0
function wpsb_widget_init()
{
    global $wp_version;
    if (!function_exists('register_sidebar_widget')) {
        return;
    }
    function wpsb_widget($args)
    {
        extract($args);
        echo $before_widget . $before_title;
        echo get_option('wpsb_widget_title');
        echo $after_title;
        wpsb_opt_in();
        echo $after_widget;
    }
    function wpsb_widget_control()
    {
        $title = get_option('wpsb_widget_title');
        if ($_POST['wpsb_submit']) {
            $title = stripslashes($_POST['wpsb_widget_title']);
            update_option('wpsb_widget_title', $title);
        }
        echo '<p>Title:<input  style="width: 200px;" type="text" value="';
        echo $title . '" name="wpsb_widget_title" id="wpsb_widget_title" /></p>';
        echo '<input type="hidden" id="wpsb_submit" name="wpsb_submit" value="1" />';
    }
    $width = 300;
    $height = 100;
    if ('2.2' == $wp_version || !function_exists('wp_register_sidebar_widget')) {
        register_sidebar_widget('WP Sendblaster Opt-in', 'wpsb_widget');
        register_widget_control('WP Sendblaster Opt-in', 'wpsb_widget_control', $width, $height);
    } else {
        // v2.2.1+
        $size = array('width' => $width, 'height' => $height);
        $class = array('classname' => 'wpsb_opt_in');
        // css classname
        wp_register_sidebar_widget('wpsb', 'WP Sendblaster Opt-in', 'wpsb_widget', $class);
        wp_register_widget_control('wpsb', 'WP Sendblaster Opt-in', 'wpsb_widget_control', $size);
    }
    if (function_exists('register_sidebar_module')) {
        $class = array('classname' => 'wpsb_opt_in');
        // css classname
        register_sidebar_module('WP Sendblaster Opt-in', 'wpsb_widget', '', $class);
        register_sidebar_module_control('WP Sendblaster Opt-in', 'wpsb_widget_control');
    }
}
 function register_widget($name, $args)
 {
     if (function_exists('wp_register_sidebar_widget')) {
         //$id, $name, $output_callback, $options = array()
         wp_register_sidebar_widget('adsensem-' . $name, "Ad#{$name}", array('adsensem', 'widget'), $args, $name);
         wp_register_widget_control('adsensem-' . $name, "Ad#{$name}", array('adsensem', 'widget_control'), $args, $name);
     } else {
         if (function_exists('register_sidebar_module')) {
             register_sidebar_module('Ad #' . $name, 'adsensem_sbm_widget', 'adsensem-' . $name, $args);
             register_sidebar_module_control('Ad #' . $name, array('adsensem', 'widget_control'), 'adsensem-' . $name);
         }
     }
 }
Пример #5
0
<?php

function php_sidebar_module($args)
{
    extract($args);
    echo $before_module . $before_title . $title . $after_title;
    eval(' ?>' . sbm_get_option('code') . '<?php ');
    echo $after_module;
}
function php_sidebar_module_control()
{
    if (isset($_POST['php_module_code'])) {
        sbm_update_option('code', stripslashes($_POST['php_module_code']));
    }
    ?>
		<p>
			<label for="php-module-code"><?php 
    _e('Module\'s code:', 'k2_domain');
    ?>
</label><br />
			<textarea id="php-module-code" name="php_module_code" rows="6" cols="30"><?php 
    echo wp_specialchars(htmlspecialchars(sbm_get_option('code'), ENT_QUOTES), 1);
    ?>
</textarea>
		</p>
	<?php 
}
register_sidebar_module('Text, HTML and PHP', 'php_sidebar_module', 'sb-php');
register_sidebar_module_control('Text, HTML and PHP', 'php_sidebar_module_control');
Пример #6
0
    if (sbm_get_option('hide_trackbacks')) {
        ?>
 checked="checked"<?php 
    }
    ?>
 /></p>

	<?php 
    if (function_exists('blc_latest_comments')) {
        ?>
		<p><label for="recent-comments-module-new-color"><?php 
        _e('Newest color:', 'k2_domain');
        ?>
</label> <input id="recent-comments-module-new-color" name="latest_comments_module[new_color]" type="text" value="<?php 
        echo sbm_get_option('new_color');
        ?>
" size="7" /></p>

		<p><label for="recent-comments-module-old-color"><?php 
        _e('Oldest color:', 'k2_domain');
        ?>
</label> <input id="recent-comments-module-old-color" name="latest_comments_module[old_color]" type="text" value="<?php 
        echo sbm_get_option('old_color');
        ?>
" size="7" /></p>
	<?php 
    }
}
register_sidebar_module('Latest Comments', 'latest_comments_sidebar_module', 'sb-comments' . (function_exists('blc_latest_comments') ? ' sb-comments-blc' : ''), array('num_posts' => 5, 'num_comments' => 10, 'hide_trackbacks' => false, 'new_color' => '#444444', 'old_color' => '#cccccc'));
register_sidebar_module_control('Latest Comments', 'latest_comments_sidebar_module_control');
Пример #7
0
function ec3_k2mod_list_control()
{
    if (isset($_POST['ec3_module_limit'])) {
        sbm_update_option('limit', $_POST['ec3_module_limit']);
    }
    ?>
  <p>
   <label for="ec3-module-num-events">
    <?php 
    _e('Number of events:', 'ec3');
    ?>
   </label>
   <input id="ec3-module-num-events" name="ec3_module_limit"
    type="text" value="<?php 
    echo sbm_get_option('limit');
    ?>
" size="4" />
  </p>
  <p>
   <a href="options-general.php?page=ec3_admin">
    <?php 
    _e('Go to Event Calendar Options', 'ec3');
    ?>
.
   </a>
  </p>
  <?php 
}
register_sidebar_module(__('Upcoming Events', 'ec3'), 'ec3_k2mod_list', '', array('limit' => 5));
register_sidebar_module_control(__('Upcoming Events', 'ec3'), 'ec3_k2mod_list_control');
Пример #8
0
		<?php 
        }
        echo $after_module;
    }
}
function about_sidebar_module_control()
{
    if (isset($_POST['about_module_blurp'])) {
        sbm_update_option('aboutblurp', $_POST['about_module_blurp']);
    }
    ?>
		<p>
			<label for="about-module-blurp"><?php 
    _e('About Text:', 'k2_domain');
    ?>
</label><br />
			<textarea id="about-module-blurp" name="about_module_blurp" rows="6" cols="30"><?php 
    echo wp_specialchars(htmlspecialchars(stripslashes(sbm_get_option('aboutblurp')), ENT_QUOTES), 1);
    ?>
</textarea><br />
			<small><?php 
    _e('Enter a blurp about yourself here, and it will show up on the frontpage. Deleting the content disables the about blurp.', 'k2_domain');
    ?>
</small>
		</p>
	<?php 
}
register_sidebar_module('About Current Page', 'about_sidebar_module', 'sb-about', array('aboutblurp' => ''));
register_sidebar_module_control('About Current Page', 'about_sidebar_module_control');
Пример #9
0
<?php

if (function_exists('wp_tag_cloud')) {
    function wptagcloud_sidebar_module($args)
    {
        extract($args);
        echo $before_module . $before_title . $title . $after_title;
        if (function_exists('UTW_ShowWeightedTagSetAlphabetical')) {
            echo 'test1234';
            UTW_ShowWeightedTagSetAlphabetical("coloredsizedtagcloud");
        } else {
            if (function_exists('wp_tag_cloud')) {
                wp_tag_cloud('format=list');
            }
        }
        echo $after_module;
    }
    function wptagcloud_sidebar_module_control()
    {
        if (isset($_POST['wptagcloud_module_blurp'])) {
            sbm_update_option('wptagcloud', $_POST['wptagclod_module_blurp']);
        }
    }
    register_sidebar_module('Tag Cloud', 'wptagcloud_sidebar_module', 'sb-wptagcloud', array('wptagcloud' => ''));
    register_sidebar_module_control('Tag Cloud', 'wptagcloud_sidebar_module_control');
}
Пример #10
0
            edit_post_link(__('Edit', 'k2_domain'), '<span class="entry-edit">', '</span>');
            ?>
			</div>
			<?php 
        }
        /* end asides loop */
        ?>
		</div>
<?php 
        echo $after_module;
    }
    /* end asides check */
}
function asides_sidebar_module_control()
{
    if (isset($_POST['asides_module_num_posts'])) {
        sbm_update_option('num_posts', $_POST['asides_module_num_posts']);
    }
    ?>
		<p><label for="asides-module-num-posts"><?php 
    _e('Number of posts:', 'k2_domain');
    ?>
</label> <input id="asides-module-num-posts" name="asides_module_num_posts" type="text" value="<?php 
    echo sbm_get_option('num_posts');
    ?>
" size="2" /></p>
	<?php 
}
register_sidebar_module('Asides', 'asides_sidebar_module', 'sb-asides', array('num_posts' => 3));
register_sidebar_module_control('Asides', 'asides_sidebar_module_control');
Пример #11
0
    }
    if (isset($_POST['rss_module_num_items'])) {
        sbm_update_option('num_items', $_POST['rss_module_num_items']);
    }
    ?>
		<p><label for="rss-module-feed"><?php 
    _e('RSS feed\'s URL:', 'k2_domain');
    ?>
</label> <input id="rss-module-feed" name="rss_module_feed" type="text" value="<?php 
    echo sbm_get_option('feed');
    ?>
" /></p>
		<p><label for="rss-module-icon"><?php 
    _e('RSS feed\'s icon:', 'k2_domain');
    ?>
</label> <input id="rss-module-icon" name="rss_module_icon" type="text" value="<?php 
    echo sbm_get_option('icon');
    ?>
" /></p>
		<p><label for="rss-module-num-items"><?php 
    _e('Number of items:', 'k2_domain');
    ?>
</label> <input id="rss-module-num-items" name="rss_module_num_items" type="text" value="<?php 
    echo sbm_get_option('num_items');
    ?>
" size="2" /></p>
	<?php 
}
register_sidebar_module('RSS', 'rss_sidebar_module', 'sb-feed', array('num_items' => '10'));
register_sidebar_module_control('RSS', 'rss_sidebar_module_control');
Пример #12
0
        ?>
		<div class="sb-pagemenu">
			<a href="<?php 
        echo get_permalink($post->post_parent);
        ?>
" rev="attachment"><?php 
        printf(__('Back to \'%s\'', 'k2_domain'), get_the_title($post->post_parent));
        ?>
</a>
		</div>
	<?php 
    }
}
function nav_sidebar_module_control()
{
    if (isset($_POST['nav_sidebar_module_custom_title'])) {
        sbm_update_option('custom_title', $_POST['nav_sidebar_module_custom_title']);
    }
    ?>
		<p><label for="nav-sidebar-module-custom-title"><?php 
    _e('Navigation heading:', 'k2_domain');
    ?>
</label> <input id="nav-sidebar-module-custom-title" name="nav_sidebar_module_custom_title" type="text" value="<?php 
    echo sbm_get_option('custom_title');
    ?>
" size="30" /></p>
	<?php 
}
register_sidebar_module('Page Menu', 'nav_sidebar_module', 'sb-pagemenu', array('custom_title' => __('%s Subpages', 'k2_domain')));
register_sidebar_module_control('Page Menu', 'nav_sidebar_module_control');