コード例 #1
0
ファイル: functions.php プロジェクト: mngoe/iftheme
function load_inline_css_to_admin()
{
    global $current_user;
    get_currentuserinfo();
    $out = '<style type="text/css">';
    $out .= '#widgets-right .widgets-holder-wrap {display:none}';
    $out .= $current_user->ID == 1 ? '#widgets-right .widgets-holder-wrap {display:block}' : '#widgets-right .widgets-holder-wrap.sidebar-' . get_cat_if_user($current_user->ID) . ' {display:block}';
    $out .= '</style>';
    echo $out;
}
コード例 #2
0
ファイル: if-events.php プロジェクト: mngoe/iftheme
function if_events_mobile()
{
    // - grab data -
    global $post;
    global $current_user;
    get_currentuserinfo();
    $antenna = get_cat_name(get_cat_if_user($current_user->ID));
    $custom = get_post_custom($post->ID);
    $meta_disciplines = isset($custom["if_events_disciplines"]) ? unserialize($custom["if_events_disciplines"][0]) : array();
    $meta_lieu = isset($custom["if_events_lieu"][0]) ? $custom["if_events_lieu"][0] : NULL;
    $meta_address = isset($custom["if_events_adresse"][0]) ? $custom["if_events_adresse"][0] : NULL;
    $meta_address_bis = isset($custom["if_events_adresse_bis"][0]) ? $custom["if_events_adresse_bis"][0] : NULL;
    $meta_zip = isset($custom["if_events_zip"][0]) ? $custom["if_events_zip"][0] : NULL;
    $meta_city = isset($custom["if_events_city"]) ? $custom["if_events_city"][0] : $antenna;
    $meta_pays = isset($custom["if_events_pays"][0]) ? $custom["if_events_pays"][0] : '';
    $meta_longlat = isset($custom["longlat"][0]) ? $custom["longlat"][0] : '';
    $meta_long = isset($custom["if_events_long"][0]) ? $custom["if_events_long"][0] : 0;
    $meta_lat = isset($custom["if_events_lat"][0]) ? $custom["if_events_lat"][0] : 0;
    $zoom = isset($custom["zoom"][0]) ? $custom["zoom"][0] : 11;
    //$meta_hour = $custom["if_events_hour"][0];
    $meta_tel = isset($custom["if_events_tel"][0]) ? $custom["if_events_tel"][0] : NULL;
    $meta_mail = isset($custom["if_events_mmail"][0]) ? $custom["if_events_mmail"][0] : NULL;
    $meta_link1 = isset($custom["if_events_link1"][0]) ? $custom["if_events_link1"][0] : NULL;
    $meta_link2 = isset($custom["if_events_link2"][0]) ? $custom["if_events_link2"][0] : NULL;
    $meta_link3 = isset($custom["if_events_link3"][0]) ? $custom["if_events_link3"][0] : NULL;
    $meta_url = isset($custom["if_events_url"]) ? $custom["if_events_url"][0] : $post->guid;
    // - output -
    //DISCIPLINES
    $urld = 'http://api.institutfrancais.com/lib/php/api/getDiscipline.php';
    $disciplines = file_get_contents($urld);
    //Uncomment to use curl if needed
    /*
      if(!$disciplines) {
        //cf. functions.php for info
        $disciplines = curl_get($urld);
      }
    */
    if (!$disciplines) {
        $msg = '<div class="warning">' . __("You must ask your server's administrator if the function <i style=\"color:red\">file_get_contents()</i> can be used without limitation", 'iftheme') . '</div>';
    }
    $disciplines_xml = new DomDocument();
    // Instanciation de la classe DomDocument : création d'un nouvel objet
    $disciplines_xml->loadXML($disciplines);
    $elements = $disciplines_xml->getElementsByTagName('disciplines');
    $element = $elements->item(0);
    // On obtient le nœud disciplines
    $enfants = $element->childNodes;
    // On récupère les nœuds enfants de disciplines avec childNodes
    foreach ($enfants as $enfant) {
        $id = $enfant->attributes->getNamedItem('id')->nodeValue;
        $value = $enfant->attributes->getNamedItem('lib')->nodeValue;
        $options_dis[$id] = $value;
    }
    //PAYS
    $urlp = 'http://api.institutfrancais.com/lib/php/api/getCountry.php';
    $pays = file_get_contents($urlp);
    //Uncomment to use curl if needed
    /*
      if(!$disciplines) {
        //cf. functions.php for info
        $disciplines = curl_get($urlp);
      }
    */
    if (!$pays) {
        $msg = '<div class="warning">' . __("You must ask your server's administrator if the function <i style=\"color:red\">file_get_contents()</i> can be used without limitation", 'iftheme') . '</div>';
    }
    $pays_xml = new DomDocument();
    // Instanciation de la classe DomDocument : création d'un nouvel objet
    $pays_xml->loadXML($pays);
    $payz = $pays_xml->getElementsByTagName('countries');
    $p = $payz->item(0);
    // On obtient le nœud countries
    $penfants = $p->childNodes;
    // On récupère les nœuds enfants de countries avec childNodes
    foreach ($penfants as $penfant) {
        $iso = $penfant->attributes->getNamedItem('iso')->nodeValue;
        $pvalue = $penfant->attributes->getNamedItem('lib')->nodeValue;
        $options_p[$iso] = $pvalue;
        asort($options_p);
    }
    ?>
    <div class="if-meta">
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
  function googleMaps (lat, lng, zoom) {
    geocoder = new google.maps.Geocoder();
    var myLatlng = new google.maps.LatLng(lat, lng);
    var myOptions = {
      scrollwheel: false,
      zoom: zoom,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    var marker = new google.maps.Marker({
        position: myLatlng,  
        map: map
    });
    google.maps.event.addListener(map, "center_changed", function(){
      document.getElementById("if_events_lat").value = map.getCenter().lat();
      document.getElementById("if_events_long").value = map.getCenter().lng();
      marker.setPosition(map.getCenter());
      document.getElementById("zoom").value = map.getZoom();
    });
    google.maps.event.addListener(map, "zoom_changed", function(){
      document.getElementById("zoom").value = map.getZoom();
    });
  }
</script>
<script type="text/javascript">jQuery(document).ready(function(){
  //$(".accordion").accordion();
  //$("#gmaplatlon").validate({rules:{"latitude":{number:true}, "longitude":{number:true}, "zoom":{digits:true,min:0}}, errorPlacement:errorMessages});
  jQuery("#longlat").change(function(){ geocoder.geocode({"address": jQuery(this).attr("value")}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setZoom(14); map.setCenter(results[0].geometry.location); } else { alert("Geocode was not successful for the following reason: " + status); } }); });
  });
  jQuery(window).load(function(){

    googleMaps(<?php 
    echo $meta_lat;
    ?>
,<?php 
    echo $meta_long;
    ?>
,<?php 
    echo $zoom;
    ?>
);
  })
