Ejemplo n.º 1
0
function Overlay_before_Q_responseExtras()
{
    $app = Q_Config::expect('Q', 'app');
    Q_Response::addStylesheet('plugins/Q/css/Q.css');
    Q_Response::addStylesheet('css/Overlay.css', '@end');
    Q_Response::addStylesheet('http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,300,700');
    if (Q_Config::get('Q', 'firebug', false)) {
        Q_Response::addScript("https://getfirebug.com/firebug-lite-debug.js");
    }
    Q_Response::addScript('js/Overlay.js');
    Q_Response::setMeta("title", "Customize My Pic!");
    Q_Response::setMeta("description", "Make a statement on Facebook by customizing your profile picture, even from your smartphone.");
    Q_Response::setMeta("image", Q_Html::themedUrl('img/icon/icon.png'));
    if (Q_Request::isIE()) {
        header("X-UA-Compatible", "IE=edge");
    }
    header('Vary: User-Agent');
    // running an event for loading action-specific extras (if there are any)
    $uri = Q_Dispatcher::uri();
    $module = $uri->module;
    $action = $uri->action;
    $event = "{$module}/{$action}/response/responseExtras";
    if (Q::canHandle($event)) {
        Q::event($event);
    }
}
function Websites_before_Streams_Stream_save_Websites_seo($params)
{
    $stream = $params['stream'];
    if (!$stream->wasModified('attributes')) {
        return;
    }
    $uri = $stream->getAttribute('uri', null);
    if (!$uri) {
        return;
    }
    $url = $stream->getAttribute('url', null);
    if (preg_match('/\\s/', $url)) {
        throw new Q_Exception_WrongValue(array('field' => 'url', 'range' => "no spaces"));
    }
    $wp = new Websites_Permalink();
    $wp->uri = $uri;
    $wp->retrieve('*', array('ignoreCache' => true));
    if ($url = $stream->getAttribute('url', null)) {
        $url = Q_Html::themedUrl($url);
        if (!isset($wp->url) or $wp->url !== $url) {
            $wp->url = $url;
            $wp->save();
        }
    } else {
        $wp->remove();
    }
}
Ejemplo n.º 3
0
/**
 * Standard tool for making payments.
 * @class Assets payment
 * @constructor
 * @param {array} $options Override various options for this tool
 *  @param {string} $options.payments can be "authnet" or "stripe"
 *  @param {string} $options.amount the amount to pay.
 *  @param {double} [$options.currency="usd"] the currency to pay in. (authnet supports only "usd")
 *  @param {string} [$options.payButton] Can override the title of the pay button
 *  @param {String} [$options.publisherId=Users::communityId()] The publisherId of the Assets/product or Assets/service stream
 *  @param {String} [$options.streamName] The name of the Assets/product or Assets/service stream
 *  @param {string} [$options.name=Users::communityName()] The name of the organization the user will be paying
 *  @param {string} [$options.image] The url pointing to a square image of your brand or product. The recommended minimum size is 128x128px.
 *  @param {string} [$options.description=null] A short name or description of the product or service being purchased.
 *  @param {string} [$options.panelLabel] The label of the payment button in the Stripe Checkout form (e.g. "Pay {{amount}}", etc.). If you include {{amount}}, it will be replaced by the provided amount. Otherwise, the amount will be appended to the end of your label.
 *  @param {string} [$options.zipCode] Specify whether Stripe Checkout should validate the billing ZIP code (true or false). The default is false.
 *  @param {boolean} [$options.billingAddress] Specify whether Stripe Checkout should collect the user's billing address (true or false). The default is false.
 *  @param {boolean} [$options.shippingAddress] Specify whether Checkout should collect the user's shipping address (true or false). The default is false.
 *  @param {string} [$options.email=Users::loggedInUser(true)->emailAddress] You can use this to override the email address, if any, provided to Stripe Checkout to be pre-filled.
 *  @param {boolean} [$options.allowRememberMe=true] Specify whether to include the option to "Remember Me" for future purchases (true or false).
 *  @param {boolean} [$options.bitcoin=false] Specify whether to accept Bitcoin (true or false). 
 *  @param {boolean} [$options.alipay=false] Specify whether to accept Alipay ('auto', true, or false). 
 *  @param {boolean} [$options.alipayReusable=false] Specify if you need reusable access to the customer's Alipay account (true or false).
 */
