public function getEmbed($options = array())
    {
        $url = $this->getUrl();
        $width = isset($options['width']) ? $options['width'] : sfSympalConfig::get('default_video_width', null, 400);
        $height = isset($options['height']) ? $options['height'] : sfSympalConfig::get('default_video_height', null, 400);
        $extension = $this->getExtension();
        $id = $this->getDoctrineAsset()->getId();
        if ($extension == 'swf') {
            return sprintf('<object width="%s" height="%s">
<param name="movie" value="%s">
<embed src="%s" width="%s" height="%s">
</embed>
</object>', $width, $height, $url, $url, $width, $height);
        } else {
            if ($extension == 'flv') {
                sympal_use_jquery();
                sympal_use_javascript('/sfSympalPlugin/js/flowplayer.min.js');
                return sprintf('<a href="%s" style="display:block;width:%spx;height:%spx;" id="asset_%s"></a>
<script language="JavaScript"> 
    flowplayer("asset_%s", "%s"); 
</script>', $url, $width, $height, $id, $id, _compute_public_path('/sfSympalPlugin/js/flowplayer.swf', 'swf', 'swf'));
            } else {
                return $this->getLink($options);
            }
        }
    }
 public static function getUrlToImage($filename, $size, $format, $absolute = false)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Asset');
     $sizeDirName = 'w_h';
     if ($size) {
         list($width, $height) = explode('x', $size, 2);
         $sizeDirName = 'w' . $width . '_h' . $height;
     }
     $filepath = 'img/' . $format . '/' . $sizeDirName . '/' . $filename . '.' . $format;
     return _compute_public_path($filepath, 'cache', $format, $absolute);
 }
Example #3
0
function op_chat_get_sounds($absolute = false)
{
    use_helper('Asset');
    static $sounds;
    $result = array();
    if (!is_array($sounds)) {
        $sounds = array('in' => '/opChatPlugin/sounds/in.mp3', 'out' => '/opChatPlugin/sounds/out.mp3', 'notice' => '/opChatPlugin/sounds/notice.mp3');
        foreach ($sounds as $name => $sound) {
            if (file_exists(sfConfig::get('sf_web_dir') . $sound)) {
                $result[$name] = _compute_public_path($sound, sfConfig::get('sf_web_dir', ''), 'mp3', $absolute);
            }
        }
    }
    return empty($result) ? null : $result;
}
function sf_image_path($filename, $options = array(), $absolute = false)
{
    if (isset($options['f'])) {
        $f = $options['f'];
        unset($options['f']);
    } else {
        $parts = explode('.', $filename);
        $f = array_pop($parts);
        if ($f !== 'jpg' || $f !== 'png' || $f !== 'gif') {
            $f = 'jpg';
        }
    }
    $size_dir_name = 'w_h';
    if (isset($options['size'])) {
        list($width, $height) = explode('x', $options['size'], 2);
        $size_dir_name = 'w' . $width . '_h' . $height;
        unset($options['size']);
    }
    $filepath = 'img/' . $f . '/' . $size_dir_name . '/' . $filename;
    $options['raw_name'] = true;
    return _compute_public_path($filepath, 'cache', $f, $absolute);
}
Example #5
0
function sf_image_path($filename, $options = array(), $absolute = false)
{
    if (isset($options['f'])) {
        $f = $options['f'];
        unset($options['f']);
    } elseif (is_callable(array($filename, 'getType'))) {
        $f = str_replace('image/', '', $filename->getType());
    } else {
        $parts = explode('_', $filename);
        $f = array_pop($parts);
    }
    if ($f !== 'jpg' && $f !== 'png' && $f !== 'gif') {
        $f = 'jpg';
    }
    $size_dir_name = 'w_h';
    if (isset($options['size'])) {
        list($width, $height) = explode('x', $options['size'], 2);
        $size_dir_name = 'w' . $width . '_h' . $height;
        unset($options['size']);
    }
    $filepath = 'img/' . $f . '/' . $size_dir_name . '/' . $filename . '.' . $f;
    $options['raw_name'] = true;
    return _compute_public_path($filepath, 'cache', $f, $absolute);
}
Example #6
0
echo _compute_public_path('favicon', 'images', 'ico', true);
?>
" />
<link rel="icon" href="<?php 
echo _compute_public_path('favicon', 'images', 'ico', true);
?>
" />

<!--FOR CSS File-->
<link href="<?php 
echo _compute_public_path('style', 'css', 'css', false);
?>
" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<link href="<?php 
echo _compute_public_path('iecss', 'css', 'css', false);
?>
" rel="stylesheet" type="text/css" />
<![endif]-->
  </head>
 
 <body>
    
	
	<div id="main_container">
	<div class="header">
    	<div id="logo">
		<?php 
if ($sf_user->isAuthenticated()) {
    ?>
			<?php 
Example #7
0
    /** Action that is called if file has been uploaded (metadata may have been entered)
     *
     */
    public function executeRelated(sfWebRequest $request)
    {
        try {
            // Load helpers
            $this->getContext()->getConfiguration()->loadHelpers('Asset');
            $this->getContext()->getConfiguration()->loadHelpers('Url');
            // get config
            $configFeaturevectortypeid = sfConfig::get('app_defaults_featurevectortypeid', 0);
            // get request params
            $reqparamtracknr = $request->getParameter('tracknr');
            $filename = $request->getParameter('uploadedFilename');
            $originalFilename = $request->getParameter('originalFilename');
            $metadataquery = $request->getParameter('metadataquery');
            // 2 possibilities: either tracknr is given or uploadedFilename
            if (isset($reqparamtracknr) && $reqparamtracknr != '' && $reqparamtracknr != 'undefined') {
                //get file via external key
                $tracknr = $reqparamtracknr;
                $fileForSearchSimilar = FilePeer::getFileByExternalKey($tracknr);
                //only if the file was found in the smafestore db
                if ($fileForSearchSimilar) {
                    $originalFilename = $fileForSearchSimilar->getUri();
                    $filesavepath = $fileForSearchSimilar->getUri();
                } else {
                    throw new Exception("Could not find file in database with external_key: {$tracknr}");
                }
                $bUploadedFile = false;
            } else {
                $originalFilename = $request->getParameter('originalFilename');
                $filesavepath = smintUploadFileHelper::getUploadPath() . $filename;
                $bUploadedFile = true;
            }
            // variables about segment selection
            //$reqparamStartSegment = '10000';
            // Start of segment in ms MOCKUP   10 to 20 seconds
            //$reqparamEndSegment = '20000';
            // end of segment in ms   MOCKUP
            $reqparamStartSegment = $request->getParameter('segmentStart');
            // Start of segment in ms
            $reqparamEndSegment = $request->getParameter('segmentEnd');
            $reqparamDuration = $request->getParameter('duration');
            // end of segment in ms
            $aSegmSearch = array('enabled' => false, 'startSegment' => 0, 'endSegment' => 0);
            //$bSegmSearch =			FALSE;										// boolean: is this segmented search? To be set later.
            //$startSegment;														// int value, to be set later
            //$endSegment; 															// int value, to be set later
            $empty_livequery = false;
            $empty_metadatafilteredquery = false;
            $omit_empty_metadataquery = $request->getParameter('omit_empty_metadataquery', false);
            ///// check validity of parameters
            if (isset($reqparamStartSegment)) {
                $aSegmSearch['startSegment'] = intval($reqparamStartSegment);
            }
            if (isset($reqparamEndSegment)) {
                $aSegmSearch['endSegment'] = intval($reqparamEndSegment);
            }
            if (isset($reqparamDuration)) {
                $aSegmSearch['duration'] = intval($reqparamDuration);
            }
            if (isset($reqparamStartSegment) && isset($reqparamEndSegment)) {
                mysfLog::log($this, "DEBUG: " . intval($reqparamStartSegment) . ", {$reqparamEndSegment}     " . $aSegmSearch['startSegment']);
            }
            // for selection, both start and end must be given and of type int and greater or equal 0
            // Note that the start and end times are set "inline"
            if (isset($reqparamStartSegment) && $aSegmSearch['startSegment'] > 0 || isset($reqparamEndSegment) && $aSegmSearch['endSegment'] > 0) {
                mysfLog::log($this, "DEBUG: Using segmented search with start-end in ms:" . $aSegmSearch['startSegment'] . " - " . $aSegmSearch['endSegment']);
                $aSegmSearch['enabled'] = TRUE;
            } else {
                mysfLog::log($this, "DEBUG: NOT using segmented search");
                $aSegmSearch['enabled'] = false;
            }
            $this->exec_result = smintSmafeHelper::queryFile($filesavepath, $aSegmSearch);
            $results = smintSmafeHelper::getResultsOnly($this->exec_result["output"]);
            //			$results = smintSmafeHelper::getResultsWithUri($this -> exec_result["output"]);
            // If we are here in a "search similar" scenario (track is in db, so it will be returned as result again)
            // we have to filter out the seed song
            if (!$bUploadedFile) {
                // do filtering
                $track_id_seed = $fileForSearchSimilar->getTrackId();
                $results_no_seed = array();
                foreach ($results as $key => $result) {
                    if ($result[0] != $track_id_seed) {
                        $results_no_seed[$key] = $result;
                    }
                }
                $results = $results_no_seed;
            }
            if (count($results) == 0) {
                $empty_livequery = true;
            }
            // filter with metadata
            // select external_key,genre from file left join filedesc on file.external_key = filedesc.tracknr where filedesc.genre ilike '%metadata%' and track_id IN ('31469', '31465') limit 10
            if (is_string($metadataquery) && strlen($metadataquery) > 0) {
                $bMDsearch = true;
                $filtered_results = $this->metadataFilter($results, $metadataquery);
                // omit metadata query if empty
                if ($omit_empty_metadataquery) {
                    if (count($filtered_results) > 0) {
                        // set results to filtered results if the metadata filter returns results
                        $results = $filtered_results;
                    } else {
                        $empty_metadatafilteredquery = true;
                    }
                } else {
                    $results = $filtered_results;
                }
            } else {
                $bMDsearch = false;
            }
            // reduce to maxresults
            $this->limit = $this->getContext()->getConfiguration()->getSmintMaxQueryResults();
            $this->results = array_slice($results, 0, $this->limit);
            //$this -> results = array_slice($results, 0, 50);
            ////// If this is segmented search, we perform re-ordering
            if ($aSegmSearch['enabled']) {
                // First, we get the length of the segments in samples
                mysfLog::log($this, "res " . print_r($this->results, true));
                $aResultsEnhanced = array();
                foreach ($this->results as $key => $value) {
                    // check for negative segmentnr (indicates non-segment server)
                    if ($value[1] < 0) {
                        //throw new Exception("Negative value for segment nr. Probably the smafe server is not configured for segmented search?");
                        // Set dummy segments (whole track)
                        array_push($aResultsEnhanced, array('track_id' => intval($value[0]), 'segmnr' => 0, 'dist' => doubleval($value[2]), 'start' => 0, 'end' => 0));
                    } else {
                        $fvsegm = FeaturevectorsegmentPeer::getInformationOnSegment($value[0], $value[1], $configFeaturevectortypeid);
                        $iSamplef = $fvsegm->getFile()->getSamplef();
                        array_push($aResultsEnhanced, array('track_id' => $fvsegm->getTrackId(), 'segmnr' => $fvsegm->getSegmentnr(), 'dist' => doubleval($value[2]), 'start' => intval($fvsegm->getStartsample() * 1000 / $iSamplef), 'end' => intval(($fvsegm->getStartsample() + $fvsegm->getLength()) * 1000 / $iSamplef)));
                        //$value[3] = $value[1] * 262144; 	// this is correct for 44100 Hz samples audio
                        //$value[4] = 262144; 						// this is correct for 44100 Hz samples audio
                    }
                }
                //mysfLog::log($this, "DEBUG: " . print_r($aResultsEnhanced, true));
                $aSegmSearch['resultsegments'] = array();
                // Structure of $aSegmSearch['resultsegments']:
                // first dim:
                //		each element corresponds to element at same position in $this -> results (and later: ->files)
                // second dim:
                //		list of result segments for given track
                // third dim:
                // 		assoc array with start and end time for this result segment
                // INPUT for the aggregation algo:
                // - $aResultsEnhanced
                // - $this->results
                // OUTPUT
                // - $this -> results					array of array[0]...track id , [1] segm nr, [2] distance
                // - $aSegmSearch['resultsegments']		(see above)
                switch (sfConfig::get('app_defaults_segm_search_aggregation_algo', 0)) {
                    case 0:
                        foreach ($aResultsEnhanced as $key => $value) {
                            // new segment
                            // conversion done from sample number to ms
                            array_push($aSegmSearch['resultsegments'], array(array('start' => $value['start'], 'end' => $value['end'], 'dist' => $value['dist'])));
                        }
                        break;
                    case 1:
                        // extract 1st column (track ids)
                        // do the actual work
                        //						$column = 0;
                        //					$result_trackids = array_map('array_slice', $this->results, array_fill(0, count( $this->results), $column), array_fill(0, count( $this->results), 1));
                        $result_trackids = array();
                        foreach ($this->results as $key => $value) {
                            array_push($result_trackids, $value[0]);
                        }
                        mysfLog::log($this, "DEBUG: " . print_r($result_trackids, true));
                        $unique = array();
                        foreach ($result_trackids as $key => $value) {
                            if (!in_array($value, $unique)) {
                                array_push($unique, $value);
                            }
                        }
                        //						$unique = array_unique($result_trackids);
                        //mysfLog::log($this, "DEBUG: " . print_r($unique, true));
                        foreach ($unique as $ukey => $uvalue) {
                            // segments for $value
                            $tmparray = array();
                            foreach ($aResultsEnhanced as $key => $value) {
                                if ($uvalue == $value['track_id']) {
                                    array_push($tmparray, array('start' => $value['start'], 'end' => $value['end'], 'dist' => $value['dist']));
                                }
                            }
                            // Sort result segments ascending in start time
                            $fCmpSegments = create_function('$a, $b', '
							
							if ($a[\'start\'] == $b[\'start\']) {
									return 0;
								} else if ($a[\'start\'] < $b[\'start\']) {
									return -1;
								} else {
									return 1;
								}
						
							');
                            usort($tmparray, $fCmpSegments);
                            // push segments to master array
                            array_push($aSegmSearch['resultsegments'], $tmparray);
                        }
                        //mysfLog::log($this, "DEBUG: " . print_r($aSegmSearch['resultsegments'], true));
                        $this->results = $unique;
                        break;
                    default:
                        throw new Exception("Bad value for app_defaults_segm_search_aggregation_algo: " . sfConfig::get('app_defaults_segm_search_aggregation_algo', 0));
                        break;
                }
            } else {
                // segmented search enabled
                // nothing to do, normal search
            }
            // segmented search enabled
            // not used in _result.php
            //			$this -> distances = smintSmafeHelper::getDistances($this -> results);
            $this->files = $this->queryMetadataDatabase($this->results);
            //mysfLog::log($this, "DEBUG: " . print_r($this -> files, true));
            // depending on whether it is an upload or not
            if ($bUploadedFile) {
                //tracknr is before underscore in filename
                $fileNameParts = explode("_", $filename);
                $tracknr = $fileNameParts[0];
                $uploadedFileURL = _compute_public_path($filename, 'uploads/mp3uploads', 'mp3', false);
                //url_for("getAudioFile/download") . "?uploaded=" . rawurlencode($filename);
                // the url for getting the file via PHP, but incomplete. Format parameter is missing and will be
                // appended in mp3 helper class
                $uploadedFilePHPUrl_incomplete = url_for("getAudioFile/download", true) . "?uploaded=" . rawurlencode(basename($filename));
                if ($aSegmSearch['enabled']) {
                    $seedLabel = intval(($aSegmSearch['endSegment'] - $aSegmSearch['startSegment']) / 1000) . " seconds from {$originalFilename}";
                    if ($bMDsearch) {
                        $seedlabel_topleft = "Seed track, results filtered by " . $metadataquery;
                    } else {
                        $seedlabel_topleft = "Seed track";
                    }
                } else {
                    $seedLabel = $originalFilename;
                    if ($bMDsearch) {
                        $seedlabel_topleft = "Seed track, results filtered by " . $metadataquery;
                    } else {
                        $seedlabel_topleft = "Seed track";
                    }
                }
            } else {
                $queryFileMetadata = FiledescPeer::retrieveByPk($tracknr);
                $fileInfoName = $queryFileMetadata->getTitle() . " - " . $queryFileMetadata->getPerformers();
                $uploadedFilePHPUrl_incomplete = url_for("getAudioFile/download", true) . "?tracknr=" . rawurlencode($tracknr);
                $uploadedFileURL = smintUploadFileHelper::getDirectFileUrl($fileForSearchSimilar->getUri());
                $seedLabel = $fileInfoName;
                if ($bMDsearch) {
                    $seedlabel_topleft = "Acoustic similarity, filtered by " . $metadataquery;
                } else {
                    $seedlabel_topleft = "Acoustic similarity";
                }
            }
            return $this->renderPartial('search/result', array('render' => 'related', 'id_prefix' => "id_prefix", 'tracknr' => $tracknr, 'uploadedFilePHPUrl_incomplete' => $uploadedFilePHPUrl_incomplete, 'uploadedFileURL' => $uploadedFileURL, 'files' => $this->files, 'queryTrackIsUploaded' => true, 'seedLabel' => $seedLabel, 'limit' => $this->limit, 'metadataquery' => $metadataquery, 'empty_livequery' => $empty_livequery, 'empty_metadatafilteredquery' => $empty_metadatafilteredquery, 'aSegmSearch' => $aSegmSearch, 'seedlabel_topleft' => $seedlabel_topleft));
        } catch (Exception $e) {
            // an error occoured while trying to query the file
            mysfLog::log($this, "STARTING the QUERY failed: " . $e->getMessage());
            return $this->renderPartial('search/error', array('error_message' => $e->getMessage()));
        }
    }
Example #8
0
 /** Returns appropriate JS code for Smintplayer embedding for Seed song.
  * <p>Note: this function returns more code that the counterpart "getMp3PlayerConfig"
  * @param $uploadedFilePHPUrl_incomplete incomplete download url for file. format can be appended
  * @param $uploadedFileURL url of original file uploaded (curretnly used as mp3 although this might not be true)
  *
  */
 public static function getMp3PlayerConfig4Seedsong($uploadedFilePHPUrl_incomplete, $uploadedFileURL)
 {
     //needed for javascript_tag
     use_helper('JavascriptBase');
     $player = sfConfig::get('app_mp3player_defaultplayer', 'worldpress');
     switch ($player) {
         case 'flash-mp3-player':
             return 'not implemented';
             break;
         case 'worldpress':
             return 'not implemented';
             break;
         case 'smintplayer':
         default:
             if (smintTools::endsWith($uploadedFileURL, "mp3")) {
                 $audiofile_mp3 = $uploadedFileURL;
                 $audiofile_ogg = $uploadedFilePHPUrl_incomplete . "&format=ogg";
                 $orig_ext_comma = "";
                 $setmedia_orig_part = "";
             } elseif (smintTools::endsWith($uploadedFileURL, "ogg")) {
                 $audiofile_mp3 = $uploadedFilePHPUrl_incomplete . "&format=mp3";
                 $audiofile_ogg = $uploadedFileURL;
                 $orig_ext_comma = "";
                 $setmedia_orig_part = "";
             } else {
                 $audiofile_mp3 = $uploadedFilePHPUrl_incomplete . "&format=mp3";
                 $audiofile_ogg = $uploadedFilePHPUrl_incomplete . "&format=ogg";
                 $audiofile_orig = $uploadedFileURL;
                 $orig_ext = smintTools::getExtension($uploadedFileURL);
                 $orig_ext_comma = "{$orig_ext},";
                 $setmedia_orig_part = "{$orig_ext}: \$('#jquery_jplayer_2').jPlayer('option', 'playlist')[0].audiofile_orig,";
             }
             // get configuration
             $playerConfig = sfConfig::get('app_mp3player_smintplayer');
             // build options array of array. First dimension is list of files, second is assoc array with values for the player
             $options = array();
             if (!isset($aSegmSearch['enabled'])) {
                 $aSegmSearch['enabled'] = false;
             }
             $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0;
             $hostname = $_SERVER['SERVER_ADDR'];
             $port = $_SERVER['SERVER_PORT'];
             $server = $protocol . $hostname . ":" . $port;
             $tmparray = array('text' => '', 'audiofile_mp3' => $audiofile_mp3, 'audiofile_ogg' => $audiofile_ogg, 'audiofile_orig' => isset($audiofile_orig) && $audiofile_orig ? $audiofile_orig : "not used", 'waveformimage' => $uploadedFilePHPUrl_incomplete . "&format=png", 'duration' => '', 'segments' => $aSegmSearch['enabled'] ? $aSegmSearch['resultsegments'][$i] : array());
             // we cannot put all these fields into one array since the output format must be like
             // , A: XXXX, B: XXX
             // and not
             //, {A: XXXX, B: XXX}
             $options[] = $tmparray;
             $playlist_part = ", playlist: " . smintTools::my_options_for_javascript($options) . ", waveform_resolution: " . intval(sfConfig::get('app_defaults_waveform_resolution')) . ', waveform_factor: ' . doubleval(sfConfig::get('app_defaults_waveform_factor'));
             $general_part = "\n\t\t\t\tready: function () {\n\t\t\t\t\t\$(this).jPlayer('setMedia', {\n\t\t\t\t\t\t{$setmedia_orig_part}\n\t\t\t\t\t\tmp3: \$('#jquery_jplayer_2').jPlayer('option', 'playlist')[0].audiofile_mp3,\n\t\t\t\t\t\toga: \$('#jquery_jplayer_2').jPlayer('option', 'playlist')[0].audiofile_ogg\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tplay: function() { // To avoid both jPlayers playing together.\n\t\t\t\t\t\$(this).jPlayer('pauseOthers');\n\t\t\t\t},\n\t\t\t\tswfPath:  ' " . _compute_public_path('', 'smintplayer/js', '', false) . "'  ,\n\t\t\t\tsupplied: '{$orig_ext_comma} mp3, oga',\n\t\t\t\tsolution: 'flash, html', \n\t\t\t\tcssSelectorAncestor: '#jp_container_2',\n\t\t\t\twmode: 'window',\n\t\t\t\tpreload: 'auto'\n\t\t\t\t" . $playlist_part;
             return $general_part;
             break;
     }
 }
function lw_media($name = '', $path = '', $options = array())
{
    return lw_link($name, _compute_public_path($path, '', '', true), $options);
}
Example #10
0
/**
 * Returns the path to an image asset.
 *
 * <b>Example:</b>
 * <code>
 *  echo image_path('foobar');
 *    => /images/foobar.png
 * </code>
 *
 * <b>Note:</b> The asset name can be supplied as a...
 * - full path, like "/my_images/image.gif"
 * - file name, like "rss.gif", that gets expanded to "/images/rss.gif"
 * - file name without extension, like "logo", that gets expanded to "/images/logo.png"
 *
 * @param string $source   asset name
 * @param bool   $absolute return absolute path ?
 *
 * @return string file path to the image file
 * @see    image_tag
 */
function image_path($source, $absolute = false)
{
    return _compute_public_path($source, sfConfig::get('sf_web_images_dir_name', 'images'), 'png', $absolute);
}
Example #11
0
/**
 * Returns the path to an image asset.
 *
 * <b>Example:</b>
 * <code>
 *  echo image_path('foobar');
 *    => /images/foobar.png
 * </code>
 *
 * <b>Note:</b> The asset name can be supplied as a...
 * - full path, like "/my_images/image.gif"
 * - file name, like "rss.gif", that gets expanded to "/images/rss.gif"
 * - file name without extension, like "logo", that gets expanded to "/images/logo.png"
 * 
 * @param  string $source    asset name
 * @param  bool   $absolute  return absolute path ?
 *
 * @return string file path to the image file
 * @see    image_tag  
 */
function image_path($source, $absolute = false, $override = false)
{
    // CHANGE TO SYMFONY'S ASSETHELPER
    if (!$override && sfConfig::get('app_amazon_enable_s3')) {
        $source = ImageTable::generateS3Url($source);
    }
    return _compute_public_path($source, 'images', 'png', $absolute);
}
Example #12
0
 public function setFeedEnclosure($enclosure = null)
 {
     if ($enclosure instanceof FeedEnclosure) {
         $this->enclosure = $enclosure;
         return $enclosure;
     }
     $type = $enclosure == null ? 'web' : $enclosure;
     $params = array();
     switch ($type) {
         case 'web':
             $params['url'] = $this->getWebUrl();
             // fixme this should return webloc not local path REGRESSION
             $params['length'] = $this->getSize();
             $params['mimeType'] = $this->getMimeType();
             break;
         case 'magnet':
             $params['url'] = $this->getMagnet();
             $params['length'] = $this->getSize();
             $params['mimeType'] = $this->getMimeType();
             break;
         case 'torrent':
             $params['url'] = _compute_public_path($this->getFile() . '.torrent', 'uploads', '', true);
             $params['length'] = filesize($this->getTorrentPath());
             $params['mimeType'] = 'application/x-bittorrent';
             break;
         default:
             throw new limeException('enclosure', "Unsupported enclosure type {$type}");
     }
     $this->enclosure = new sfFeedEnclosure();
     return $this->enclosure->initialize($params);
 }
Example #13
0
" method="POST" enctype="multipart/form-data">
      <table>

      <?php 
include_partial('torrent/torrentform', array('form' => $form));
?>
      <tr>
          <td>&nbsp;</td>
          <td colspan="2">
          <input type="submit" value="Save"/>
          </td>
      </tr>
      </table>
  </form>
  <script type="text/javascript">
    var add_url = '<?php 
echo url_for('torrent/add');
?>
';
    var csrf_token = '<?php 
echo _compute_public_path($form->getDefault('_csrf_token'), 'json-cache', 'json');
?>
';
    $('torrent_<?php 
echo $form->getDefault('feed_id');
?>
').observe('submit', sideload);
  </script>

</div>
Example #14
0
<html>
  <head>
    <?php include_title() ?>
    <?php include_stylesheets() ?>
    <!--[if IE]>
    <?php echo stylesheet_tag(_compute_public_path('sfControlPanelPlugin/css/ie', '.', 'css')) ?>
    <![endif]-->
  </head>
  <body>
    
    <div id="header">
    <?php include_component('sfControlPanel', 'header') ?>
    </div>
    
    <div id="sidebar">
    <?php if(has_slot('sidebar')): ?>
      <?php include_slot('sidebar') ?>
    <?php else: ?>
      <?php include_component('sfControlPanel', 'dataSidebar') ?>
    <?php endif; ?>
    </div>
    
    <div id="main">
    <?php echo $sf_data->getRaw('sf_content') ?>
    </div>
    
  </body>
</html>
Example #15
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <?php 
include_http_metas();
?>
  <?php 
include_metas();
?>
  <?php 
include_title();
?>
  <link rel="shortcut icon" type="image/png"  href="<?php 
echo _compute_public_path('genghis', 'images', 'png');
?>
" />
  <?php 
include_less_stylesheets();
?>
  <?php 
include_javascripts();
?>
</head>
<body>

<div class="wrapper">
  <?php 
include_component_slot('menu');
?>
  <div class="container">
    <?php 
Example #16
0
/**
 * Returns the path to a flash swf movie.
 *
 * <b>Example:</b>
 * <code>
 *  echo flash_path('mymovie');
 *    => /swf/mymovie.swf
 * </code>
 *
 * <b>Note:</b> The asset name can be supplied as a...
 * - full path, like "/swf/movie.swf"
 * - file name, like "movie.swf", that gets expanded to "/swf/movie.swf"
 * - file name without extension, like "movie", that gets expanded to "/swf/movie.css"
 *
 * @param  string asset name
 * @param  bool return absolute path ?
 * @return string file path to the flash movie file
 */
function flash_path($source, $absolute = false)
{
    return _compute_public_path($source, 'swf', 'swf', $absolute);
}
/**
 *
 * @package    opPainterPlugin
 * @subpackage helper
 * @author     Masato Nagasawa <*****@*****.**>
 */
function pch_path($filename)
{
    return _compute_public_path($filename, 'cache/pch', 'pch');
}
Example #18
0
function employeePictureTag($employee)
{
    return '<img alt="Headshot" style="float:left;padding:0 15px;" hspace="5" src="' . _compute_public_path($employee->getPicture(), 'uploads/' . sfConfig::get('app_employee_images_dir', 'employee') . '/', 'png') . '" />';
}
Example #19
0
    return ($absolute ? '/' : '').$parameters;
  }
}

$context = sfContext::getInstance(array('request' => 'myRequest', 'response' => 'myResponse', 'controller' => 'myController'));

// _compute_public_path()
$t->diag('_compute_public_path');
$t->is(_compute_public_path('foo', 'css', 'css'), '/css/foo.css', '_compute_public_path() converts a string to a web path');
$t->is(_compute_public_path('foo', 'css', 'css', true), 'http://localhost/css/foo.css', '_compute_public_path() can create absolute links');
$t->is(_compute_public_path('foo.css2', 'css', 'css'), '/css/foo.css2', '_compute_public_path() does not add suffix if one already exists');
$context->request->relativeUrlRoot = '/bar';
$t->is(_compute_public_path('foo', 'css', 'css'), '/bar/css/foo.css', '_compute_public_path() takes into account the relative url root configuration');
$context->request->relativeUrlRoot = '';
$t->is(_compute_public_path('foo.css?foo=bar', 'css', 'css'), '/css/foo.css?foo=bar', '_compute_public_path() takes into account query strings');
$t->is(_compute_public_path('foo?foo=bar', 'css', 'css'), '/css/foo.css?foo=bar', '_compute_public_path() takes into account query strings');

$compatMode = sfConfig::get('sf_compat_10');
sfConfig::set('sf_compat_10', false);
// image_tag()
$t->diag('image_tag()');
$t->is(image_tag(''), '', 'image_tag() returns nothing when called without arguments');
$t->is(image_tag('test'), '<img src="/images/test.png" />', 'image_tag() takes an image name as its first argument');
$t->is(image_tag('test.png'), '<img src="/images/test.png" />', 'image_tag() can take an image name with an extension');
$t->is(image_tag('/images/test.png'), '<img src="/images/test.png" />', 'image_tag() can take an absolute image path');
$t->is(image_tag('/images/test'), '<img src="/images/test.png" />', 'image_tag() can take an absolute image path without extension');
$t->is(image_tag('test.jpg'), '<img src="/images/test.jpg" />', 'image_tag() can take an image name with an extension');
$t->is(image_tag('test', array('alt' => 'Foo')), '<img alt="Foo" src="/images/test.png" />', 'image_tag() takes an array of options as its second argument to override alt');
$t->is(image_tag('test', array('size' => '10x10')), '<img src="/images/test.png" height="10" width="10" />', 'image_tag() takes a size option');
$t->is(image_tag('test', array('absolute' => true)), '<img src="http://localhost/images/test.png" />', 'image_tag() can take an absolute parameter');
$t->is(image_tag('test', array('class' => 'bar')), '<img class="bar" src="/images/test.png" />', 'image_tag() takes whatever option you want');
Example #20
0
					$(this).jPlayer("setMedia", {
						mp3:$("#jquery_jplayer_1").jPlayer("option", "playlist")[0].audiofile_mp3,
						oga: $("#jquery_jplayer_1").jPlayer("option", "playlist")[0].audiofile_ogg
					});
				$(".song0").parent().parent().removeClass("item");	
				$(".song0").parent().parent().addClass("playing");	
				$("#jquery_jplayer_1").jPlayer("option", "cssSelector", {seekBar: ".jp-seek-bar0"});
				$("#jquery_jplayer_1").jPlayer("option", "cssSelector", {playBar: ".jp-play-bar0"});
						
				},	
				play: function() { // To avoid both jPlayers playing together.
					$(this).jPlayer("pauseOthers");
				},
				cssSelectorAncestor: "#jp_container_1",
				swfPath:  <?php 
    echo "'" . _compute_public_path('', 'smintplayer/js', '', false) . "'";
    ?>
  ,
				supplied: "mp3, oga",
				solution: "flash, html",
				wmode: "window",
				preload: "auto"
				
						<?php 
    echo MP3PlayerHelper::getMp3PlayerConfig($files, $aSegmSearch);
    ?>
					});
								
	initResults(1);
	
	/*Resultlist dropdown menu init and options*/
Example #21
0
function _op_url_cmd($matches)
{
    $url = $matches[2] . $matches[3];
    $cmd = '';
    if ($matches[2] == 'www.') {
        $cmd .= 'www.';
        $url = 'http://www.' . $url;
    }
    if (preg_match('/([a-zA-Z0-9\\-.]+)\\/?(?:[a-zA-Z0-9_\\-\\/.,:;\\~\\?@&=+$%#!()])*/', $matches[3], $pmatch)) {
        $cmd .= $pmatch[1];
    }
    $file = $cmd . '.js';
    $path = './cmd/' . $file;
    if (preg_match('/<a/', $matches[1]) || !is_readable($path)) {
        return op_auto_link_text($matches[0]);
    }
    sfContext::getInstance()->getResponse()->addJavascript('util');
    $googlemapsUrl = url_for('@google_maps');
    $public_path = _compute_public_path($file, 'cmd', 'js');
    $result = <<<EOD
<script type="text/javascript" src="{$public_path}"></script>
<script type="text/javascript">
<!--
url2cmd('{$url}', '{$googlemapsUrl}');
//-->
</script>
EOD;
    return $result . $matches[4];
}
Example #22
0
 /** Builds a public url for generated files, given the local filename
  * This is only a temporary workaround since file serving with PHP does not work
  * as expected */
 public static function getDirectFileUrl_for_uploads($uri)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Asset');
     return _compute_public_path(rawurlencode(basename($uri)), 'uploads/mp3uploads', '', false);
 }
