Source for file profile.php

Documentation is available at profile.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Twitter
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die();
  11.  
  12. /**
  13.  * Twitter API Profile class for the Joomla Platform.
  14.  *
  15.  * @package     Joomla.Platform
  16.  * @subpackage  Twitter
  17.  * @since       12.3
  18.  */
  19. {
  20.     /**
  21.      * Method to et values that users are able to set under the "Account" tab of their settings page.
  22.      *
  23.      * @param   string   $name         Full name associated with the profile. Maximum of 20 characters.
  24.      * @param   string   $url          URL associated with the profile. Will be prepended with "http://" if not present. Maximum of 100 characters.
  25.      * @param   string   $location     The city or country describing where the user of the account is located. The contents are not normalized
  26.      *                                     or geocoded in any way. Maximum of 30 characters.
  27.      * @param   string   $description  A description of the user owning the account. Maximum of 160 characters.
  28.      * @param   boolean  $entities     When set to either true, t or 1, each tweet will include a node called "entities,". This node offers a
  29.      *                                     variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags.
  30.      * @param   boolean  $skip_status  When set to either true, t or 1 statuses will not be included in the returned user objects.
  31.      *
  32.      * @return  array  The decoded JSON response
  33.      *
  34.      * @since   12.3
  35.      */
  36.     public function updateProfile($name null$url null$location null$description null$entities null$skip_status null)
  37.     {
  38.         // Check the rate limit for remaining hits
  39.         $this->checkRateLimit('account''update_profile');
  40.  
  41.         $data array();
  42.  
  43.         // Check if name is specified.
  44.         if ($name)
  45.         {
  46.             $data['name'$name;
  47.         }
  48.  
  49.         // Check if url is specified.
  50.         if ($url)
  51.         {
  52.             $data['url'$url;
  53.         }
  54.  
  55.         // Check if location is specified.
  56.         if ($location)
  57.         {
  58.             $data['location'$location;
  59.         }
  60.  
  61.         // Check if description is specified.
  62.         if ($description)
  63.         {
  64.             $data['description'$description;
  65.         }
  66.  
  67.         // Check if entities is specified.
  68.         if (!is_null($entities))
  69.         {
  70.             $data['include_entities'$entities;
  71.         }
  72.  
  73.         // Check if skip_status is specified.
  74.         if (!is_null($skip_status))
  75.         {
  76.             $data['skip_status'$skip_status;
  77.         }
  78.  
  79.         // Set the API path
  80.         $path '/account/update_profile.json';
  81.  
  82.         // Send the request.
  83.         return $this->sendRequest($path'POST'$data);
  84.     }
  85.  
  86.     /**
  87.      * Method to update the authenticating user's profile background image. This method can also be used to enable or disable the profile
  88.      * background image.
  89.      *
  90.      * @param   string   $image        The background image for the profile.
  91.      * @param   boolean  $tile         Whether or not to tile the background image.
  92.      * @param   boolean  $entities     When set to either true, t or 1, each tweet will include a node called "entities,". This node offers a
  93.      *                                     variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags.
  94.      * @param   boolean  $skip_status  When set to either true, t or 1 statuses will not be included in the returned user objects.
  95.      * @param   boolean  $use          Determines whether to display the profile background image or not.
  96.      *
  97.      * @return  array  The decoded JSON response
  98.      *
  99.      * @since   12.3
  100.      */
  101.     public function updateProfileBackgroundImage($image null$tile false$entities null$skip_status null$use false)
  102.     {
  103.         // Check the rate limit for remaining hits
  104.         $this->checkRateLimit('account''update_profile_background_image');
  105.  
  106.         $data array();
  107.  
  108.         // Check if image is specified.
  109.         if ($image)
  110.         {
  111.             $data['image'"@{$image}";
  112.         }
  113.  
  114.         // Check if url is true.
  115.         if ($tile)
  116.         {
  117.             $data['tile'$tile;
  118.         }
  119.  
  120.         // Check if entities is specified.
  121.         if (!is_null($entities))
  122.         {
  123.             $data['include_entities'$entities;
  124.         }
  125.  
  126.         // Check if skip_status is specified.
  127.         if (!is_null($skip_status))
  128.         {
  129.             $data['skip_status'$skip_status;
  130.         }
  131.  
  132.         // Check if use is true.
  133.         if ($use)
  134.         {
  135.             $data['use'$use;
  136.         }
  137.  
  138.         // Set the API path
  139.         $path '/account/update_profile_background_image.json';
  140.  
  141.         $header array('Content-Type' => 'multipart/form-data''Expect' => '');
  142.  
  143.         // Send the request.
  144.         return $this->sendRequest($path'POST'$data$header);
  145.     }
  146.  
  147.     /**
  148.      * Method to update the authenticating user's profile image.
  149.      *
  150.      * @param   string   $image        The background image for the profile.
  151.      * @param   boolean  $entities     When set to either true, t or 1, each tweet will include a node called "entities,". This node offers a
  152.      *                                     variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags.
  153.      * @param   boolean  $skip_status  When set to either true, t or 1 statuses will not be included in the returned user objects.
  154.      *
  155.      * @return  array  The decoded JSON response
  156.      *
  157.      * @since   12.3
  158.      */
  159.     public function updateProfileImage($image null$entities null$skip_status null)
  160.     {
  161.         // Check the rate limit for remaining hits
  162.         $this->checkRateLimit('account''update_profile_image');
  163.  
  164.         $data array();
  165.  
  166.         // Check if image is specified.
  167.         if ($image)
  168.         {
  169.             $data['image'"@{$image}";
  170.         }
  171.  
  172.         // Check if entities is specified.
  173.         if (!is_null($entities))
  174.         {
  175.             $data['include_entities'$entities;
  176.         }
  177.  
  178.         // Check if skip_status is specified.
  179.         if (!is_null($skip_status))
  180.         {
  181.             $data['skip_status'$skip_status;
  182.         }
  183.  
  184.         // Set the API path
  185.         $path '/account/update_profile_image.json';
  186.  
  187.         $header array('Content-Type' => 'multipart/form-data''Expect' => '');
  188.  
  189.         // Send the request.
  190.         return $this->sendRequest($path'POST'$data$header);
  191.     }
  192.  
  193.     /**
  194.      * Method to set one or more hex values that control the color scheme of the authenticating user's profile page on twitter.com.
  195.      *
  196.      * @param   string   $background      Profile background color.
  197.      * @param   string   $link            Profile link color.
  198.      * @param   string   $sidebar_border  Profile sidebar's border color.
  199.      * @param   string   $sidebar_fill    Profile sidebar's fill color.
  200.      * @param   string   $text            Profile text color.
  201.      * @param   boolean  $entities        When set to either true, t or 1, each tweet will include a node called "entities,". This node offers a
  202.      *                                        variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags.
  203.      * @param   boolean  $skip_status     When set to either true, t or 1 statuses will not be included in the returned user objects.
  204.      *
  205.      * @return  array  The decoded JSON response
  206.      *
  207.      * @since   12.3
  208.      */
  209.     public function updateProfileColors($background null$link null$sidebar_border null$sidebar_fill null$text null,
  210.         $entities null$skip_status null)
  211.     {
  212.         // Check the rate limit for remaining hits
  213.         $this->checkRateLimit('account''update_profile_colors');
  214.  
  215.         $data array();
  216.  
  217.         // Check if background is specified.
  218.         if ($background)
  219.         {
  220.             $data['profile_background_color'$background;
  221.         }
  222.  
  223.         // Check if link is specified.
  224.         if ($link)
  225.         {
  226.             $data['profile_link_color'$link;
  227.         }
  228.  
  229.         // Check if sidebar_border is specified.
  230.         if ($sidebar_border)
  231.         {
  232.             $data['profile_sidebar_border_color'$sidebar_border;
  233.         }
  234.  
  235.         // Check if sidebar_fill is specified.
  236.         if ($sidebar_fill)
  237.         {
  238.             $data['profile_sidebar_fill_color'$sidebar_fill;
  239.         }
  240.  
  241.         // Check if text is specified.
  242.         if ($text)
  243.         {
  244.             $data['profile_text_color'$text;
  245.         }
  246.  
  247.         // Check if entities is specified.
  248.         if (!is_null($entities))
  249.         {
  250.             $data['include_entities'$entities;
  251.         }
  252.  
  253.         // Check if skip_status is true.
  254.         if (!is_null($skip_status))
  255.         {
  256.             $data['skip_status'$skip_status;
  257.         }
  258.  
  259.         // Set the API path
  260.         $path '/account/update_profile_colors.json';
  261.  
  262.         // Send the request.
  263.         return $this->sendRequest($path'POST'$data);
  264.     }
  265.  
  266.     /**
  267.      * Method to get the settings (including current trend, geo and sleep time information) for the authenticating user.
  268.      *
  269.      * @return  array  The decoded JSON response
  270.      *
  271.      * @since   12.3
  272.      */
  273.     public function getSettings()
  274.     {
  275.         // Check the rate limit for remaining hits
  276.         $this->checkRateLimit('account''settings');
  277.  
  278.         // Set the API path
  279.         $path '/account/settings.json';
  280.  
  281.         // Send the request.
  282.         return $this->sendRequest($path);
  283.     }
  284.  
  285.     /**
  286.      * Method to update the authenticating user's settings.
  287.      *
  288.      * @param   integer  $location     The Yahoo! Where On Earth ID to use as the user's default trend location.
  289.      * @param   boolean  $sleep_time   When set to true, t or 1, will enable sleep time for the user.
  290.      * @param   integer  $start_sleep  The hour that sleep time should begin if it is enabled.
  291.      * @param   integer  $end_sleep    The hour that sleep time should end if it is enabled.
  292.      * @param   string   $time_zone    The timezone dates and times should be displayed in for the user. The timezone must be one of the
  293.      *                                     Rails TimeZone names.
  294.      * @param   string   $lang         The language which Twitter should render in for this user.
  295.      *
  296.      * @return  array  The decoded JSON response
  297.      *
  298.      * @since   12.3
  299.      */
  300.     public function updateSettings($location null$sleep_time false$start_sleep null$end_sleep null,
  301.         $time_zone null$lang null)
  302.     {
  303.         $data array();
  304.  
  305.         // Check if location is specified.
  306.         if ($location)
  307.         {
  308.             $data['trend_location_woeid '$location;
  309.         }
  310.  
  311.         // Check if sleep_time is true.
  312.         if ($sleep_time)
  313.         {
  314.             $data['sleep_time_enabled'$sleep_time;
  315.         }
  316.  
  317.         // Check if start_sleep is specified.
  318.         if ($start_sleep)
  319.         {
  320.             $data['start_sleep_time'$start_sleep;
  321.         }
  322.  
  323.         // Check if end_sleep is specified.
  324.         if ($end_sleep)
  325.         {
  326.             $data['end_sleep_time'$end_sleep;
  327.         }
  328.  
  329.         // Check if time_zone is specified.
  330.         if ($time_zone)
  331.         {
  332.             $data['time_zone'$time_zone;
  333.         }
  334.  
  335.         // Check if lang is specified.
  336.         if ($lang)
  337.         {
  338.             $data['lang'$lang;
  339.         }
  340.  
  341.         // Set the API path
  342.         $path '/account/settings.json';
  343.  
  344.         // Send the request.
  345.         return $this->sendRequest($path'POST'$data);
  346.     }
  347. }

Documentation generated on Tue, 19 Nov 2013 15:11:15 +0100 by phpDocumentor 1.4.3