function Assets_payment_tool($options)
{
    Q_Valid::requireFields(array('payments', 'amount'), $options, true);
    if (empty($options['name'])) {
        $options['name'] = Users::communityName();
    }
    if (!empty($options['image'])) {
        $options['image'] = Q_Html::themedUrl($options['image']);
    }
    $options['payments'] = strtolower($options['payments']);
    if (empty($options['email'])) {
        $options['email'] = Users::loggedInUser(true)->emailAddress;
    }
    $payments = ucfirst($options['payments']);
    $currency = strtolower(Q::ifset($options, 'currency', 'usd'));
    if ($payments === 'Authnet' and $currency !== 'usd') {
        throw new Q_Exception("Authnet doesn't support currencies other than USD", 'currency');
    }
    $className = "Assets_Payments_{$payments}";
    switch ($payments) {
        case 'Authnet':
            $adapter = new $className($options);
            $token = $options['token'] = $adapter->authToken();
            $testing = $options['testing'] = Q_Config::expect('Assets', 'payments', $lcpayments, 'testing');
            $action = $options['action'] = $testing ? "https://test.authorize.net/profile/manage" : "https://secure.authorize.net/profile/manage";
            break;
        case 'Stripe':
            $publishableKey = Q_Config::expect('Assets', 'payments', 'stripe', 'publishableKey');
            break;
    }
    $titles = array('Authnet' => 'Authorize.net', 'Stripe' => 'Stripe');
    Q_Response::setToolOptions($options);
    $payButton = Q::ifset($options, 'payButton', "Pay with " . $titles[$payments]);
    return Q::view("Assets/tool/payment/{$payments}.php", compact('token', 'publishableKey', 'action', 'payButton'));
}
Ejemplo n.º 4
0
function Q_scripts_combine()
{
    $environment = Q_Config::get('Q', 'environment', false);
    if (!$environment) {
        return "Config field 'Q'/'environment' is empty";
    }
    $files = Q_Config::get('Q', 'environments', $environment, 'files', Q_Config::get('Q', 'environments', '*', 'files', false));
    if (empty($files)) {
        return "Config field 'Q'/'environments'/'{$environment}'/files is empty";
    }
    $filters = Q_Config::get('Q', 'environments', $environment, 'filters', Q_Config::get('Q', 'environments', '*', 'filters', false));
    if (empty($filters)) {
        return "Config field 'Q'/'environments'/'{$environment}'/filters is empty";
    }
    $combined = array();
    foreach ($files as $src => $dest) {
        $f = Q_Uri::filenameFromUrl(Q_Html::themedUrl($src, true));
        if (!file_exists($f)) {
            return "Aborting: File corresponding to {$src} doesn't exist";
        }
        $content = file_get_contents($f);
        $combined[$dest][$src] = $content;
    }
    foreach ($combined as $dest => $parts) {
        $df = Q_Uri::filenameFromUrl(Q_Html::themedUrl($dest));
        $ext = pathinfo($df, PATHINFO_EXTENSION);
        echo "Writing {$df}\n";
        if (!empty($filters)) {
            foreach ($filters as $e => $filter) {
                if ($ext !== $e) {
                    continue;
                }
                $p = !empty($filter['params']) ? Q::json_encode($filter['params']) : '';
                echo "\t" . $filter['handler'] . "{$p}\n";
                foreach ($parts as $src => $part) {
                    echo "\t\t{$src}\n";
                }
                $params = compact('dest', 'parts');
                if (!empty($filter['params'])) {
                    $params = array_merge($params, $filter['params']);
                }
                $content = Q::event($filter['handler'], $params);
            }
        }
        file_put_contents($df, $content);
    }
    echo "Success.";
}
Ejemplo n.º 5
0
/**
 * Inplace text editor tool to edit the content or attribute of a stream
 * @class Places location
 * @constructor
 * @param {array} [$options] used to pass options
 * @param {array} [$options.miles] array of { miles: title } pairs, by default is generated from Places/nearby/miles config
 * @param {array} [$options.defaultMiles] override the key in the miles array to select by default. Defaults to "Places/nearby/defaultMiles" config
 * @param {array} [$options.map] options for the map
 * @param {integer} [$options.map.delay=300] how many milliseconds to delay showing the map, e.g. because the container is animating
 * @param {string} [$options.map.prompt="img/map.png"] The src of the map graphical prompt when no location has been selected yet
 * @param {String} [$options.updateButton="Update my location"] the title of the update button
 * @param {string} [$options.onUpdate] name an event handler for when the location is updated
 * @param {string} [$options.onUnset] name an event handler for when the location is unset
 */
