Exemplo n.º 1
1
 public static function mkGUI($type, $title, $question, $info = FALSE, $except = FALSE, $list = FALSE, $name = NULL)
 {
     $DW =& $GLOBALS['DW'];
     $list = self::getAuthors();
     if ($info) {
         self::$opt = $DW->getDWOpt($GLOBALS['widget_id'], 'single-author');
         if (count($list) > DW_LIST_LIMIT) {
             $select_style = DW_LIST_STYLE;
         }
         if (count($list) > 0) {
             $DW->dumpOpt(self::$opt);
             echo '<br />';
             _e(self::$except, DW_L10N_DOMAIN);
             echo '<br />';
             echo '<div id="single-author-select" class="condition-select" ' . (isset($select_style) ? $select_style : '') . ' />';
             foreach ($list as $key => $value) {
                 $extra = 'onclick="ci(\'single_author_act_' . $key . '\')"';
                 echo '<input type="checkbox" id="single_author_act_' . $key . '" name="single_author_act[]" value="' . $key . '" ' . (self::$opt->count > 0 && in_array($key, self::$opt->act) ? 'checked="checked"' : '') . $extra . ' /> <label for="single_author_act_' . $key . '">' . $value . '</label><br />' . "\n";
             }
             echo '</div>' . "\n";
         }
     } else {
         parent::mkGUI(self::$type, self::$option[self::$name], self::$question, FALSE, self::$except, $list);
     }
 }
Exemplo n.º 2
0
 public static function admin()
 {
     $DW =& $GLOBALS['DW'];
     $widget_id = $GLOBALS['widget_id'];
     parent::admin();
     if (self::detect()) {
         $list = self::getBPcomponents();
         // BP components
         self::mkGUI(self::$type, self::$option['bp'], self::$question, self::$info, self::$except, $list, 'bp');
         // BP Groups
         if ($DW->bp_groups) {
             self::$question = 'Show widget default on BuddyPress Group pages?';
             self::GUIHeader(self::$option['bp-group'], self::$question, NULL, NULL, $DW->getDWOpt($widget_id, 'bp-group'), 'bp-group');
             self::GUIOption('bp-group', $DW->getDWOpt($widget_id, 'bp-group'));
             echo '<table border="0" cellspacing="0" cellpadding="0">';
             echo '<tr><td valign="top">';
             self::$except = 'Except in the groups';
             $list = self::getBPgroups();
             self::GUIComplex(self::$except, $list, NULL, 'bp-group');
             echo '</td><td style="width:10px"></td><td valign="top">';
             self::$except = 'Except in the group pages';
             $list = array('forum_index' => __('Forum Index', DW_L10N_DOMAIN), 'forum_topic' => __('Forum Topics', DW_L10N_DOMAIN), 'members_index' => __('Members Index', DW_L10N_DOMAIN));
             self::GUIComplex(self::$except, $list, NULL, 'bp_group');
             echo '</td></tr></table>';
             self::GUIFooter();
         }
     }
 }
Exemplo n.º 3
0
 public static function admin()
 {
     $DW =& $GLOBALS['DW'];
     parent::admin();
     $list = array('desktop' => __('Desktop'), 'mobile' => __('Mobile'));
     self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $list);
 }
Exemplo n.º 4
0
 public static function admin()
 {
     parent::admin();
     if (self::detect()) {
         self::mkGUI('simple', self::$option['bbp_profile'], self::$question, FALSE, FALSE, FALSE, 'bbp_profile');
     }
 }
Exemplo n.º 5
0
 public static function admin()
 {
     parent::admin();
     for ($i = 1; $i < 53; $i++) {
         $weeks[$i] = 'Week ' . $i;
     }
     self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $weeks);
 }
Exemplo n.º 6
0
 public static function admin()
 {
     $DW =& $GLOBALS['DW'];
     parent::admin();
     if (self::detect()) {
         $list = self::getWPSCcategories();
         self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $lists);
     }
 }
Exemplo n.º 7
0
 public static function admin()
 {
     $DW = $GLOBALS['DW'];
     parent::admin();
     self::$opt = $DW->getDWOpt($_GET['id'], self::$name);
     self::GUIHeader(self::$option[self::$name], self::$question, FALSE);
     self::GUIOption();
     self::GUIComplex();
     self::GUIFooter();
 }
 public static function admin()
 {
     parent::admin();
     $list = array(1 => __('First page'));
     if (get_option('show_on_front') == 'page') {
         self::$option = array('front-page' => 'Posts Page');
         self::$question = 'Show widget on the posts page?';
     }
     self::mkGUI(self::$type, self::$option[self::$name], self::$question, NULL, self::$except, $list);
 }
Exemplo n.º 9
0
 public static function admin()
 {
     parent::admin();
     $list = array();
     $tags = get_tags(array('hide_empty' => FALSE));
     foreach ($tags as $t) {
         $list[$t->term_id] = $t->name;
     }
     self::mkGUI(self::$type, self::$option[self::$name], self::$question, FALSE, self::$except, $list);
 }
Exemplo n.º 10
0
 public static function admin()
 {
     parent::admin();
     if (self::detect()) {
         $list = array();
         $qt_langs = get_option('qtranslate_enabled_languages');
         foreach ($qt_langs as $code) {
             $list[$code] = self::getQTLanguage($code);
         }
         self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $list);
     }
 }
Exemplo n.º 11
0
 public static function admin()
 {
     $DW =& $GLOBALS['DW'];
     parent::admin();
     $list = array();
     $wp_roles = $GLOBALS['wp_roles'];
     $roles = array_merge($wp_roles->role_names, array('anonymous' => __('Anonymous') . '|User role'));
     foreach ($roles as $rid => $role) {
         $list[esc_attr($rid)] = translate_user_role($role);
     }
     self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $list);
 }
