@Route("/media/{id}-{name}", name="media_show_public")
@Route("/media/{filter}/{id}-{name}", name="media_show_public_filters")
@Route("/media/{secretKey}/{filter}", name="media_show_private")

@Method({"GET"})
518921
public function showMediaAction(Request $request, Media $media, $filter = null)
    {
        $response = new Response();
        $lastModified = new \DateTime('now');

        //Checking if it is an image or not
        $src = $this->get('alpixel_media.manager')->getAbsolutePath($media);
        $isImage = @getimagesize($src);

        try {
            if ($isImage) {
                $response->headers->set('Content-disposition', 'inline;filename='.$media->getName());
                if (!empty($filter) && $isImage) {
                    $src = $this->get('alpixel_media.manager')->getAbsolutePath($media, $filter);
                    $dataManager = $this->get('liip_imagine.data.manager'); // the data manager service
                    $filterManager = $this->get('liip_imagine.filter.manager'); // the filter manager service
                    $uploadDir = $this->get('alpixel_media.manager')->getUploadDir($filter);

                    if (!is_file($src)) {
                        $fs = new Filesystem();
                        if (!$fs->exists($uploadDir.$media->getFolder())) {
                            $fs->mkdir($uploadDir.$media->getFolder());
                        }

                        $path = 'upload/'.$media->getUri();

                        // find the image and determine its type
                        $image = $dataManager->find($filter, $path);

                        // run the filter
                        $responseData = $filterManager->applyFilter($image, $filter);
                        $data = $responseData->getContent();
                        file_put_contents($uploadDir.$media->getUri(), $data);
                    } else {
                        $data = file_get_contents($src);
                        $lastModified->setTimestamp(filemtime($src));
                    }
                } else {
                    $src = $this->get('alpixel_media.manager')->getAbsolutePath($media);
                    $lastModified->setTimestamp(filemtime($src));
                    $data = file_get_contents($src);
                }
            } else {
                $lastModified->setTimestamp(filemtime($src));
                $data = file_get_contents($src);
                $response->headers->set('Content-disposition', 'attachment;filename='.basename($media->getUri()));
            }

            if ($data === false) {
                throw $this->createNotFoundException();
            }
        } catch (\Exception $e) {
            throw $this->createNotFoundException($e->getMessage());
        }

        $response->setLastModified($lastModified);
        $response->setPublic();
        $response->headers->set('Content-Type', $media->getMime());

        if ($response->isNotModified($request)) {
            return $response;
        }

        $response->setContent($data);

        return $response;
    }
55143
def community_post_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/community/posts/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
513308
public function show($id)
    {
        // get permissions and roles of a route by id
        $routePermission = RoutePermission::find($id);

        if (!$routePermission) {
            return response()->json(null, 404);
        }

        return response()->json(arrayView('phpsoft.users::routePermission/read', [
            'routePermission' => $routePermission
        ]), 200);
    }
575057
function() {
        const params = {
            access_token: this.opts.accessToken,
        };
        return {
            base: this.opts.baseUrl,
            path: "/_matrix/media/v1/upload",
            params: params,
        };
    }
1370666
def request_upload_secret(self, secret_id):
        
        return self._router.post_request_upload_secret(org_id=self.organizationId,
                                                       instance_id=self.instanceId,
                                                       secret_id=secret_id).json()
1345679
public function indexAction()
    {
        /* @todo: move this into a listener.
         *
         * The following lines allow to override get param[q] with the
         * param from route. This feature is needed for a landing-page feature, where
         * human readable urls like http://yawik.org/demo/de/jobs/sales.html
         *
         * move the Logic into a Listener, which can be activated, if needed
         */
        $request = $this->getRequest();
        $getParams = $request->getQuery();
        $routeParams = $this->params()->fromRoute();
        if (isset($routeParams['q']) && !isset($getParams['q'])) {
            $getParams['q']=$routeParams['q'];
        }

        $result = $this->pagination([
                'params' => ['Jobs_Board', [
                    'q',
                    'count' => $this->options['count'],
                    'page' => 1,
                    'l',
                    'd' => 10]
                ],
                'form' => ['as' => 'filterForm', 'Jobs/JobboardSearch'],
                'paginator' => ['as' => 'jobs', 'Jobs/Board']
            ]);

        $organizationImageCache = $this->imageFileCacheManager;

        $result['organizationImageCache'] = $organizationImageCache;

        return new ViewModel($result);
    }