function Places_location_tool($options)
{
    if (empty($options['miles'])) {
        $options['miles'] = array();
        foreach (Q_Config::expect('Places', 'nearby', 'miles') as $m) {
            $options['miles'][$m] = $m === 1 ? "{$m} mile" : "{$m} miles";
        }
    }
    if (empty($options['map']['prompt'])) {
        $options['map']['prompt'] = Q_Html::themedUrl('plugins/Places/img/map.png');
    }
    if (!isset($options['defaultMiles'])) {
        $options['defaultMiles'] = Q_Config::expect('Places', 'nearby', 'defaultMiles');
    }
    Q_Response::setToolOptions($options);
    return '';
}
Ejemplo n.º 6
0
function Websites_0_8_Streams_mysql()
{
    $userId = Q_Config::get("Websites", "user", "id", null);
    if (!$userId) {
        throw new Q_Exception('Websites: Please fill in the config field "Websites"/"user"/"id"');
    }
    // $now = Streams::db()->toDateTime(Streams::db()->getCurrentTimestamp());
    $ofUserId = '';
    $ofContactLabel = 'Websites/admins';
    $grantedByUserId = null;
    $streams = array("Streams/images/" => array('type' => "Streams/template", "title" => "Images", "icon" => "default", "content" => "", "deletable" => true), "Streams/image/" => array('type' => "Streams/template", "title" => "Untitled Image", "icon" => "Streams/image", "content" => "", "deletable" => true), "Streams/file/" => array('type' => "Streams/template", "title" => "Untitled File", "icon" => "files/_blank", "content" => "", "deletable" => true), "Websites/article/" => array('type' => "Streams/template", "title" => "Untitled Article", "icon" => "default", "content" => "", "deletable" => true), "Websites/seo/" => array('type' => "Streams/template", "title" => "Website SEO", "icon" => Q_Html::themedUrl("plugins/Websites/img/seo"), "content" => "", "deletable" => true), "Websites/header" => array('type' => "Streams/image/icon", "title" => "Header image", "icon" => Q_Html::themedUrl("plugins/Websites/img/header"), "content" => ""), "Websites/slogan" => array('type' => "Streams/text/small", "title" => "Website slogan", "icon" => "default", "content" => "The coolest website"), "Websites/title" => array('type' => "Streams/text/small", "title" => "Website title", "icon" => "default", "content" => "Website Title"), "Websites/menu" => array('type' => "Streams/category", "title" => "Website Menu", "icon" => "default", "content" => ""), "Websites/articles" => array('type' => "Streams/category", "title" => "Articles", "icon" => "default", "content" => "Articles"), "Websites/images" => array('type' => "Streams/category", "title" => "Images", "icon" => "default", "content" => "Articles"));
    $readLevel = Streams::$READ_LEVEL['messages'];
    $writeLevel = Streams::$WRITE_LEVEL['edit'];
    $adminLevel = Streams::$ADMIN_LEVEL['own'];
    $rows = array();
    foreach ($streams as $streamName => $stream) {
        $publisherId = substr($streamName, -1) == '/' ? '' : $userId;
        $writeLevel = !empty($stream['deletable']) ? 40 : 30;
        $rows[] = compact('publisherId', 'streamName', 'ofUserId', 'ofContactLabel', 'grantedByUserId', 'readLevel', 'writeLevel', 'adminLevel');
    }
    Streams_Access::insertManyAndExecute($rows);
    $attributes = null;
    $closedTime = null;
    $readLevel = Streams::$READ_LEVEL['messages'];
    $writeLevel = Streams::$WRITE_LEVEL['join'];
    $adminLevel = Streams::$ADMIN_LEVEL['invite'];
    $inheritAccess = null;
    $rows = array();
    foreach ($streams as $name => $s) {
        extract($s);
        if (substr($name, 0, 9) != 'Websites/') {
            continue;
            // this tempate was already added by Streams install script
        }
        $publisherId = substr($name, -1) == '/' ? '' : $userId;
        $rows[] = compact('publisherId', 'name', 'type', 'title', 'icon', 'content', 'attributes', 'readLevel', 'writeLevel', 'adminLevel', 'inheritAccess');
    }
    Streams_Stream::insertManyAndExecute($rows);
    Streams_RelatedTo::insert(array('toPublisherId' => '', 'toStreamName' => 'Streams/images/', 'type' => 'images', 'fromPublisherId' => '', 'fromStreamName' => 'Streams/image/'))->execute();
    Streams_RelatedTo::insert(array('toPublisherId' => '', 'toStreamName' => 'Streams/category/', 'type' => 'articles', 'fromPublisherId' => '', 'fromStreamName' => 'Websites/article/'))->execute();
    Streams_RelatedTo::insert(array('toPublisherId' => '', 'toStreamName' => 'Streams/category/', 'type' => 'announcements', 'fromPublisherId' => '', 'fromStreamName' => 'Websites/article/'))->execute();
}
Ejemplo n.º 7
0
function Users_after_Q_image_save($params, &$return)
{
    extract($params);
    /**
     * @var string $path
     * @var string $subpath
     * @var Users_User $user
     */
    $user = Users::loggedInUser(true);
    $fullpath = $path . ($subpath ? DS . $subpath : '');
    $prefix = "uploads/Users/{$user->id}/icon";
    if (substr($fullpath, 0, strlen($prefix)) === $prefix) {
        if ($user->icon != $subpath) {
            $user->icon = Q_Html::themedUrl("{$path}/{$subpath}");
            $user->save();
            // triggers any registered hooks
            Users::$cache['iconUrlWasChanged'] = true;
        } else {
            Users::$cache['iconUrlWasChanged'] = false;
        }
    }
}
Ejemplo n.º 8
0
function Trump_welcome_response_content($params)
{
    Q_Response::addStylesheet('http://fonts.googleapis.com/css?family=Lobster');
    $options = array('transition' => array('duration' => 2000), 'interval' => array('duration' => 9000));
    $styles = array(null, array('color' => '#5a3127', 'text-shadow' => 'white 4px -2px'), array('color' => '#ee2244'), array('color' => '#ffffff', 'left' => '20px', 'margin' => '0px', 'top' => '20px'), array('color' => '#ffffff', 'left' => '20px', 'margin' => '0px', 'top' => '20px'), array('color' => '#000000'), array('color' => '#ffffff'), array('color' => '#5a3127', 'text-shadow' => 'white 2px -1px'), array('color' => '#ffffff', 'text-shadow' => 'black 4px -2px'), array('color' => '#5577ff', 'left' => '20px', 'margin' => '0px', 'top' => '20px'), array('color' => '#ff33cc'), array('color' => '#cc33ff', 'text-shadow' => 'black 4px -2px'), array('color' => '#000000'), array('color' => '#ff3355'), array('color' => '#5a3127', 'text-shadow' => 'white 4px -2px'));
    $captions = array(null, 'Trump Village Estates', 'Relaxing oasis', 'A short walk from the beach', null, 'Beautiful sunsets', 'Great neighborhood', 'Convenient parking lots', 'Awesome amenities', 'Near Q and F trains', null, 'Parks between buildings', 'Near Coney Island', 'Enjoy your summer!', 'Trump Village Estates');
    for ($i = 1; $i <= 14; ++$i) {
        $image = array('src' => Q_Html::themedUrl("img/welcome/{$i}.jpg"), 'caption' => $captions[$i], 'style' => $styles[$i]);
        $options['images'][] = $image;
    }
    for ($i = 5; $i <= count($options['images']) - 2; $i += 2) {
        $options['images'][$i]['interval'] = array('type' => 'kenburns', 'from' => array('left' => 0, 'top' => 0.02, 'width' => 0.5, 'height' => 0.5), 'to' => array('left' => 0.15, 'top' => 0.01, 'width' => 0.5, 'height' => 0.5));
        $options['images'][$i + 1]['interval'] = array('type' => 'kenburns', 'from' => array('left' => 0.3, 'top' => 0.1, 'width' => 0.5, 'height' => 0.5), 'to' => array('left' => 0, 'top' => 0, 'width' => 1, 'height' => 1), 'ease' => 'smooth');
    }
    $options['images'][0]['interval'] = array('type' => 'kenburns', 'from' => array('left' => 0.4, 'top' => 0.5, 'width' => 0.4, 'height' => 0.25), 'to' => array('left' => 0.0, 'top' => 0, 'width' => 0.8, 'height' => 0.5));
    $options['images'][1]['interval'] = array('type' => 'kenburns', 'from' => array('left' => 0.5, 'top' => 0, 'width' => 0.5, 'height' => 0.5), 'to' => array('left' => 0.3, 'top' => 0.3, 'width' => 0.5, 'height' => 0.5));
    $options['images'][2]['interval'] = array('type' => 'kenburns', 'from' => array('left' => 0.1, 'top' => 0.0, 'width' => 0.5, 'height' => 0.5), 'to' => array('left' => 0, 'top' => 0, 'width' => 0.9, 'height' => 0.9));
    $options['images'][3]['interval'] = array('type' => 'kenburns', 'from' => array('left' => 0, 'top' => 0.01, 'width' => 0.5, 'height' => 0.5), 'to' => array('left' => 0.15, 'top' => 0.01, 'width' => 0.5, 'height' => 0.5));
    $options['images'][4]['interval'] = array('type' => 'kenburns', 'from' => array('left' => 0.3, 'top' => 0.1, 'width' => 0.5, 'height' => 0.5), 'to' => array('left' => 0, 'top' => 0, 'width' => 1, 'height' => 1), 'ease' => 'smooth');
    $options['images'][9]['interval'] = array('type' => 'kenburns', 'from' => array('left' => 0, 'top' => 0.2, 'width' => 0.5, 'height' => 0.5), 'to' => array('left' => 0.3, 'top' => 0.2, 'width' => 0.7, 'height' => 0.7), 'ease' => 'smooth');
    $options['images'][13]['interval'] = array('type' => 'kenburns', 'from' => array('left' => 0.3, 'top' => 0.1, 'width' => 0.5, 'height' => 0.5), 'to' => array('left' => 0, 'top' => 0, 'width' => 1, 'height' => 1), 'ease' => 'smooth');
    return Q::view('Trump/content/welcome.php', compact('options'));
}
Ejemplo n.º 9
0
?>
	<meta name="msapplication-square70x70logo" content="<?php 