Exemplo n.º 12
0
 public static function admin()
 {
     parent::admin();
     $tpl = get_page_templates();
     if (count($tpl) > 0) {
         $list = array();
         foreach ($tpl as $tplname => $tplfile) {
             $list[basename($tplfile)] = $tplname;
         }
         self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $list);
     }
 }
Exemplo n.º 13
0
 public static function admin()
 {
     parent::admin();
     $days = array();
     $daysec = 86400;
     $start = mktime(0, 0, 1, 7, 29, 2012);
     // We take a random Sunday - Go figure when I added this functionality
     $end = $start + 8 * $daysec;
     for ($i = $start; $i < $end; $i += $daysec) {
         $days[date('N', $i)] = date('l', $i);
     }
     self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $days);
 }
 public static function admin()
 {
     $wpdb =& $GLOBALS['wpdb'];
     parent::admin();
     if (self::detect()) {
         $query = "SELECT id, uri FROM " . $wpdb->prefix . "pod_pages ORDER BY uri";
         $results = $wpdb->get_results($query);
         $list = array();
         foreach ($results as $row) {
             $list[$row->id] = $row->uri;
         }
         self::mkGUI(self::$type, self::$option[self::$name], self::$question, FALSE, self::$except, $list);
     }
 }
Exemplo n.º 15
0
 public static function admin()
 {
     parent::admin();
     if (self::detect()) {
         $wpml_api = ICL_PLUGIN_PATH . DW_WPML_API;
         require_once $wpml_api;
         $list = array();
         $wpml_langs = wpml_get_active_languages();
         foreach ($wpml_langs as $lang) {
             $code = $lang['code'];
             $list[$code] = $lang['display_name'];
         }
         self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $list);
     }
 }
Exemplo n.º 16
0
 public static function admin()
 {
     $wpdb =& $GLOBALS['wpdb'];
     parent::admin();
     if (self::detect()) {
         if (function_exists('pods_api')) {
             $results = pods_api()->load_pages();
         } else {
             $query = "SELECT id, uri AS name FROM " . $wpdb->prefix . "pod_pages ORDER BY uri";
             $results = $wpdb->get_results($query, ARRAY_A);
         }
         $list = array();
         foreach ($results as $row) {
             $list[$row['id']] = $row['name'];
         }
         self::mkGUI(self::$type, self::$option[self::$name], self::$question, FALSE, self::$except, $list);
     }
 }