</script>

        <ul>
            <li>
              <label><?php 
    _e("Disciplines", 'iftheme');
    ?>
&nbsp;<span style="color:red" title="<?php 
    __("Mandatory field", 'iftheme');
    ?>
">*</span></label>
              <span class="description"><em><?php 
    _e('The proposed disciplines are useful for the mobile application only and have <b>no impact on your website</b>', 'iftheme');
    ?>
</em></span><br style="line-height:2.5em" />
              <div class="container-disciplines"><!-- Disciplines -->
              <?php 
    if (!$disciplines) {
        echo $msg;
    }
    ?>
              
              <?php 
    foreach ($options_dis as $kdis => $valdis) {
        ?>
                <input type="checkbox" name="if_events_disciplines[]" id="if_events_disciplines-<?php 
        echo $kdis;
        ?>
" value="<?php 
        echo $kdis;
        ?>
" <?php 
        checked(in_array($kdis, $meta_disciplines));
        ?>
 />&nbsp;<?php 
        echo $valdis;
        ?>
 
              <?php 
    }
    ?>
              
              </div>
            </li>
            <li><label><?php 
    _e("Place", 'iftheme');
    ?>
&nbsp;<span style="color:red" title="<?php 
    __("Mandatory field", 'iftheme');
    ?>