echo Q_Html::themedUrl('img/icon/70.png');
?>
">
	<meta name="msapplication-square150x150logo" content="<?php 
echo Q_Html::themedUrl('img/icon/150.png');
?>
">
	<meta name="msapplication-square310x310logo" content="<?php 
echo Q_Html::themedUrl('img/icon/150.png');
?>
">
	<meta name="msapplication-TileColor" content="#ffffff">
	<meta name="msapplication-TileImage" content="<?php 
echo Q_Html::themedUrl('img/icon/144.png');
?>
">

	<title><?php 
echo $title;
?>
</title>
	<link rel="shortcut icon" href="<?php 
echo Q_Request::baseUrl();
?>
/favicon.ico" type="image/x-icon">
	
	<script type="text/javascript">
		document.getElementsByTagName('html')[0].className += ' Q_js'; // better than noscript
	</script>
Ejemplo n.º 10
0
 static function helperToUrl($template, $context, $args, $source)
 {
     $args = self::parseArgs($template, $context, $args);
     if (empty($args[0])) {
         return "{{url missing}}";
     }
     return Q_Html::themedUrl($args[0]);
 }
Ejemplo n.º 11
0
 /**
  * Get the url of a user's icon
  * @param {string} [$icon] The contents of a user row's icon field
  * @param {string} [$basename=""] The last part after the slash, such as "50.png"
  * @return {string} The stream's icon url
  */
 static function iconUrl($icon, $basename = null)
 {
     if (empty($icon)) {
         return null;
     }
     $url = Q::interpolate($icon, array('baseUrl' => Q_Request::baseUrl()));
     $url = Q_Valid::url($url) ? $url : "plugins/Users/img/icons/{$url}";
     if ($basename) {
         $url .= "/{$basename}";
     }
     return Q_Html::themedUrl($url);
 }