Exemplo n.º 17
0
 public static function registerOption($dwoption)
 {
     // $dwoption not used, but needs to be in the argument list for strict PHP reasons (see Mantis #174).
     $option = array('cp_archive' => 'Custom Post Type Archives');
     // Adding Custom Post Types to $DW->dwoptions
     $args = array('public' => TRUE, '_builtin' => FALSE);
     $post_types = get_post_types($args, 'objects', 'and');
     foreach ($post_types as $type => $ctid) {
         $option[$type] = $ctid->label;
     }
     // Adding Custom Taxonomies to $DW->dwoptions
     $taxonomy = get_taxonomies($args, 'objects', 'and');
     $taxonomy = apply_filters('dynwid_taxonomies', $taxonomy);
     foreach ($taxonomy as $tax_id => $tax) {
         $option['tax_' . $tax_id] = $tax->label;
     }
     parent::registerOption($option);
 }
    public static function admin()
    {
        $DW = $GLOBALS['DW'];
        parent::admin();
        $shortcode_yes_selected = 'checked="checked"';
        $opt_shortcode = $DW->getOpt($GLOBALS['widget_id'], 'shortcode');
        foreach ($opt_shortcode as $opt) {
            if ($opt->name == 'default') {
                $shortcode_no_selected = $shortcode_yes_selected;
                unset($shortcode_yes_selected);
            } else {
                $shortcode = unserialize($opt->value);
            }
        }
        ?>

			<h4 id="shortcode" title=" Click to toggle " class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"><b><?php 
        _e('Shortcode');
        ?>
</b><?php 
        echo count($opt_shortcode) > 0 ? ' <img src="' . $DW->plugin_url . 'img/checkmark.gif" alt="Checkmark" />' : '';
        ?>
</h4>
			<div id="shortcode_conf" class="dynwid_conf ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom">
			<?php 
        _e('Show widget when the shortcode ...', DW_L10N_DOMAIN);
        ?>
 <img src="<?php 
        echo $DW->plugin_url;
        ?>
img/info.gif" alt="info" title="<?php 
        _e('Click to toggle info', DW_L10N_DOMAIN);
        ?>
" onclick="divToggle('shortcode_info');" /><br />
			<?php 
        $DW->dumpOpt($opt_shortcode);
        ?>
			<div>
				<div id="shortcode_info" class="infotext">
					The shortcode is executed on the page where the widget is configured.<br />
					The match needs to be exact and is case sensative. So, "a match" is not "A match" is not "a Match".
				</div>
			</div>
			<br />
			<input type="radio" name="shortcode" value="yes" id="shortcode-yes" <?php 
        echo isset($shortcode_yes_selected) ? $shortcode_yes_selected : '';
        ?>
 /> <label for="shortcode-yes"><?php 
        _e('Yes');
        ?>
</label>
			<input type="radio" name="shortcode" value="no" id="shortcode-no" <?php 
        echo isset($shortcode_no_selected) ? $shortcode_no_selected : '';
        ?>
 /> <label for="shortcode-no"><?php 
        _e('No');
        ?>
</label><br />

			<?php 
        _e('Except when the...', DW_L10N_DOMAIN);
        ?>
:<br />
			Shortcode <input type="text" name="shortcode_value" value="<?php 
        echo isset($shortcode['value']) ? $shortcode['value'] : '';
        ?>
" />

			<select name="shortcode_operator">
			<?php 
        $options = array('=' => 'matches', '!=' => 'NOT matches');
        foreach ($options as $key => $value) {
            echo '<option value="' . $key . '"';
            echo isset($shortcode['operator']) && $shortcode['operator'] == $key ? ' selected="selected"' : '';
            echo '>' . $value . '</option>';
        }
        ?>
			</select>

			<input type="text" name="shortcode_match" value="<?php 
        echo isset($shortcode['match']) ? $shortcode['match'] : '';
        ?>
" />

			</div><!-- end dynwid_conf -->

<?php 
    }
    public static function admin()
    {
        $DW = $GLOBALS['DW'];
        parent::admin();
        $date_yes_selected = 'checked="checked"';
        $opt_date = $DW->getOpt($_GET['id'], 'date');
        if (count($opt_date) > 0) {
            foreach ($opt_date as $value) {
                switch ($value->name) {
                    case 'date_start':
                        $date_start = $value->value;
                        break;
                    case 'date_end':
                        $date_end = $value->value;
                        break;
                }
            }
            $date_no_selected = $date_yes_selected;
            unset($date_yes_selected);
        }
        ?>

<h4><b><?php 
        _e('Date');
        ?>
</b><?php 
        echo count($opt_date) > 0 ? ' <img src="' . $DW->plugin_url . 'img/checkmark.gif" alt="Checkmark" />' : '';
        ?>
</h4>
<div class="dynwid_conf">
<?php 
        _e('Show widget always?', DW_L10N_DOMAIN);
        ?>
 <img src="<?php 
        echo $DW->plugin_url;
        ?>
img/info.gif" alt="info" title="<?php 
        _e('Click to toggle info', DW_L10N_DOMAIN);
        ?>
" onclick="divToggle('date');" /><br />
<?php 
        $DW->dumpOpt($opt_date);
        ?>
<div>
	<div id="date" class="infotext">
  <?php 
        _e('Next to the above role option, the date option is also very powerfull. You\'ve been warned!', DW_L10N_DOMAIN);
        ?>
<br />
  <?php 
        _e('Enter dates in the YYYY-MM-DD format. You can also use the calender by clicking on the', DW_L10N_DOMAIN);
        ?>
 <img src="<?php 
        echo $DW->plugin_url;
        ?>
img/calendar.gif" alt="Calendar" /><br />
  <?php 
        _e('Date ranges can be made by entering a From AND a To date<br />
  					When you want the widget to be displayed from a specific date, only fill in the From date<br />
  					When you want the widget to stop displaying on a specific date, only fill in the To date.
  				', DW_L10N_DOMAIN);
        ?>
	</div>
</div>
<input type="radio" name="date" value="yes" id="date-yes" <?php 
        echo isset($date_yes_selected) ? $date_yes_selected : '';
        ?>
 onclick="swTxt(cDate, true);" /> <label for="date-yes"><?php 
        _e('Yes');
        ?>
</label>
<input type="radio" name="date" value="no" id="date-no" <?php 
        echo isset($date_no_selected) ? $date_no_selected : '';
        ?>
 onclick="swTxt(cDate, false)" /> <label for="date-no"><?php 
        _e('No');
        ?>
, <?php 
        _e('only', DW_L10N_DOMAIN);
        ?>
:</label><br />
<div id="date-select" class="condition-select">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
  <td style="width:45px;"><?php 
        _e('From', DW_L10N_DOMAIN);
        ?>
</td>
  <td><input id="date_start" type="text" name="date_start" value="<?php 
        echo isset($date_start) ? $date_start : '';
        ?>
" size="10" maxlength="10" /> <img src="<?php 
        echo $DW->plugin_url;
        ?>
img/calendar.gif" alt="Calendar" onclick="showCalendar('date_start')" /></td>
</tr>
<tr>
  <td style="width:45px;"><?php 
        _e('To', DW_L10N_DOMAIN);
        ?>
</td>
  <td><input id="date_end" type="text" name="date_end" value="<?php 
        echo isset($date_end) ? $date_end : '';
        ?>
" size="10" maxlength="10" /> <img src="<?php 
        echo $DW->plugin_url;
        ?>
img/calendar.gif" alt="Calendar" onclick="showCalendar('date_end')" /></td>
</tr>
</table>
</div>
</div><!-- end dynwid_conf -->

<script type="text/javascript">
/* <![CDATA[ */
  function showCalendar(id) {
    if ( jQuery('#date-no').is(':checked') ) {
      var id = '#'+id;
      jQuery(function() {
  		  jQuery(id).datepicker({
  		    dateFormat: 'yy-mm-dd',
  		    minDate: new Date(<?php 
        echo date('Y, n - 1, j');
        ?>
),
  		    onClose: function() {
  		    	jQuery(id).datepicker('destroy');
  		    }
  		  });
        jQuery(id).datepicker('show');
    	});
    } else {
      jQuery('#date-no').attr('checked', true);
      swTxt(cDate, false);
      showCalendar(id);
    }
  }

  var cDate =  new Array('date_start', 'date_end');

  if ( jQuery('#date-yes').is(':checked') ) {
  	swTxt(cDate, true);
  }
/* ]]> */
</script>
<?php 
    }
Exemplo n.º 20
0
    }
}
// WPML PLugin support
DWModule::save('wpml', 'complex');
// QTranslate Plugin support
DWModule::save('qt', 'complex');
// WPSC/WPEC Plugin support
DWModule::save('wpsc', 'complex');
// bbPress Plugin support
DWModule::save('bbp_profile', 'simple');
// BP Plugin support
DWModule::save('bp', 'complex');
// BP Plugin support (Groups)
DWModule::save('bp-group', 'complex');
// Pods Plugin support
DWModule::save('pods', 'complex');
// Redirect to ReturnURL
if (!empty($returnurl)) {
    $q = array();
    // Checking if there are arguments set
    $pos = strpos($returnurl, '?');
    if ($pos !== FALSE) {
        // evaluate the args
        $query_string = substr($returnurl, $pos + 1);
        $args = explode('&', $query_string);
        foreach ($args as $arg) {
            @(list($name, $value) = explode('=', $arg));
            if ($name != 'dynwid_save' && $name != 'widget_id') {
                $q[] = $name . '=' . $value;
            }
        }
 /**
  * DWModule::setName() Auto registering name to DWModule class
  *
  * @param string $classname Full classname
  */
 protected static function setName($classname)
 {
     self::$name = strtolower(substr($classname, 3));
     // Chop off the "DW_"
     self::$name = str_replace('_', '-', self::$name);
 }
Exemplo n.º 22
0
 public static function admin()
 {
     parent::admin();
     $list = array('gecko' => 'Firefox' . ' ' . __('(and other Gecko based)', DW_L10N_DOMAIN), 'msie' => 'Internet Explorer', 'msie6' => 'Internet Explorer 6', 'opera' => 'Opera', 'ns' => 'Netscape 4', 'safari' => 'Safari', 'chrome' => 'Chrome', 'undef' => __('Other / Unknown / Not detected', DW_L10N_DOMAIN));
     self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $list);
 }
    public static function admin()
    {
        $DW =& $GLOBALS['DW'];
        parent::admin();
        self::$opt = $DW->getDWOpt($_GET['id'], 'single');
        $authors = DW_Author::getAuthors();
        if (count($authors) > DW_LIST_LIMIT) {
            $author_condition_select_style = DW_LIST_STYLE;
        }
        $js_count = 0;
        $opt_single_author = $DW->getDWOpt($_GET['id'], 'single-author');
        $js_author_array = array();
        if ($opt_single_author->count > 0) {
            $js_count = $js_count + $opt_single_author->count - 1;
        }
        // -- Category
        $category = get_categories(array('hide_empty' => FALSE));
        if (count($category) > DW_LIST_LIMIT) {
            $category_condition_select_style = DW_LIST_STYLE;
        }
        // For JS
        $js_category_array = array();
        foreach ($category as $cat) {
            $js_category_array[] = '\'single_category_act_' . $cat->cat_ID . '\'';
            $js_category_array[] = '\'single_category_childs_act_' . $cat->cat_ID . '\'';
        }
        $catmap = DW_Category::getCatChilds(array(), 0, array());
        $opt_single_category = $DW->getDWOpt($_GET['id'], 'single-category');
        if ($opt_single_category->count > 0) {
            $js_count = $js_count + $opt_single_category->count - 1;
        }
        // -- Individual / Posts / Tags
        $opt_individual = $DW->getDWOpt($_GET['id'], 'individual');
        $opt_single_post = $DW->getDWOpt($_GET['id'], 'single-post');
        $opt_single_tag = $DW->getDWOpt($_GET['id'], 'single-tag');
        if ($opt_individual->count > 0) {
            $individual = TRUE;
            $count_individual = '(' . __('Posts: ', DW_L10N_DOMAIN) . $opt_single_post->count . ', ' . __('Tags: ', DW_L10N_DOMAIN) . $opt_single_tag->count . ')';
        }
        self::GUIHeader(self::$option[self::$name], self::$question, self::$info);
        self::GUIOption();
        // Individual
        $DW->dumpOpt($opt_individual);
        echo '<br />';
        echo '<input type="checkbox" id="individual" name="individual" value="1" ' . (isset($individual) && $individual ? 'checked="checked"' : '') . ' onclick="chkInPosts()" />';
        echo '<label for="individual">' . __('Make exception rule available to individual posts and tags.', DW_L10N_DOMAIN) . ' ' . ($opt_individual->count > 0 ? $count_individual : '') . '</label>';
        echo '<img src="' . $DW->plugin_url . 'img/info.gif" alt="info" title="' . __('Click to toggle info', DW_L10N_DOMAIN) . '" onclick="divToggle(\'individual_post_tag\')" />';
        echo '<div>';
        echo '<div id="individual_post_tag" class="infotext">';
        _e('When you enable this option, you have the ability to apply the exception rule for <em>Single Posts</em> to tags and individual posts.
								You can set the exception rule for tags in the single Edit Tag Panel (go to <a href="edit-tags.php?taxonomy=post_tag">Post Tags</a>,
								click a tag), For individual posts in the <a href="post-new.php">New</a> or <a href="edit.php">Edit</a> Posts panel.
								Exception rules for tags and individual posts in any combination work independantly, but will always be counted as one exception.<br />
		  					Please note when exception rules are set for Author and/or Category, these will be removed.
		  				', DW_L10N_DOMAIN);
        echo '</div></div>';
        // Individual posts and tags
        foreach ($opt_single_post->act as $singlepost) {
            echo '<input type="hidden" name="single_post_act[]" value="' . $singlepost . '" />';
        }
        foreach ($opt_single_tag->act as $tag) {
            echo '<input type="hidden" name="single_tag_act[]" value="' . $tag . '" />';
        }
        // JS array authors
        foreach (array_keys($authors) as $id) {
            $js_author_array[] = '\'single_author_act_' . $id . '\'';
        }
        ?>

<table border="0" cellspacing="0" cellpadding="0">
<tr>
  <td valign="top">
  	<?php 
        DW_Author::mkGUI(TRUE);
        ?>
  </td>
  <td style="width:10px"></td>
  <td valign="top">
  	<?php 
        $opt = $DW->getDWOpt($_GET['id'], 'single-category');
        ?>
  	<?php 
        $DW->dumpOpt($opt);
        ?>
		<?php 
        DW_Category::GUIComplex(TRUE, $opt);
        ?>
    </div>
  </td>
</tr>
</table>
<?php 
        self::GUIFooter();
        ?>
<script type="text/javascript">
/* <![CDATA[ */
  function chkInPosts() {
    var posts = <?php 
        echo $opt_single_post->count;
        ?>
;
    var tags = <?php 
        echo $opt_single_tag->count;
        ?>
;

    if ( (posts > 0 || tags > 0) && jQuery('#individual').is(':checked') == false ) {
      if ( confirm('Are you sure you want to disable the exception rule for individual posts and tags?\nThis will remove the options set to individual posts and/or tags for this widget.\nOk = Yes; No = Cancel') ) {
        swChb(cAuthors, false);
        swChb(cCat, false);
      } else {
        jQuery('#individual').attr('checked', true);
      }
    } else if ( icount > 0 && jQuery('#individual').is(':checked') ) {
      if ( confirm('Are you sure you want to enable the exception rule for individual posts and tags?\nThis will remove the exceptions set for Author and/or Category on single posts for this widget.\nOk = Yes; No = Cancel') ) {
        swChb(cAuthors, true);
        swChb(cCat, true);
        icount = 0;
      } else {
        jQuery('#individual').attr('checked', false);
      }
    } else if ( jQuery('#individual').is(':checked') ) {
        swChb(cAuthors, true);
        swChb(cCat, true);
    } else {
        swChb(cAuthors, false);
        swChb(cCat, false);
    }
  }

 	function ci(id) {
    if ( jQuery('#'+id).is(':checked') ) {
      icount++;
    } else {
      icount--;
    }
  }

  var icount = <?php 
        echo $js_count;
        ?>
;
  var cAuthors = new Array(<?php 
        echo implode(', ', $js_author_array);
        ?>
);
  var cCat = new Array(<?php 
        echo implode(', ', $js_category_array);
        ?>
);

  if ( jQuery('#individual').is(':checked') ) {
    swChb(cAuthors, true);
    swChb(cCat, true);
  }
/* ]]> */
</script>
<?php 
    }
Exemplo n.º 24
0
    public static function admin()
    {
        $DW = $GLOBALS['DW'];
        parent::admin();
        $url_yes_selected = 'checked="checked"';
        $opt_url = $DW->getOpt($_GET['id'], 'url');
        $prefix = $DW->getURLPrefix();
        foreach ($opt_url as $opt) {
            if ($opt->name == 'default') {
                $url_no_selected = $url_yes_selected;
                unset($url_yes_selected);
            } else {
                $urls = unserialize($opt->value);
            }
        }
        ?>
<h4 id="url" title=" Click to toggle " class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"><b><?php 
        _e('URL');
        ?>
</b><?php 
        echo count($opt_url) > 0 ? ' <img src="' . $DW->plugin_url . 'img/checkmark.gif" alt="Checkmark" />' : '';
        ?>
</h4>
<div id="url_conf" class="dynwid_conf ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom">
<?php 
        _e('Show widget at this URL?', DW_L10N_DOMAIN);
        ?>
 <img src="<?php 
        echo $DW->plugin_url;
        ?>
img/info.gif" alt="info" title="<?php 
        _e('Click to toggle info', DW_L10N_DOMAIN);
        ?>
" onclick="divToggle('url_info');" /><br />
<?php 
        $DW->dumpOpt($opt_url);
        ?>
<div>
	<div id="url_info" class="infotext">
		Separate URLs on each line.<br />
		Use an asterisk ( * ) at the end of an URL as 'Starts with'.<br /> 
		Use an asterisk at the start of an URL as 'Ends with'.<br />
		Using an asterisk at the start and end of an url means 'Somewhere within'.<br />
		Without any asterisk means 'Exact match'.<br />
		When you don't start with an asterisk, start with a slash ( / ).<br />
		Beware of double rules! Especially when you set the default to 'No'. This means the widget will be shown NOWHERE.
	</div>
</div>
<br />
<input type="radio" name="url" value="yes" id="url-yes" <?php 
        echo isset($url_yes_selected) ? $url_yes_selected : '';
        ?>
 /> <label for="url-yes"><?php 
        _e('Yes');
        ?>
</label>
<input type="radio" name="url" value="no" id="url-no" <?php 
        echo isset($url_no_selected) ? $url_no_selected : '';
        ?>
 /> <label for="url-no"><?php 
        _e('No');
        ?>
</label><br />
<?php 
        _e('Except the URLs', DW_L10N_DOMAIN);
        ?>
: <?php 
        echo !empty($prefix) ? '<br />Note: Do not include ' . $prefix : '';
        ?>
<br />
<div id="url-select" class="condition-select">
<textarea name="url_value" style="width:300px;height:150px;"><?php 
        echo isset($urls) ? implode("\n", $urls) : '';
        ?>
</textarea>
</div>

</div><!-- end dynwid_conf -->
<?php 
    }
Exemplo n.º 25
0
    public static function admin()
    {
        $DW =& $GLOBALS['DW'];
        $widget_id = $GLOBALS['widget_id'];
        parent::admin();
        self::$opt = $DW->getDWOpt($widget_id, 'single');
        $authors = DW_Author::getAuthors();
        if (count($authors) > DW_LIST_LIMIT) {
            $author_condition_select_style = DW_LIST_STYLE;
        }
        $js_count = 0;
        $opt_single_author = $DW->getDWOpt($widget_id, 'single-author');
        $js_author_array = array();
        if ($opt_single_author->count > 0) {
            $js_count = $js_count + $opt_single_author->count - 1;
        }
        // -- Category
        $category = get_categories(array('hide_empty' => FALSE));
        if (count($category) > DW_LIST_LIMIT) {
            $category_condition_select_style = DW_LIST_STYLE;
        }
        // For JS
        $js_category_array = array();
        foreach ($category as $cat) {
            $js_category_array[] = '\'single_category_act_' . $cat->cat_ID . '\'';
            $js_category_array[] = '\'single_category_childs_act_' . $cat->cat_ID . '\'';
        }
        $catmap = DW_Category::getCatChilds(array(), 0, array());
        $opt_single_category = $DW->getDWOpt($widget_id, 'single-category');
        if ($opt_single_category->count > 0) {
            $js_count = $js_count + $opt_single_category->count - 1;
        }
        $opt_single_post = $DW->getDWOpt($widget_id, 'single-post');
        $opt_single_tag = $DW->getDWOpt($widget_id, 'single-tag');
        self::GUIHeader(self::$option[self::$name], self::$question, self::$info);
        self::GUIOption();
        // Individual posts and tags
        foreach ($opt_single_post->act as $singlepost) {
            echo '<input type="hidden" name="single_post_act[]" value="' . $singlepost . '" />';
        }
        foreach ($opt_single_tag->act as $tag) {
            echo '<input type="hidden" name="single_tag_act[]" value="' . $tag . '" />';
        }
        // JS array authors
        foreach (array_keys($authors) as $id) {
            $js_author_array[] = '\'single_author_act_' . $id . '\'';
        }
        ?>

<table border="0" cellspacing="0" cellpadding="0">
<tr>
  <td valign="top">
  	<?php 
        DW_Author::mkGUI(self::$type, self::$option[self::$name], self::$question, TRUE);
        ?>
  </td>
  <td style="width:10px"></td>
  <td valign="top">
  	<?php 
        $opt = $DW->getDWOpt($widget_id, 'single-category');
        ?>
  	<?php 
        $DW->dumpOpt($opt);
        ?>
		<?php 
        DW_Category::GUIComplex(NULL, NULL, TRUE, $opt);
        ?>
    </div>
  </td>
</tr>
</table>
<?php 
        $type = 'post';
        $tax_list = get_object_taxonomies($type, 'objects');
        $tax_list = apply_filters('dynwid_taxonomies', $tax_list);
        foreach ($tax_list as $tax_type) {
            if ($tax_type->name != 'post_tag' && $tax_type->name != 'category') {
                // Prepare
                $opt_tax = $DW->getDWOpt($widget_id, 'single-tax_' . $tax_type->name);
                if ($tax_type->hierarchical) {
                    $opt_tax_childs = $DW->getDWOpt($widget_id, 'single-tax_' . $tax_type->name . '-childs');
                } else {
                    unset($opt_tax_childs);
                }
                $tax = get_terms($tax_type->name, array('get' => 'all'));
                if (count($tax) > 0) {
                    if (count($tax) > DW_LIST_LIMIT) {
                        $tax_condition_select_style = DW_LIST_STYLE;
                    }
                    $tree = DW_CustomPost::getTaxChilds($tax_type->name, array(), 0, array());
                    echo '<br />';
                    $DW->dumpOpt($opt_tax);
                    if (isset($opt_tax_childs)) {
                        $DW->dumpOpt($opt_tax_childs);
                    }
                    echo '<input type="hidden" name="single_tax_list[]" value="single-tax_' . $tax_type->name . '" />';
                    echo __('Except for', DW_L10N_DOMAIN) . ' ' . $tax_type->label . ':<br />';
                    echo '<div id="single-tax_' . $tax_type->name . '-select" class="condition-select" ' . (isset($tax_condition_select_style) ? $tax_condition_select_style : '') . '>';
                    echo '<div style="position:relative;left:-15px">';
                    if (!isset($opt_tax_childs)) {
                        $childs = FALSE;
                    } else {
                        $childs = $opt_tax_childs->act;
                    }
                    echo '<input type="hidden" id="single-tax_' . $tax_type->name . '_act" name="single-tax_' . $tax_type->name . '_act" value="' . implode(',', $opt_tax->act) . '" />';
                    if (isset($opt_tax_childs)) {
                        echo '<input type="hidden" id="single-tax_' . $tax_type->name . '_childs_act" name="single-tax_' . $tax_type->name . '_childs_act" value="' . implode(',', $opt_tax_childs->act) . '" />';
                    }
                    DW_CustomPost::prtTax($widget_id, $tax_type->name, $tree, $opt_tax->act, $childs, 'single-tax_' . $tax_type->name);
                    echo '</div>';
                    echo '</div>';
                }
            }
        }
        // foreach
        self::GUIFooter();
        ?>
<script type="text/javascript">
/* <![CDATA[ */
  function chkInPosts() {
    var posts = <?php 
        echo $opt_single_post->count;
        ?>
;
    var tags = <?php 
        echo $opt_single_tag->count;
        ?>
;

    if ( (posts > 0 || tags > 0) && jQuery('#individual').is(':checked') == false ) {
      if ( confirm('Are you sure you want to disable the exception rule for individual posts and tags?\nThis will remove the options set to individual posts and/or tags for this widget.\nOk = Yes; No = Cancel') ) {
        swChb(cAuthors, false);
        swChb(cCat, false);
      } else {
        jQuery('#individual').attr('checked', true);
      }
    } else if ( icount > 0 && jQuery('#individual').is(':checked') ) {
      if ( confirm('Are you sure you want to enable the exception rule for individual posts and tags?\nThis will remove the exceptions set for Author and/or Category on single posts for this widget.\nOk = Yes; No = Cancel') ) {
        swChb(cAuthors, true);
        swChb(cCat, true);
        icount = 0;
      } else {
        jQuery('#individual').attr('checked', false);
      }
    } else if ( jQuery('#individual').is(':checked') ) {
        swChb(cAuthors, true);
        swChb(cCat, true);
    } else {
        swChb(cAuthors, false);
        swChb(cCat, false);
    }
  }

 	function ci(id) {
    if ( jQuery('#'+id).is(':checked') ) {
      icount++;
    } else {
      icount--;
    }
  }

  var icount = <?php 
        echo $js_count;
        ?>
;
  var cAuthors = new Array(<?php 
        echo implode(', ', $js_author_array);
        ?>
);
  var cCat = new Array(<?php 
        echo implode(', ', $js_category_array);
        ?>
);

  if ( jQuery('#individual').is(':checked') ) {
    swChb(cAuthors, true);
    swChb(cCat, true);
  }

  if ( jQuery('#single-yes').is(':checked') && jQuery('#single_conf :checkbox').is(':checked')  ) {
  	jQuery('#single').append( ' <img src="<?php 
        echo $DW->plugin_url;
        ?>
img/checkmark.gif" alt="Checkmark" />' );
  }
/* ]]> */
</script>
<?php 
    }
Exemplo n.º 26
0
    public static function admin()
    {
        $DW = $GLOBALS['DW'];
        parent::admin();
        $ip_yes_selected = 'checked="checked"';
        $opt_ip = $DW->getOpt($GLOBALS['widget_id'], 'ip');
        foreach ($opt_ip as $opt) {
            if ($opt->name == 'default') {
                $ip_no_selected = $ip_yes_selected;
                unset($ip_yes_selected);
            } else {
                $ips = unserialize($opt->value);
            }
        }
        ?>
<h4 id="ip" title=" Click to toggle " class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"><b><?php 
        _e('IP Address');
        ?>
</b><?php 
        echo count($opt_ip) > 0 ? ' <img src="' . $DW->plugin_url . 'img/checkmark.gif" alt="Checkmark" />' : '';
        ?>
</h4>
<div id="ip_conf" class="dynwid_conf ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom">
<?php 
        _e('Show widget for this IP (range)?', DW_L10N_DOMAIN);
        ?>
 <img src="<?php 
        echo $DW->plugin_url;
        ?>
img/info.gif" alt="info" title="<?php 
        _e('Click to toggle info', DW_L10N_DOMAIN);
        ?>
" onclick="divToggle('ip_info');" /><br />
<?php 
        $DW->dumpOpt($opt_ip);
        ?>
<div>
	<div id="ip_info" class="infotext">
		Works only with IPv4, not IPv6! No checks are performed for overlapping addresses, invalid ranges, etc.<br />
		Separate IP (ranges) on each line.<br />
		<br />
		IP format notation can be...
		<div style="position:relative;left:20px;">
		<ul>
			<li>single IP: 192.168.1.1</li>
			<li>in <a href="http://en.wikipedia.org/wiki/Cidr" target="_blank">CIDR</a><sup> [WARNING: techie!]</sup> (recommended): 192.168.1.1/32, 192.168.1.0/24 or 192.168.1.0/255.255.255.0</li>
			<li>in wildcard: 192.168.1.*</li>
			<li>in range: 192.168.1.1-192.168.1.254</li>
		</ul>
		</div>
	</div>
</div>
<br />
<input type="radio" name="ip" value="yes" id="ip-yes" <?php 
        echo isset($ip_yes_selected) ? $ip_yes_selected : '';
        ?>
 /> <label for="ip-yes"><?php 
        _e('Yes');
        ?>
</label>
<input type="radio" name="ip" value="no" id="ip-no" <?php 
        echo isset($ip_no_selected) ? $ip_no_selected : '';
        ?>
 /> <label for="ip-no"><?php 
        _e('No');
        ?>
</label><br />
<?php 
        _e('Except the IP (ranges)', DW_L10N_DOMAIN);
        ?>
:<br />
<div id="ip-select" class="condition-select">
<textarea name="ip_value" style="width:300px;height:150px;"><?php 
        echo isset($ips) ? implode("\n", $ips) : '';
        ?>
</textarea>
</div>

</div><!-- end dynwid_conf -->
<?php 
    }
Exemplo n.º 27
0
    public static function admin()
    {
        $DW =& $GLOBALS['DW'];
        parent::admin();
        self::$opt = $DW->getDWOpt($GLOBALS['widget_id'], 'page');
        self::$opt_page = self::$opt;
        if (self::$opt->count > 0) {
            self::$opt_page_childs = $DW->getDWOpt($GLOBALS['widget_id'], 'page-childs');
        }
        $pages = get_pages(array('post_status' => 'publish,private'));
        $num_pages = count($pages);
        unset($pages);
        if ($num_pages < DW_PAGE_LIMIT) {
            $hierarchy = TRUE;
        } else {
            $hierarchy = FALSE;
        }
        // For childs we double the number of pages because of addition of 'All childs' option
        if ($hierarchy && $num_pages * 2 > DW_LIST_LIMIT || $num_pages > DW_LIST_LIMIT) {
            $page_condition_select_style = DW_LIST_STYLE;
        }
        self::$static_page = array();
        if (get_option('show_on_front') == 'page') {
            $id = get_option('page_on_front');
            self::$static_page[$id] = __('Front page', DW_L10N_DOMAIN);
            if (get_option('page_on_front') == get_option('page_for_posts')) {
                self::$static_page[$id] .= ', ' . __('Posts page', DW_L10N_DOMAIN);
            }
        }
        if ($num_pages < DW_PAGE_LIMIT) {
            $childs_infotext = self::infoText();
        } else {
            $childs_infotext = __('Unfortunately the childs-function has been disabled
						because you have more than the limit of pages.', DW_L10N_DOMAIN) . '(' . DW_PAGE_LIMIT . ')';
        }
        self::$info = $childs_infotext;
        self::GUIHeader(self::$option[self::$name], self::$question, self::$info);
        self::GUIOption();
        if ($num_pages > 0) {
            $DW->dumpOpt(self::$opt_page_childs);
            echo '<br />';
            _e('Except the page(s)', DW_L10N_DOMAIN);
            echo '<br />';
            echo '<div id="page-select" class="condition-select" ' . (isset($page_condition_select_style) ? $page_condition_select_style : '') . ' />';
            if ($num_pages < DW_PAGE_LIMIT) {
                wp_list_pages(array('title_li' => '', 'post_status' => 'publish,private', 'walker' => new DW_Page_Walker()));
            } else {
                wp_list_pages(array('title_li' => '', 'post_status' => 'publish,private', 'depth' => -1, 'walker' => new DW_Page_Walker()));
            }
            echo '</div>';
        }
        $tax_list = get_object_taxonomies('page', 'objects');
        foreach ($tax_list as $tax_type) {
            // Prepare
            $opt_tax = $DW->getDWOpt($_GET['id'], 'page-tax_' . $tax_type->name);
            if ($tax_type->hierarchical) {
                $opt_tax_childs = $DW->getDWOpt($_GET['id'], 'page-tax_' . $tax_type->name . '-childs');
            } else {
                unset($opt_tax_childs);
            }
            $tax = get_terms($tax_type->name, array('get' => 'all'));
            if (count($tax) > 0) {
                if (count($tax) > DW_LIST_LIMIT) {
                    $tax_condition_select_style = DW_LIST_STYLE;
                }
                $tree = DW_CustomPost::getTaxChilds($tax_type->name, array(), 0, array());
                echo '<br />';
                $DW->dumpOpt($opt_tax);
                if (isset($opt_tax_childs)) {
                    $DW->dumpOpt($opt_tax_childs);
                }
                echo '<input type="hidden" name="page_tax_list[]" value="page-tax_' . $tax_type->name . '" />';
                echo __('Except for', DW_L10N_DOMAIN) . ' ' . $tax_type->label . ':<br />';
                echo '<div id="page-tax_' . $tax_type->name . '-select" class="condition-select" ' . (isset($tax_condition_select_style) ? $tax_condition_select_style : '') . '>';
                echo '<div style="position:relative;left:-15px">';
                if (!isset($opt_tax_childs)) {
                    $childs = FALSE;
                } else {
                    $childs = $opt_tax_childs->act;
                }
                echo '<input type="hidden" id="page-tax_' . $tax_type->name . '_act" name="page-tax_' . $tax_type->name . '_act" value="' . implode(',', $opt_tax->act) . '" />';
                if (isset($opt_tax_childs)) {
                    echo '<input type="hidden" id="page-tax_' . $tax_type->name . '_childs_act" name="page-tax_' . $tax_type->name . '_childs_act" value="' . implode(',', $opt_tax_childs->act) . '" />';
                }
                // DW_CustomPost::prtTax($tax_type->name, $tree, $opt_tax->act, $childs, 'page-tax_' . $tax_type->name);
                DW_CustomPost::prtTax($widget_id, $tax_type->name, $tree, $opt_tax->act, $childs, 'page-tax_' . $tax_type->name);
                echo '</div>';
                echo '</div>';
            }
        }
        self::GUIFooter();
    }
Exemplo n.º 28
0
 public static function registerOption()
 {
     $option = array('cp_archive' => 'Custom Post Type Archives');
     // Adding Custom Post Types to $DW->dwoptions
     $args = array('public' => TRUE, '_builtin' => FALSE);
     $post_types = get_post_types($args, 'objects', 'and');
     foreach ($post_types as $ctid) {
         $option[key($post_types)] = $ctid->label;
     }
     // Adding Custom Taxonomies to $DW->dwoptions
     $taxonomy = get_taxonomies($args, 'objects', 'and');
     foreach ($taxonomy as $tax_id => $tax) {
         $option['tax_' . $tax_id] = $tax->label;
     }
     parent::registerOption($option);
 }
Exemplo n.º 29
0
 /**
  * dynWid::getModuleName() Full registration of the modules
  *
  */
 public function getModuleName()
 {
     $dwoptions = array();
     // I NEED PHP > 5.3!!
     DWModule::registerOption(DW_Archive::$option);
     DWModule::registerOption(DW_Attachment::$option);
     DWModule::registerOption(DW_Author::$option);
     DWModule::registerOption(DW_bbPress::$option);
     DWModule::registerOption(DW_BP::$option);
     DWModule::registerOption(DW_Browser::$option);
     DWModule::registerOption(DW_IP::$option);
     DWModule::registerOption(DW_Fimage::$option);
     DWModule::registerOption(DW_Category::$option);
     DW_CustomPost::registerOption(NULL);
     DWModule::registerOption(DW_Date::$option);
     DWModule::registerOption(DW_Day::$option);
     DWModule::registerOption(DW_E404::$option);
     DWModule::registerOption(DW_Front_page::$option);
     DWModule::registerOption(DW_Device::$option);
     DWModule::registerOption(DW_Page::$option);
     DWModule::registerOption(DW_Pods::$option);
     // DWModule::registerOption(DW_QT::$option);
     DWModule::registerOption(DW_Role::$option);
     DWModule::registerOption(DW_Search::$option);
     DWModule::registerOption(DW_Shortcode::$option);
     DWModule::registerOption(DW_Single::$option);
     DWModule::registerOption(DW_Tag::$option);
     DWModule::registerOption(DW_Tpl::$option);
     DWModule::registerOption(DW_URL::$option);
     DWModule::registerOption(DW_Week::$option);
     DWModule::registerOption(DW_WPSC::$option);
     DWModule::registerOption(DW_WPML::$option);
 }
Exemplo n.º 30
0
<?php

/**
 * dynwid_worker.php - The worker does the actual work.
 *
 * @version $Id: dynwid_worker.php 939272 2014-06-26 19:44:38Z qurl $
 * @copyright 2011 Jacco Drabbe
 */
$DW->message('Worker START');
$DW->message('WhereAmI = ' . $DW->whereami);
// Registering Custom Post Type & Custom Taxonomy to $DW (object overload)
include DW_MODULES . 'custompost_module.php';
DWModule::registerPlugin(DW_CustomPost::$plugin);
// Device
$DW->device = wp_is_mobile() ? 'mobile' : 'desktop';
$DW->message('Device = ' . $DW->device);
// Template
if (!is_archive() && !is_404()) {
    $tpl = get_page_template();
    if ($DW->whereami == 'pods') {
        global $pod_page_exists;
        if (!empty($pod_page_exists['page_template'])) {
            $tpl = $pod_page_exists['page_template'];
        }
    }
    $DW->template = basename($tpl);
    $DW->message('Template = ' . $DW->template);
}
// WPML Plugin support
include_once DW_MODULES . 'wpml_module.php';
if (DW_WPML::detect(FALSE)) {