public function __construct($fb)
 {
     $this->fb = $fb;
     $this->fb instanceof Facebook;
     $this->db = copperConfig::get('copperDb');
     $this->db instanceof copperDb;
 }
 /**
  * getUidsFromRequestIds
  * 
  * Obtain the uids from a gived requestids.
  * @param array $requestIds
  * @return array $uids 
  */
 public static function getUidsFromRequestIds($requestIds)
 {
     $appid = copperConfig::get('appId');
     $secret = copperConfig::get('appSecret');
     $uids = array();
     if (copperUtils::valid($requestIds, false)) {
         $app_token = file_get_contents('https://graph.facebook.com/oauth/access_token?client_id=' . $appid . '&client_secret=' . $secret . '&grant_type=client_credentials');
         //Get application token
         foreach ($requestIds as $key => $sent) {
             $request = file_get_contents('https://graph.facebook.com/' . $sent . '?' . $app_token);
             $request = json_decode($request);
             $uids[] = $request->to->id;
         }
     }
     return $uids;
 }
 /**
  * configure
  *
  * Configure the instance
  * @param <type> $dsn
  * @param <type> $user
  * @param <type> $pass
  * @return db
  */
 public static function configure($dsn, $user, $pass)
 {
     if (self::$instance !== NULL) {
         throw new Exception('copperDb already configured.');
     }
     try {
         self::$instance = new copperDbPDO($dsn, $user, $pass);
         self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         self::$instance->prepare("SET NAMES UTF8;")->execute();
     } catch (Exception $e) {
         copperConfig::doError(" Configure: " . $e->getMessage() . " File: " . __FILE__ . ":" . __LINE__);
         echo "Hubo un error con la base de datos.\n";
         die;
     }
     return self::$instance;
 }
 public function parseAdditionalMetadata()
 {
     try {
         $feedURL = "http://gdata.youtube.com/feeds/api/videos/" . $this->videoId;
         $sxml = simplexml_load_file($feedURL);
         $media = $sxml->children('http://search.yahoo.com/mrss/');
         //// get <yt:duration> node for video length
         $yt = $media->children('http://gdata.youtube.com/schemas/2007');
         $attrs = $yt->duration->attributes();
         $this->duration = $this->length = $length = $attrs['seconds'];
     } catch (Exception $e) {
         copperConfig::doError('Error al intentar obtener metadata adicional desde URL: ' . $feedURL . ' Excepcion: ' . $e->getMessage());
         return false;
     }
     return true;
 }
<div class='wrap'>
  <div class='logo'>
    <img src="<?php 
echo copperConfig::get('callbackUrl');
?>
img/bare_copper.jpg"/>
  </div>
  
  <div class='container'>
    <h1><?php 
echo copperConfig::get('welcome');
?>
</h1>
    </div>
</div>
 public function getPublic()
 {
     return copperConfig::pubUpload(basename($this->uploadFile));
 }
 /**
  * __construct
  *
  * The constructor camelize the method
  * @param string $method
  * @param array $params
  */
 public function __construct($method, $params)
 {
     $method = copperStr::camelize($method);
     $this->model = copperConfig::get("model");
     $this->{$method}($params);
 }
    <?php 
if (copperConfig::get('facebookJsActivate')) {
    ?>
      <script type="text/javascript">
        window.fbAsyncInit = function() {
          FB.init({
            appId: '<?php 
    echo copperConfig::get('appId');
    ?>
',
            status: false,
            cookie: true,
            xfbml: true,
            channelUrl: '<?php 
    echo copperConfig::get('callbackUrl');
    ?>
channel.html'
          });
          FB.getLoginStatus(function(response) {
              if (response.session) {
                afterFbLogin();
              }
          });
          FB.Canvas.setAutoResize();
        };
        (function() {
          var e = document.createElement('script');
          e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
          e.async = true;
          document.getElementById('fb-root').appendChild(e);
        }());
 /**
  * __set
  *
  * Treat the View as an Object
  */
 public function __set($key, $value)
 {
     copperConfig::set($key, $value);
     return $this;
 }
<?php

/**
 * Please dont touch this. This is the JavaScript Variable Generator.
 * 
 * @author Nahuel Rosso
 * @version 1.0
 */
require_once 'config.php';
header("Content-type: text/javascript");
$jsVars = copperConfig::get('visibleVars');
foreach ($jsVars as $key => $val) {
    echo "var " . strtoupper(copperStr::revertCamelize($key)) . " = " . json_encode($val) . ";\n";
}
}
require_once $customConfig;
$copperConfig = array_merge($copperConfig, $copperConfigCustom);
require_once str_replace(array('///', '//'), "/", $copperConfig['classes'] . '/copperConfig.php');
copperConfig::init($copperConfig);
unset($copperConfig, $customConfig);
// warnings and error to log file.
ini_set('error_log', copperConfig::get('log'));
require_once copperConfig::get('lib') . '/phpmailer/class.phpmailer.php';
require_once copperConfig::get('lib') . '/facebook/facebook.php';
if (copperConfig::get('facebookActivate')) {
    try {
        $fbInstance = copperFacebook::factory(array(), array('req_perms' => copperConfig::get('facebookPerms')));
    } catch (Exception $e) {
        copperConfig::doError('Error cargando facebook: ' . $e->getMessage());
        copperConfig::doError($e->getTraceAsString());
        if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
            echo json_encode(array('error' => true, 'msg' => 'Imposible cargar Session'));
        } else {
            copperConfig::incTemplate('head.php');
            copperConfig::incTemplate('bodys/error500.php');
            copperConfig::incTemplate('foot.php');
        }
        die;
    }
    copperConfig::set('fbInstance', $fbInstance);
    $model = new copperModel($fbInstance);
    copperConfig::set('model', $model);
}
copperConfig::set('visibleVars', $copperConfigVisible);
echo copperConfig::get('callbackUrl');
?>
';
      var CANVAS_URL  = '<?php 
echo copperConfig::get('canvasUrl');
?>
';
      <?php 
if (copperConfig::get('facebookActivate')) {
    ?>
        var SIGNED_REQUEST  = '<?php 
    echo htmlentities($_REQUEST['signed_request']);
    ?>
';
      <?php 
}
?>
    </script>
    <?php 
$fbInstance = copperConfig::get('fbInstance');
if (!empty($fbInstance)) {
    try {
        $friends = $fbInstance->facebook->api('/me/friends');
    } catch (Exception $exc) {
        copperConfig::doError("Error al intentrar inicializar el /me/ : " . $exc->getMessage());
        copperConfig::doError("Error al intentrar inicializar el /me/ con trace: " . $exc->getTraceAsString());
    }
    if (!empty($friends)) {
        copperUtils::setJsVars('myFriends', $friends);
    }
}
 public static function urlToCanvas($link, $params = array())
 {
     $params['signed_request'] = $_REQUEST['signed_request'];
     $url = copperConfig::get('callbackUrl') . $link . "?" . http_build_query($params);
     return $url;
 }
 /**
  * pubUpload
  *
  * Return the path of an public upload
  *
  * @param string $fileName
  * @return string
  */
 public static function pubUpload($fileName)
 {
     return self::publicPath(copperConfig::get('uploadsPublic') . '/' . $fileName);
 }