Ejemplo n.º 12
0
 /**
  * Returns array of stylesheets that have been added so far
  * @method stylesheetsArray
  * @static
  * @param {string} [$slotName=null] If provided, returns only the stylesheets added while filling this slot.
  *  If you leave this empty, you get stylesheets information for the "right" slots.
  *  If you pass false here, you will just get the entire $stylesheets array without any processing.
  * @param {string} [$urls=true] If true, transforms all the 'src' values into URLs before returning.
  * @return {array} the array of stylesheets that have been added so far
  */
 static function stylesheetsArray($slotName = null, $urls = true)
 {
     if ($slotName === false) {
         return $sheets = self::$stylesheets;
     }
     if (!isset($slotName) or $slotName === true) {
         $slotName = array_merge(array('', 'Q'), Q_Request::slotNames(true), array('@end'));
     }
     if (is_array($slotName)) {
         $sheets = array();
         $saw = array();
         foreach ($slotName as $sn) {
             foreach (self::stylesheetsArray($sn, $urls) as $b) {
                 $key = $b['href'] . ' ' . $b['media'];
                 if (!empty($saw[$key])) {
                     continue;
                 }
                 $b['slot'] = $sn;
                 $sheets[] = $b;
                 // a unique new script to add to the list
                 $saw[$key] = true;
             }
         }
         return $sheets;
     } else {
         if (!isset(self::$stylesheetsForSlot[$slotName])) {
             return array();
         }
         $sheets = self::$stylesheetsForSlot[$slotName];
     }
     if (!is_array($sheets)) {
         return array();
     }
     $result = array();
     $saw = array();
     foreach ($sheets as $b) {
         if ($urls) {
             $b['href'] = Q_Html::themedUrl($b['href']);
         }
         $key = $b['href'] . ' ' . $b['media'];
         if (!empty($saw[$key])) {
             continue;
         }
         $result[] = $b;
         // a unique new script to add to the list
         $saw[$key] = true;
     }
     return $result;
 }