1184387
public static function ApiRoutes(){
        Route::group(['prefix' => 'geo'], function(){
            Route::get('search/{name}/{parent_id?}',    '\Igaster\LaravelCities\GeoController@search');
            Route::get('item/{id}',         '\Igaster\LaravelCities\GeoController@item');
            Route::get('items/{ids}',       '\Igaster\LaravelCities\GeoController@items');
            Route::get('children/{id}',     '\Igaster\LaravelCities\GeoController@children');
            Route::get('parent/{id}',       '\Igaster\LaravelCities\GeoController@parent');
            Route::get('country/{code}',    '\Igaster\LaravelCities\GeoController@country');
            Route::get('countries',         '\Igaster\LaravelCities\GeoController@countries');
        });
    }
945677
public function privateDownloadUrl($publicId, $format, $options = array())
    {
        return $this->getCloudinary()->private_download_url($publicId, $format, $options);
    }
1041884
public function viewImageAction(Request $request, $id, $format = MediaProviderInterface::FORMAT_REFERENCE)
    {
        $media = $this->getMedia($id);

        if (!$media) {
            throw new NotFoundHttpException(sprintf('unable to find the media with the id : %s', $id));
        }

        if (!$this->get('sonata.media.pool')->getDownloadStrategy($media)->isGranted($media, $request)) {
            throw new AccessDeniedException();
        }
        $provider = $this->getProvider($media);

        return new RedirectResponse($provider->generatePublicUrl($media, $format));
    }
546334
def view_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/views/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
283682
public function deleteMedia()
    {
        $mediaMapper = ($this->container->dataMapper)('MediaMapper');

        // Get the media record
        if (null !== $id = $this->request->getParsedBodyParam('id')) {
            $mediaFile = $mediaMapper->findById($id);

            if (is_string($mediaFile->file)) {
                $rootDir = substr($mediaFile->file, 0, 2);
                $this->deleteRecursive(ROOT_DIR . 'public/media/' . $rootDir);

                $mediaMapper->delete($mediaFile);
            }
        }

        // Set the response type
        if ($this->request->isXhr()) {
            $r = $this->response->withHeader('Content-Type', 'application/json');
            return $r->write(json_encode(["status" => "success"]));
        }

        return $this->redirect('adminShowMedia');
    }
193259
public function showAction(Request $request, $id)
    {
        $prefix = '';

        if ($request->query->get('prefix')) {
            $prefix = $request->query->get('prefix');
        }

        $section = $this->getSection($id, false);
        $terms = $section->getTerms();

        return array(
            'section' => $terms->getRoot(),
            'terms' => $terms,
            'prefix' => $prefix
        );
    }
771877
function() {
		var api_url,
			self = this;

		// Create Dom element
		this._el.content_item	= TL.Dom.create("div", "tl-media-item tl-media-iframe tl-media-dailymotion", this._el.content);

		// Get Media ID
		if (this.data.url.match("video")) {
			this.media_id = this.data.url.split("video\/")[1].split(/[?&]/)[0];
		} else {
			this.media_id = this.data.url.split("embed\/")[1].split(/[?&]/)[0];
		}

		// API URL
		api_url = "https://www.dailymotion.com/embed/video/" + this.media_id+"?api=postMessage";

		// API Call
		this._el.content_item.innerHTML = "<iframe autostart='false' frameborder='0' width='100%' height='100%' src='" + api_url + "'></iframe>"

		// After Loaded
		this.onLoaded();
	}