?>
		
<?php 
use_javascript('effects.js');
?>
		
<?php 
use_javascript('dragdrop.js');
?>
		
<?php 
use_javascript('popup.js');
?>
		
<link href="<?php 
echo _compute_public_path('popup', 'css', 'css', false);
?>
" rel="stylesheet" type="text/css" />	
<div id="main_content">
	<div class="box_content">
	<div class="box_title">
		<h2><span class="dark_blue">Patient Detail</h2>
		
	</div>
	<div class="box_text_content">
	<div class="box_text">

	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="datagrid">
	  <tr>
		<th width="15%" style="text-align:left;">Patient's ID</th>
		<th width="44%" style="text-align:left;">Patient's Name</th>
Example #24
0
 protected function getCombinedStylesheets()
 {
     $root_css_only = sfConfig::get('app_sf_combine_filter_plugin_root_css_only', false);
     $already_seen = array();
     $combined_sources = array();
     foreach (array('first', '', 'last') as $position) {
         foreach ($this->response->getStylesheets($position) as $files => $options) {
             if (!is_array($files)) {
                 $files = array($files);
             }
             foreach ($files as $file) {
                 if (isset($already_seen[$file])) {
                     continue;
                 }
                 $already_seen[$file] = 1;
                 if (is_array($options) && ($this->isInvalidMediaType($options) || $this->isAbsolutePath($options))) {
                     continue;
                 }
                 $path = str_replace($this->request->getRelativeUrlRoot(), '', _compute_public_path($file, 'css', 'css'));
                 if (!$root_css_only && !strpos($path, '://') && strpos($path, '.css') || $root_css_only && strpos($path, $this->sf_relative_url_root . '/css/') === 0) {
                     $element = !$root_css_only ? preg_replace("/^" . str_replace('/', '\\/', $this->sf_relative_url_root . '/css/') . "/i", '', $path) : $path;
                     if ($this->checkFile($element)) {
                         $combined_sources[] = $element;
                         $this->response->removeStylesheet($file, $position ? $position : '');
                     }
                 }
             }
         }
     }
     if (count($combined_sources)) {
         $cacheFileName = $this->lastmodified . '-' . md5(implode(',', $combined_sources));
         if ($this->cacheFile($cacheFileName)) {
             $combined_sources_str = $this->request->getRelativeUrlRoot() . "/packed/css/{$cacheFileName}/packed.css";
             //TODO: keep track if there is a dynamic file in the middle of static files and create multiple packed files
             // if required to keep the proper order
             $this->response->addStylesheet($combined_sources_str, 'first');
         }
     }
 }
