Inheritance: extends JavaScript
Exemplo n.º 1
0
 /**
  * Consolidate the methods of the prototype.
  *
  * The method creates a single array from the prototype methods and those of its parents.
  *
  * @return array[string]callable
  */
 protected function getConsolidatedMethods()
 {
     if ($this->consolidatedMethods !== null) {
         return $this->consolidatedMethods;
     }
     $methods = $this->methods;
     if ($this->parent) {
         $methods += $this->parent->getConsolidatedMethods();
     }
     return $this->consolidatedMethods = $methods;
 }
Exemplo n.º 2
0
 public function operation(Prototype $prototype)
 {
     return $prototype->cloneMyself();
 }
Exemplo n.º 3
0
 /**
  * Getter
  *
  * @param string $name
  * @return mixed
  */
 public function __get($name)
 {
     switch ($name) {
         case 'client':
             if (is_null($this->_client) && ($this->consumer_key && $this->consumer_secret)) {
                 try {
                     $this->_client = new \Google_Client();
                     $this->_client->setClientId($this->consumer_key);
                     $this->_client->setClientSecret($this->consumer_secret);
                     $this->_client->setRedirectUri(admin_url('options-general.php?page=gapiwp-analytics'));
                     $this->_client->setScopes(array('https://www.googleapis.com/auth/analytics.readonly'));
                     $this->_client->setAccessType('offline');
                 } catch (\Exception $e) {
                     // Do nothing
                 }
             }
             return $this->_client;
             break;
         case 'ga':
             try {
                 if ($this->token && $this->client && is_null($this->_ga)) {
                     $this->client->setAccessToken($this->token);
                     if ($this->client->isAccessTokenExpired()) {
                         // Refresh token if expired
                         $token = json_decode($this->token);
                         $this->client->refreshToken($token->refresh_token);
                         update_option('gapiwp_token', $this->client->getAccessToken());
                     }
                     $this->_ga = new \Google_Service_Analytics($this->client);
                 }
             } catch (\Exception $e) {
                 // Do nothing
             }
             return $this->_ga;
             break;
         case 'view_id':
             return get_option('gapiwp_view_id', 0);
             break;
         case 'consumer_key':
             return get_option('gapiwp_key', '');
             break;
         case 'consumer_secret':
             return get_option('gapiwp_secret', '');
             break;
         case 'token':
             return get_option('gapiwp_token', '');
             break;
         default:
             return parent::__get($name);
             break;
     }
 }
Exemplo n.º 4
0
function listFolderContent($folderID, $username = "", $path = "", $edit = false)
{
    global $style;
    $fields = array('id', 'title', 'pid', 'description');
    $where = array('pid' => $folderID);
    if ($folderID == MAIN_FID) {
        $where['name'] = $username;
    }
    $folders = Prototype::queryData($fields, "folders", $where, false, $path, false, "title");
    foreach ($folders as $key => $current_folder) {
        $fields = array('count(*) as count');
        $where = array('folderid' => $current_folder['id']);
        //$countFolderBookmarks = Prototype::queryData($fields, "favourites", $where, false, $path, false);
        echo "\t<li class=\"treeItem folderHover\" id=\"f" . $current_folder['id'] . "\"><img src=\"" . $path . "images/style/{$style}/folder.GIF\" alt=\"Folder\" title=\"Folder\"/> <span class=\"textHolder\"><span class=\"folder_desc\" title=\"" . $current_folder['description'] . "\">" . $current_folder['title'] . "</span>";
        if ($edit) {
            echo " <a href=\"modifyfolder.php?id=" . $current_folder['id'] . "\" class=\"editF\"><img src=\"images/books/modifyGray.GIF\" width=\"16\" height=\"16\" alt=\"" . T_("Edit") . "\" title=\"" . T_("Edit") . "\" /></a>";
            ?>
			<script type="text/javascript">
				document.write(" <a href=\"#\" onclick=\"deleteFolder(this, <?php 
            echo $current_folder['id'];
            ?>
); return false;\" class=\"deleteF\"><img src=\"images/books/deleteGray.GIF\" width=\"16\" height=\"16\" alt=\"<?php 
            echo T_("Delete");
            ?>
\" title=\"<?php 
            echo T_("Delete");
            ?>
\" /><\/a>");
			</script>
			<?php 
        }
        echo "</span>\n\t\t<ul id=\"f" . $current_folder['id'] . "\" style=\"display: none;\">\n";
        // Retrive sub-folders recusively
        listFolderContent($current_folder['id'], "", $path, $edit);
        // Retrieve folders bookmarks for now
        listFolderBookmarks($current_folder['id'], "", $path, $edit);
        echo "\t\t</ul>\n</li>\n";
    }
}
Exemplo n.º 5
0
 /**
  * Adds a prototype to the collection and increments the count.
  *
  * @param Prototype $prototype
  */
 public function add(Prototype $prototype)
 {
     $prototype->setKey($this->i);
     $this->collection[] = $prototype;
     ++$this->i;
 }
 public static function registerPrototype(Prototype $prototype)
 {
     self::$registry[$prototype->of()] = $prototype;
 }
Exemplo n.º 7
0
You should have received a copy of the GNU General Public License
along with GetBoo; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
***************************************************************************/
require_once 'includes/tags_functions.php';
?>
<div class="tags_rightmenu">
<?php 
if (in_array('profile', $blocks)) {
    require_once 'includes/user.php';
    if (IS_GETBOO) {
        if (User::isDonor($userName)) {
            // Retrieve profile info
            $fields = array('realname', 'displayemail', 'website', 'information', 'email');
            $where = array('name' => $userName);
            $data = Prototype::queryData($fields, "session", $where);
            $donorContent = "" . T_("Name") . ": " . $data[0]['realname'] . "<br>\n";
            $donorContent .= "" . T_("Website") . ": <a href=\"" . $data[0]['website'] . "\">" . $data[0]['website'] . "</a><br>\n";
            $donorContent .= "" . T_("Information") . ":<br>\n<textarea cols=\"30\" rows=\"4\" readonly=\"readonly\">" . $data[0]['information'] . "</textarea><br>\n";
            ?>
	<div class="rm_heading"><?php 
            echo T_("Donor Profile");
            ?>
</div>
	<div class="rm_content"><?php 
            echo "<p>" . $donorContent . "</p>";
            ?>
</div>
	<?php 
            if ($data[0]['displayemail']) {
                ?>