Ejemplo n.º 13
0
 /**
  * Get the url of a user's icon
  * @param {string} [$icon] The contents of a user row's icon field
  * @param {string} [$basename=""] The last part after the slash, such as "50.png"
  * @return {string} The stream's icon url
  */
 static function iconUrl($icon, $basename = null)
 {
     if (empty($icon)) {
         return null;
     }
     $url = Q_Valid::url($icon) ? $icon : "plugins/Users/img/icons/{$icon}";
     if ($basename) {
         $url .= "/{$basename}";
     }
     return Q_Html::themedUrl($url);
 }
Ejemplo n.º 14
0
 static function invitedUrl($token)
 {
     $baseUrl = Q_Config::get(array('Streams', 'invites', 'baseUrl'), "i");
     return Q_Html::themedUrl("{$baseUrl}/{$token}");
 }
Ejemplo n.º 15
0
 function authToken($customerId = null)
 {
     if (!isset($customerId)) {
         $customerId = $this->customerId();
     }
     $options = $this->options;
     // Common Set Up for API Credentials
     $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
     $merchantAuthentication->setName($options['authname']);
     $merchantAuthentication->setTransactionKey($options['authkey']);
     $refId = 'ref' . time();
     $setting = new AnetAPI\SettingType();
     // 2do: fix domain name and path for iframe popup
     $setting->setSettingName("hostedProfileIFrameCommunicatorUrl");
     $setting->setSettingValue(Q_Html::themedUrl('plugins/Assets/authnet_iframe_communicator.html'));
     $setting->setSettingName("hostedProfilePageBorderVisible");
     $setting->setSettingValue("false");
     $frequest = new AnetAPI\GetHostedProfilePageRequest();
     $frequest->setMerchantAuthentication($merchantAuthentication);
     $frequest->setCustomerProfileId($customerId);
     $frequest->addToHostedProfileSettings($setting);
     $controller = new AnetController\GetHostedProfilePageController($frequest);
     $fresponse = $controller->executeWithApiResponse($options['server']);
     if (!isset($fresponse) or $fresponse->getMessages()->getResultCode() != "Ok") {
         $messages = $fresponse->getMessages()->getMessage();
         $message = reset($messages);
         throw new Assets_Exception_InvalidResponse(array('response' => $message->getCode() . ' ' . $message->getText()));
     }
     return $fresponse->getToken();
 }
Ejemplo n.º 16
0
 /**
  * Get the url of the stream's icon
  * @param {string} [$basename=""] The last part after the slash, such as "50.png"
  * @return {string} The stream's icon url
  */
 function iconUrl($basename = null)
 {
     if (empty($this->icon)) {
         return null;
     }
     $url = Q::interpolate($this->icon, array('baseUrl' => Q_Request::baseUrl()));
     $url = Q_Valid::url($url) ? $url : "plugins/Streams/img/icons/{$url}";
     if ($basename) {
         if (strpos($basename, '.') === false) {
             $basename = "{$basename}.png";
         }
         $url .= "/{$basename}";
     }
     return Q_Html::themedUrl($url);
 }
Ejemplo n.º 17
0
 /**
  * Get the url of the stream's icon
  * @param {string} [$basename=""] The last part after the slash, such as "50.png"
  * @return {string} The stream's icon url
  */
 function iconUrl($basename = null)
 {
     if (empty($this->icon)) {
         return null;
     }
     $url = Q_Valid::url($this->icon) ? $this->icon : "plugins/Streams/img/icons/{$this->icon}";
     if ($basename) {
         if (strpos($basename, '.') === false) {
             $basename = "{$basename}.png";
         }
         $url .= "/{$basename}";
     }
     return Q_Html::themedUrl($url);
 }