<commit_before><?php

/**
 *
 * @package    sfFacebookConnectPlugin
 * @author     <NAME>
 *
 */

/**
 *
 * @param string $on_load_js
 * @author fabriceb
 * @since May 27, 2009 fabriceb
 */
function include_bottom_facebook_connect_script($on_load_js = '')
{
  if (sfFacebook::isJsLoaded())
  {
    return;
  }
  ?>
  <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/<?php echo sfFacebook::getLocale() ?>" type="text/javascript"></script>
  <script src="<?php echo javascript_path('/sfFacebookConnectPlugin/js/sfFacebookConnect') ?>" type="text/javascript"></script>

  <script type="text/javascript">
    //<![CDATA[
    var sf_fb = null;
<?php
    $html = '';
    switch(sfConfig::get('app_facebook_js_framework'))
    {
      case 'jQuery':
        $html .= '
          jQuery(function(){'.init_sf_fb().$on_load_js.' });
        ';
        break;
      case 'prototype':
        $html .= '
          document.observe("dom:loaded", function(){'.init_sf_fb().$on_load_js.' });
        ';
        break;
      case 'none':
      default:
        $html .= '
          window.onload = function() { '.init_sf_fb().$on_load_js.' };
        ';
        break;
    }
    echo $html;
?>
    //]]>
  </script>
  <?php
  sfFacebook::setJsLoaded();
}

/**
 *
 * @author fabriceb
 * @since May 27, 2009 fabriceb
 */
function include_facebook_connect_script()
{
  if (sfFacebook::isJsLoaded())
  {
    return;
  }
  ?>
  <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/<?php echo sfFacebook::getLocale() ?>" type="text/javascript"></script>
  <script src="<?php echo javascript_path('/sfFacebookConnectPlugin/js/sfFacebookConnect') ?>" type="text/javascript"></script>

  <script type="text/javascript">
    //<![CDATA[
    if (typeof sf_fb == 'undefined')
    {
      <?php echo init_sf_fb(); ?>
    }
    //]]>
  </script>
  <?php
  sfFacebook::setJsLoaded();
}

/**
 *
 * @author fabriceb
 * @since May 27, 2009 fabriceb
 */
function include_facebook_connect_script_src()
{
  if (sfFacebook::isJsLoaded())
  {
    return;
  }
  ?>
  <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/<?php echo sfFacebook::getLocale() ?>" type="text/javascript"></script>
  <script src="<?php echo javascript_path('/sfFacebookConnectPlugin/js/sfFacebookConnect') ?>" type="text/javascript"></script>
  <?php
  sfFacebook::setJsLoaded();
}

function init_sf_fb()
{
  return "sf_fb = new sfFacebookConnect('".sfConfig::get('app_facebook_api_key')."', '".url_for(sfConfig::get('app_facebook_connect_signin_url','sfFacebookConnectAuth/signin'))."');";
}


/**
 *
 * @param string $forward a url to forward to
 * @return string
 * @author fabriceb<commit_msg>[sfFacebookConnectPlugin] Facebook JS loader recommended to be used with a slot<commit_after><?php

/**
 *
 * @package    sfFacebookConnectPlugin
 * @author     <NAME>
 *
 */

/**
 *
 * @param string $on_load_js
 * @author fabriceb
 * @since May 27, 2009 fabriceb
 */
function include_bottom_facebook_connect_script($on_load_js = '')
{
  if (sfFacebook::isJsLoaded())
  {
    return;
  }
  ?>
  <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/<?php echo sfFacebook::getLocale() ?>" type="text/javascript"></script>
  <script src="<?php echo javascript_path('/sfFacebookConnectPlugin/js/sfFacebookConnect') ?>" type="text/javascript"></script>

  <script type="text/javascript">
    //<![CDATA[
    var sf_fb = null;
<?php
    $html = '';
    switch(sfConfig::get('app_facebook_js_framework'))
    {
      case 'jQuery':
        $html .= '
          jQuery(function(){'.init_sf_fb().$on_load_js.' });
        ';
        break;
      case 'prototype':
        $html .= '
          document.observe("dom:loaded", function(){'.init_sf_fb().$on_load_js.' });
        ';
        break;
      case 'none':
      default:
        $html .= '
          window.onload = function() { '.init_sf_fb().$on_load_js.' };
        ';
        break;
    }
    echo $html;
?>
    //]]>
  </script>
  <?php
  sfFacebook::setJsLoaded();
}

/**
 * RECOMMENDED WAY : use this function in conjunction with a slot put at the bottom of the layout
 *
 * @author fabriceb
 * @since May 27, 2009 fabriceb
 */
function include_facebook_connect_script()
{
  ?>
  <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/<?php echo sfFacebook::getLocale() ?>" type="text/javascript"></script>
  <script src="<?php echo javascript_path('/sfFacebookConnectPlugin/js/sfFacebookConnect') ?>" type="text/javascript"></script>

  <script type="text/javascript">
    //<![CDATA[
    if (typeof sf_fb == 'undefined')
    {
      <?php echo init_sf_fb(); ?>
    }
    //]]>
  </script>
  <?php
}

/**
 *
 * @author fabriceb
 * @since May 27, 2009 fabriceb
 */
function include_facebook_connect_script_src()
{
  if (sfFacebook::isJsLoaded())
  {
    return;
  }
  ?>
  <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/<?php echo sfFacebook::getLocale() ?>" type="text/javascript"></script>
  <script src="<?php echo javascript_path('/sfFacebookConnectPlugin/js/sfFacebookConnect') ?>" type="text/javascript"></script>
  <?php
  sfFacebook::setJsLoaded();
}

function init_sf_fb()
{
  return "sf_fb = new sfFacebookConnect('".sfConfig::get('app_facebook_api_key')."', '".url_for(sfConfig::get('app_facebook_connect_signin_url','sfFacebookConnectAuth/signin'))."');";
}


/**
 *
 * @param string $forward a url to forward to
 * @return string
 * @author fabriceb
{'fraction_non_alphanumeric': 0.1813611061231819, 'fraction_numerical': 0.008619141677141317, 'mean_word_length': 3.4883158742949236, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 36, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5510971', 'n_tokens_mistral': 1952, 'n_tokens_neox': 1854, 'n_words': 304}