Example #25
0
/**
 * Returns the path to an image asset.
 *
 * <b>Example:</b>
 * <code>
 *  echo image_path('foobar');
 *    => /images/foobar.png
 * </code>
 *
 * <b>Note:</b> The asset name can be supplied as a...
 * - full path, like "/my_images/image.gif"
 * - file name, like "rss.gif", that gets expanded to "/images/rss.gif"
 * - file name without extension, like "logo", that gets expanded to "/images/logo.png"
 *
 * @param string $source   asset name
 * @param bool   $absolute return absolute path ?
 *
 * @return string file path to the image file
 * @see    image_tag
 */
function image_path($source, $absolute = false)
{
    return _compute_public_path($source, 'images', 'png', $absolute);
}
  </ul>
 
 
</ul>
<?php end_slot() ?>

<div id="feedback">

<div id="apps_envs" class="summary">
  <h1>Applications and environments</h1>
  <?php foreach ($apps as $app) : ?>
  <ul>
    <li class="application"><?php echo $app ?></li>
    <ul>  
      <?php foreach ($environments[$app] as $name => $controller): ?>
      <li><a href="<?php echo _compute_public_path($controller, '.', '') ?>">Browse in <?php echo $name ?></a></li>
      <?php endforeach; ?>
    </ul>
  </ul>
  <?php endforeach; ?>
</div>

<div id="sf_libraries" class="summary">
  <h1>Symfony files</h1>
  <ul>
  <li>Version: <?php echo $sf_version ?></li>
  <li>Path to libraries</li>
  <ul>
    <li><?php echo sfConfig::get('sf_symfony_lib_dir') ?></li>
    <li><?php echo sfConfig::get('sf_symfony_data_dir') ?></li>
  </ul>