452683
private function mediaQualifiedRelatedKey()
    {
        $relation = $this->media();
        // Laravel 5.5
        if (method_exists($relation, 'getQualifiedRelatedPivotKeyName')) {
            return $relation->getQualifiedRelatedPivotKeyName();
        // Laravel 5.4
        } elseif (method_exists($relation, 'getQualifiedRelatedKeyName')) {
            return $relation->getQualifiedRelatedKeyName();
        }
        // Laravel <= 5.3
        return $relation->getOtherKey();
    }
784657
function() {
		var api_url,
			self = this;

		// Create Dom element
		this._el.content_item	= TL.Dom.create("div", "tl-media-item tl-media-iframe tl-media-spotify", this._el.content);

		// Get Media ID
		if (this.data.url.match(/^spotify:track/) || this.data.url.match(/^spotify:album/) || this.data.url.match(/^spotify:user:.+:playlist:/)) {
			this.media_id = this.data.url;
		}

		if (this.data.url.match(/spotify\.com\/track\/(.+)/)) {
			this.media_id = "spotify:track:" + this.data.url.match(/spotify\.com\/track\/(.+)/)[1];
		} else if (this.data.url.match(/spotify\.com\/album\/(.+)/)) {
			this.media_id = "spotify:album:" + this.data.url.match(/spotify\.com\/album\/(.+)/)[1];
		} else if (this.data.url.match(/spotify\.com\/user\/(.+?)\/playlist\/(.+)/)) {
			var user = this.data.url.match(/spotify\.com\/user\/(.+?)\/playlist\/(.+)/)[1];
			var playlist = this.data.url.match(/spotify\.com\/user\/(.+?)\/playlist\/(.+)/)[2];
			this.media_id = "spotify:user:" + user + ":playlist:" + playlist;
		} else if (this.data.url.match(/spotify\.com\/artist\/(.+)/)) {
			var artist = this.data.url.match(/spotify\.com\/artist\/(.+)/)[1];
			this.media_id = "spotify:artist:" + artist;
		}


		if (this.media_id) {
			// API URL
			api_url = "https://embed.spotify.com/?uri=" + this.media_id + "&theme=white&view=coverart";

			this.player = TL.Dom.create("iframe", "tl-media-shadow", this._el.content_item);
			this.player.width 		= "100%";
			this.player.height 		= "100%";
			this.player.frameBorder = "0";
			this.player.src 		= api_url;

			// After Loaded
			this.onLoaded();

		} else {
				this.loadErrorDisplay(this._('spotify_invalid_url'));
		}
	}
242217
public function show($id)
    {
        $filters = [];
//        // handle permission
//        $filters = $this->handlePermission(__FUNCTION__);

        // Create Response Model
        $response = new ResponseModel();

        // try to get data
        try {
            $response->setMessage($this->getTrans('show', 'successful'));

            // add filter to get desired record
            array_push($filters,
                [$this->model->getKeyName(), '=', $id]
            );
            $data = $this->model
                ->where($filters)
                ->get();
            $response->setData($data);

            // catch exception
        } catch (Exception $exception) {
            $response->setError($exception->getCode());
            $response->setMessage($this->getTrans('show', 'failed'));
            $response->setStatus(false);
            if (env('APP_DEBUG', false)) {
                $response->setData(collect($exception->getMessage()));
            }
        }
        return SmartResponse::response($response);
    }
323817
function privateBrowsing(controller) {
  this._controller = controller;
  this._handler = null;

  /**
   * Menu item in the main menu to enter/leave Private Browsing mode
   * @private
   */
  this._pbMenuItem = new elementslib.Elem(this._controller.menus['tools-menu'].privateBrowsingItem);
  this._pbTransitionItem = new elementslib.ID(this._controller.window.document, "Tools:PrivateBrowsing");

  this.__defineGetter__('_pbs', function() {
    delete this._pbs;
    return this._pbs = Cc["@mozilla.org/privatebrowsing;1"].
                       getService(Ci.nsIPrivateBrowsingService);
  });
}