Example #1
0
 /**
  * Widget Update method
  */
 function update($new_instance, $old_instance)
 {
     foreach ($new_instance as $name => $value) {
         // special handling for text inputs
         if (in_array($name, IntelliWidgetStrings::get_fields('text'))) {
             if (current_user_can('unfiltered_html')) {
                 $old_instance[$name] = $value;
             } else {
                 // raw html parser/cleaner-upper: see WP docs re: KSES
                 $old_instance[$name] = stripslashes(wp_filter_post_kses(addslashes($value)));
             }
         } elseif (0 === strpos($name, 'iw') || in_array($name, array('pagesearch', 'termsearch', 'profiles_only'))) {
             unset($old_instance[$name]);
         } else {
             $old_instance[$name] = $this->filter_sanitize_input($value);
         }
         // handle multi selects that may not be passed or may just be empty
         if ('page_multi' == $name && empty($new_instance['page'])) {
             $old_instance['page'] = array();
         }
         if ('terms_multi' == $name && empty($new_instance['terms'])) {
             $old_instance['terms'] = array();
         }
     }
     foreach (IntelliWidgetStrings::get_fields('checkbox') as $name) {
         $old_instance[$name] = isset($new_instance[$name]);
     }
     //$iwq = new IntelliWidgetQuery(); // do not use for now ( 2.3.4 )
     //$old_instance[ 'querystr' ] = $iwq->iw_query( $old_instance );
     return $old_instance;
 }
Example #2
0
        <?php 
echo $this->get_label('content');
?>
: </label><br/>
      <select class="iw<?php 
echo $is_widget ? '-widget' : '';
?>
-control" id="<?php 
echo $widgetobj->get_field_id('content');
?>
" name="<?php 
echo $widgetobj->get_field_name('content');
?>
" autocomplete="off">
        <?php 
foreach (IntelliWidgetStrings::get_menu('content') as $value => $label) {
    ?>
        <option value="<?php 
    echo $value;
    ?>
" <?php 
    selected($instance['content'], $value);
    ?>
><?php 
    echo $label;
    ?>
</option>
        <?php 
}
?>
      </select><?php 
Example #3
0
print $widgetobj->get_field_id('image_size');
?>
" class="aligned">
        <?php 
echo $this->get_label('image_size');
?>
: </label>
      <select id="<?php 
echo $widgetobj->get_field_id('image_size');
?>
" name="<?php 
echo $widgetobj->get_field_name('image_size');
?>
">
        <?php 
foreach (IntelliWidgetStrings::get_menu('image_size') as $value => $label) {
    ?>
        <option value="<?php 
    echo $value;
    ?>
" <?php 
    selected($instance['image_size'], $value);
    ?>
><?php 
    echo $label;
    ?>
</option>
        <?php 
}
?>
        <?php 
Example #4
0
 function get_nav_menu()
 {
     $defaults = IntelliWidgetStrings::get_menu('default_nav');
     return $defaults + $this->menus;
 }
Example #5
0
 function post_save_cdf_data($post_id)
 {
     // reset the data array
     $prefix = 'intelliwidget_';
     foreach (IntelliWidgetStrings::get_fields('custom') as $cfield) {
         $cdfield = $prefix . $cfield;
         if (array_key_exists($cdfield, $_POST)) {
             if (empty($_POST[$cdfield]) || '' == $_POST[$cdfield]) {
                 $this->delete_meta($post_id, $cdfield);
             } else {
                 $newdata = $_POST[$cdfield];
                 if (!current_user_can('unfiltered_html')) {
                     $newdata = stripslashes(wp_filter_post_kses(addslashes($newdata)));
                 }
                 $this->update_meta($post_id, $cdfield, $newdata);
             }
         }
     }
 }
Example #6
0
  <input class="intelliwidget-input" type="text" id="intelliwidget_link_classes" name="intelliwidget_link_classes" value="<?php 
echo $fields['intelliwidget_link_classes'];
?>
" autocomplete="off" />
</p>
<p>
  <label title="<?php 
echo $this->get_tip('link_target');
?>
" for="intelliwidget_link_target"> <?php 
echo $this->get_label('link_target');
?>
:</label>
  <select class="intelliwidget-input" id="intelliwidget_link_target" name="intelliwidget_link_target" autocomplete="off" >
    <?php 
foreach (IntelliWidgetStrings::get_menu('link_target') as $value => $label) {
    ?>
    <option value="<?php 
    echo $value;
    ?>
" <?php 
    selected($fields['intelliwidget_link_target'], $value);
    ?>
><?php 
    echo $label;
    ?>
</option>
    <?php 
}
?>
  </select>
Example #7
0
echo $this->get_tip('sortby_terms');
?>
"> <?php 
echo $this->get_label('sortby_terms');
?>
: </label>
      <br/>
      <select name="<?php 
echo $widgetobj->get_field_name('sortby');
?>
" id="<?php 
echo $widgetobj->get_field_id('sortby');
?>
">
        <?php 
foreach (IntelliWidgetStrings::get_menu('tax_sortby') as $value => $label) {
    ?>
        <option value="<?php 
    echo $value;
    ?>
" <?php 
    selected($instance['sortby'], $value);
    ?>
><?php 
    echo $label;
    ?>
</option>
        <?php 
}
?>
      </select>
Example #8
0
 function get_tip($key = '')
 {
     return IntelliWidgetStrings::get_tip($key);
 }
Example #9
0
echo $widgetobj->get_field_id('text_position');
?>
">
        <?php 
echo $this->get_label('text_position');
?>
: </label>
      <select name="<?php 
echo $widgetobj->get_field_name('text_position');
?>
" id="<?php 
echo $widgetobj->get_field_id('text_position');
?>
">
        <?php 
foreach (IntelliWidgetStrings::get_menu('text_position') as $value => $label) {
    ?>
        <option value="<?php 
    echo $value;
    ?>
" <?php 
    selected($instance['text_position'], $value);
    ?>
><?php 
    echo $label;
    ?>
</option>
        <?php 
}
?>
      </select>