">*</span></label><input size="50" type="text" name="if_events_lieu" id="if_events_lieu" value="<?php 
    echo $meta_lieu;
    ?>
" /></li>
            <li><label><?php 
    _e("Address", 'iftheme');
    ?>
</label><input size="50" type="text" name="if_events_adresse" id="if_events_adresse" value="<?php 
    echo $meta_address;
    ?>
" /></li>
            <li><label><?php 
    _e("Additional address", 'iftheme');
    ?>
</label><input size="50" type="text" name="if_events_adresse_bis" id="if_events_adresse_bis" value="<?php 
    echo $meta_address_bis;
    ?>
" /></li>
            <li><label><?php 
    _e("Zip code", 'iftheme');
    ?>
</label><input type="text" name="if_events_zip" id="if_events_zip" value="<?php 
    echo $meta_zip;
    ?>
" /></li>
            <li><label><?php 
    _e("City", 'iftheme');
    ?>
&nbsp;<span style="color:red" title="<?php 
    __("Mandatory field", 'iftheme');
    ?>
">*</span></label><input type="text" name="if_events_city" id="if_events_city" value="<?php 
    echo $meta_city;
    ?>
" /></li>
            <li>
              <label><?php 
    _e("Country", 'iftheme');
    ?>
&nbsp;<span style="color:red" title="<?php 
    __("Mandatory field", 'iftheme');
    ?>
">*</span></label>
              <select name="if_events_pays" id="if_events_pays">
                <option value=""><?php 
    _e("Select");
    ?>
</option> 
              <?php 
    foreach ($options_p as $kp => $valp) {
        ?>
                <option value="<?php 
        echo $kp;
        ?>
" <?php 
        selected($meta_pays, $kp);
        ?>
><?php 
        echo $valp;
        ?>
</option> 
              <?php 
    }
    ?>
              </select>
              <?php 
    if (!$pays) {
        echo $msg;
    }
    ?>
            </li>
            <li>
              <label><?php 
    _e("Get longitude & latitude", 'iftheme');
    ?>
&nbsp;<span style="color:red" title="<?php 
    __("Mandatory field", 'iftheme');
    ?>
">*</span></label><input size="50" type="text" name="longlat" id="longlat" value="<?php 
    echo $meta_longlat;
    ?>
" /><?php 
    _e("<em>Type here the full address of your event. <b>Press \"tab\" key</b> to get/modify the longitude and latitude</em>", 'iftheme');
    ?>
<br /><br /><br /><br />
              <div id="map_canvas" style="height:200px; margin:5px 0px; clear:both"></div>
              <form id="gmaplatlon" method="post" action="">              
              <fieldset style="margin:10px 0 10px 150px"><li><label style="width:auto"><?php 
    _e("Longitude", 'iftheme');
    ?>
&nbsp;<span style="color:red" title="<?php 
    __("Mandatory field", 'iftheme');
    ?>
">*</span></label>&nbsp;<input type="text" name="if_events_long" id="if_events_long" value="<?php 
    echo $meta_long;
    ?>
" />&nbsp;&nbsp;&nbsp;&nbsp;<label style="width:auto"><?php 
    _e("Latitude", 'iftheme');
    ?>
&nbsp;<span style="color:red" title="<?php 
    __("Mandatory field", 'iftheme');
    ?>
">*</span></label>&nbsp;<input type="text" name="if_events_lat" id="if_events_lat" value="<?php 
    echo $meta_lat;
    ?>
" />&nbsp;<label for="zoom" style="width:auto"><?php 
    _e("Zoom", 'iftheme');
    ?>
</label><input type="text" id="zoom" name="zoom" style="width:25px;" maxlength="50" value="<?php 
    echo $zoom;
    ?>
"></fieldset>
              </form>
            </li>
            
            <!--<li><label><?php 
    //_e("Schedules",'iftheme');
    ?>
</label><input size="50" type="text" name="if_events_hour" id="if_events_hour" value="<?php 
    //echo $meta_hour;
    ?>
" /></li>-->
            <li><label><?php 
    _e("Phone number", 'iftheme');
    ?>
</label><input type="text" name="if_events_tel" id="if_events_tel" value="<?php 
    echo $meta_tel;
    ?>
" /></li>
            <li><label><?php 
    _e("Email", 'iftheme');
    ?>
</label><input type="text" name="if_events_mmail" id="if_events_mmail" value="<?php 
    echo $meta_mail;
    ?>
" /></li>
            <li><label><?php 
    _e("Link", 'iftheme');
    ?>
 1</label><input size="50" type="text" name="if_events_link1" id="if_events_link1" value="<?php 
    echo $meta_link1;
    ?>
" /></li>
            <li><label><?php 
    _e("Link", 'iftheme');
    ?>
 2</label><input size="50" type="text" name="if_events_link2" id="if_events_link2" value="<?php 
    echo $meta_link2;
    ?>
" /></li>
            <li><label><?php 
    _e("Link", 'iftheme');
    ?>
 3</label><input size="50" type="text" name="if_events_link3" id="if_events_link3" value="<?php 
    echo $meta_link3;
    ?>
" /></li>
            
            <li style="display:none"><!-- post url --><input type="hidden" name="if_events_url" id="if_events_url" value="<?php 
    echo $post->guid;
    ?>
" /></li>
            <li>&nbsp;<span style="color:red" title="<?php 
    __("Mandatory field", 'iftheme');
    ?>
">*</span>&nbsp;<em style="color:black"><?php 
    _e("Mandatory fields", 'iftheme');
    ?>
</em></li>
        </ul>
    </div>
    <?php 
}
コード例 #3
0
ファイル: theme-classes.php プロジェクト: JigSawFr/iftheme
//hidden field
//to assign the slider to antenna
$slider->addHidden('slide_antenna', array('name' => 'antenna', 'std' => get_cat_if_user($current_user->ID)), false);
/*
* Don't Forget to Close up the meta box deceleration
*/
//Finish Meta Box Deceleration
$slider->Finish();
/**
 * PARTNERS
 */
$c_partner = array('id' => 'upload_img_partner', 'title' => __('Partners logos', 'iftheme'), 'pages' => array('if_partner'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(), 'local_images' => true, 'use_with_theme' => true);
$partner = new AT_Meta_Box($c_partner);
$repeater_fields_p[] = $partner->addText('partner_title', array('name' => __('Name of the partner', 'iftheme')), true);
$repeater_fields_p[] = $partner->addText('link_to_partner', array('name' => __('Link', 'iftheme')), true);
$repeater_fields_p[] = $partner->addImage('image_logo', array('name' => __('Logo', 'iftheme')), true);
//repeater block
$partner->addRepeaterBlock('re_', array('inline' => true, 'name' => __('Partners logos', 'iftheme'), 'fields' => $repeater_fields_p));
//hidden field
//to assign the slider to antenna
$partner->addHidden('partner_antenna', array('name' => 'antenna', 'std' => get_cat_if_user($current_user->ID)), false);
//Finish Meta Box Deceleration
$partner->Finish();
//DATA for INSCRIPTION FORM
$inscription = array('id' => 'form_infos', 'title' => __('Booking informations', 'iftheme'), 'pages' => array('post'), 'context' => 'advanced', 'priority' => 'low', 'fields' => array(), 'local_images' => true, 'use_with_theme' => true);
$booking = new AT_Meta_Box($inscription);
$booking->addCheckbox('if_book_enable', array('name' => __('Open booking', 'iftheme'), 'desc' => __("By checking this box, you enable the booking for this event.", 'iftheme')));
$booking->addText('if_book_mail', array('name' => __('Email', 'iftheme'), 'desc' => __("Email to whom send the booking", 'iftheme')));
$booking->addWysiwyg('if_book_desc', array('name' => __('Details', 'iftheme'), 'desc' => __("Some information you want to add at the top of the booking form", 'iftheme'), 'style' => 'height:150px'));
$booking->Finish();
//end INSCRIPTION
コード例 #4
0
    function form($instance)
    {
        global $current_user;
        get_currentuserinfo();
        //get antenna ID
        $aid = get_cat_if_user($current_user->ID);
        //get antenna's partners
        $args = array('post_type' => 'if_partner', 'meta_key' => 'partner_antenna', 'meta_value' => $aid);
        $partners = get_posts($args);
        // prints the form on the widgets page
        $defaults = array('partnersshown' => 0);
        $instance = wp_parse_args((array) $instance, $defaults);
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title');
        ?>
</label>
			<input type="text" name="<?php 
        echo $this->get_field_name('title');
        ?>
" id="<?php 
        echo $this->get_field_id('title');
        ?>
 " value="<?php 
        echo $instance['title'];
        ?>
" size="20" /><div class="description"><?php 
        _e("You can custom the widget title here. Default is the title of the selected partner.", 'iftheme');
        ?>
</div>
		</p>
		<p>
		  <h4><?php 
        _e("Select Partners:", 'iftheme');
        ?>
</h4>
		<?php 
        if ($partners) {
            ?>
			<?php 
            foreach ($partners as $o) {
                ?>
				<label for="<?php 
                echo $this->get_field_id('partnersshown');
                ?>
">&nbsp;<input type="radio" id="<?php 
                echo $this->get_field_id('partnersshown');
                ?>
" name="<?php 
                echo $this->get_field_name('partnersshown');
                ?>
" value="<?php 
                echo $o->ID;
                ?>
" <?php 
                if ($instance['partnersshown'] == $o->ID) {
                    ?>
checked="checked"<?php 
                }
                ?>
 /><?php 
                echo $o->post_title;
                ?>
</label>
			<?php 
            }
            ?>
		<?php 
        } else {
            ?>
			<div class="msg warning"><?php 
            _e("You must create a Partner in order to use this widget:", 'iftheme');
            ?>
&nbsp;<a href="<?php 
            bloginfo('wpurl');
            ?>
/wp-admin/edit.php?post_type=if_partner"><?php 
            _e("Partners", 'iftheme');
            ?>
</a></div>
		<?php 
        }
        ?>
		</p>
		
	<?php 
    }
コード例 #5
0
ファイル: sidebar.php プロジェクト: mngoe/iftheme
global $antenna, $multi, $options, $c, $antenna_op, $if_front;
$cat_slug = is_front_page() || is_home() ? NULL : get_cat_slug($antenna);
if ($multi) {
    $sidebar = !$cat_slug ? 'Sidebar' : 'Sidebar ' . $cat_slug;
} else {
    $sidebar = 'Sidebar';
}
?>
<div id="sidebar">
			<?php 
//NEWSLETTER FORM
$wysija_embedded = 1;
//default to 1 = Form NL from IFtheme is displayed
if ($multi) {
    // Get admin categ. Only admin can configure country homepage
    $categAdmin = get_cat_if_user(1);
    $wysija_embedded = isset($options[$categAdmin]['theme_options_setting_wysija_embed']) ? $options[$categAdmin]['theme_options_setting_wysija_embed'] : $wysija_embedded;
} else {
    $wysija_embedded = isset($options['theme_options_setting_wysija_embed']) ? $options['theme_options_setting_wysija_embed'] : $wysija_embedded;
}
$wysija = defined('WYSIJA');
if ($wysija && $wysija_embedded) {
    $modelList = WYSIJA::get("list", "model");
    $arrayOfMailingLists = $modelList->get(false, array('is_enabled' => 1));
    $nbMailingLists = count($arrayOfMailingLists);
    foreach ($arrayOfMailingLists as $k => $list) {
        $lists[] = $list['list_id'];
        $names[$list['list_id']] = $list['name'];
    }
    $widgetdata = array('widget_id' => 'wysija-nl-php-1', 'title' => __('Newsletter', 'iftheme'), 'instruction' => __('Subscribe', 'iftheme'), 'lists' => $lists, 'lists_name' => $names, 'submit' => __('OK', 'iftheme'), 'success' => __('You’ve successfully subscribed. Check your inbox now to confirm your subscription.', 'iftheme'), 'customfields' => array('email' => array('label' => __('Your Email', 'iftheme'))), 'labelswithin' => 'labels_within', 'before_title' => '<h3>', 'after_title' => '</h3>', 'before_widget' => '<aside id="sidebar-newsletter" class="widget-sidebar bxshadow clearfix">', 'after_widget' => '</aside>');
    if ($multi && $nbMailingLists > 1) {
コード例 #6
0
ファイル: theme-options.php プロジェクト: JigSawFr/iftheme
/**
 * Returns an array of categories to choose for homepage for Institut Français.
 */
function iftheme_home_categories($pays = NULL)
{
    global $current_user;
    get_currentuserinfo();
    global $sitepress;
    $default_lg = isset($sitepress) ? $sitepress->get_default_language() : get_site_lang();
    $antenna_id = get_cat_if_user($current_user->ID);
    $antenna_id = function_exists('icl_object_id') ? icl_object_id($antenna_id, 'category', TRUE) : $antenna_id;
    //icl_object_id(ID, type, return_original_if_missing,language_code)
    $args = $pays ? array('hide_empty' => 0) : array('child_of' => $antenna_id, 'hide_empty' => 0);
    //$home_categ_options = new array;
    $categories = get_categories($args);
    foreach ($categories as $category) {
        $level = get_level($category->cat_ID);
        //get only second level categories
        //if($level == 1){
        //get all except the level 0 ones
        if ($category->parent) {
            $home_categ_options[$category->term_id] = array('value' => function_exists('icl_object_id') ? icl_object_id($category->term_id, 'category', TRUE, $default_lg) : $category->term_id, 'label' => $category->name, 'antenne' => $pays ? get_cat_name(get_root_category($category->term_id)) : NULL, 'level' => $level);
            if ($pays) {
                $root_categ[get_root_category($category->term_id)] = get_root_category($category->term_id);
            }
        }
    }
    if ($pays) {
        foreach ($root_categ as $k => $id) {
            unset($home_categ_options[$k]);
        }
    }
    return apply_filters('iftheme_home_categories', $home_categ_options);
}
コード例 #7
0
 function make_simple_checkbox_antenna($options, $prefix, $id, $fieldname = null, $label)
 {
     global $current_user;
     if ($fieldname !== null) {
         $value = strip_tags($options[$prefix][$id][$fieldname]);
         $value2 = strip_tags($options[$prefix][$id][$fieldname]);
         $fieldval = $fieldname;
         $fieldname = '[' . $fieldname . ']';
     } else {
         $value = strip_tags($options[$prefix][$id]);
         $value2 = strip_tags($options[$prefix][$id]);
         $fieldval = $fieldname = '';
     }
     if ($current_user->ID != 1) {
         $aid = get_cat_if_user($current_user->ID);
         if ($fieldval == $aid) {
             $value = $aid;
         }
     }
     $prefix = '[' . $prefix . ']';
     $id = '[' . $id . ']';
     if (!empty($value)) {
         $value = 1;
         $checked = 'checked="checked"';
         $classname = 'wl-active';
     } else {
         $value = 0;
         $checked = '';
         $classname = 'wl-inactive';
     }
     $out = '<label class="' . $classname . '"><input type="checkbox" name="wl' . $prefix . $id . $fieldname . '" ' . $checked . ' />&nbsp;' . $label . '</label> ';
     return $out;
 }