コード例 #1
0
ファイル: sfThumbnailHelper.php プロジェクト: net7/Talia-CMS
/**
 * Get the path of a generated thumbnail for any given image
 *
 * @param string $source
 * @param int $width
 * @param int $height
 * @param boolean $absolute
 * @return string
 */
function thumbnail_path($source, $width, $height, $absolute = false)
{
    $thumbnails_dir = sfConfig::get('app_sfThumbnail_thumbnails_dir', 'uploads/thumbnails');
    $width = intval($width);
    $height = intval($height);
    if (substr($source, 0, 1) == '/') {
        $realpath = sfConfig::get('sf_web_dir') . $source;
    } else {
        $realpath = sfConfig::get('sf_web_dir') . '/images/' . $source;
    }
    $real_dir = dirname($realpath);
    $thumb_dir = '/' . $thumbnails_dir . substr($real_dir, strlen(sfConfig::get('sf_web_dir')));
    $thumb_name = preg_replace('/^(.*?)(\\..+)?$/', '$1_' . $width . 'x' . $height . '$2', basename($source));
    $img_from = $realpath;
    $thumb = $thumb_dir . '/' . $thumb_name;
    $img_to = sfConfig::get('sf_web_dir') . $thumb;
    if (!is_dir(dirname($img_to))) {
        if (!mkdir(dirname($img_to), 0777, true)) {
            throw new Exception('Cannot create directory for thumbnail : ' . $img_to);
        }
    }
    if (!is_file($img_to) || filemtime($img_from) > filemtime($img_to)) {
        $thumbnail = new sfThumbnail($width, $height);
        $thumbnail->loadFile($img_from);
        $thumbnail->save($img_to);
    }
    return image_path($thumb, $absolute);
}
コード例 #2
0
ファイル: ThumbHelper.php プロジェクト: ndachez/dachez
/**
 * g?n?rer le thumb correspondant ? une image.
 * cete fonction v?rifie si le thumb existe d?j? ou si la source est plus r?cente
 * si besoin, il est reg?n?r?.
 * il faut faire passer en parametres options[width] et options[height]
 * et l'image est automatiquement redimensionner en thumb.
 * si width = height alors l'image sera tronqu�e et carr�
 *
 * @param <string> $image_name : le nom de l'image donc g?n?ralement le $object->getImage(), pas de r?pertoire
 * @param <string> $folder : le nom du r?pertoire dans uploads o? est stock? l'image : uploads/object/source => $folder = object
 * @param <array> $options : les parametres ? passer ? l'image: width et height
 * @param <string> $resize : l'op?ration sur le thumb: "scale" pour garder les proportions, "center" pour tronquer l'image
 * @param <string> $default : l'image par d?faut si image_name n'existe pas
 * @return <image_path>
 */
function doThumb($image_name, $folder, $options = array(), $resize = 'scale', $default = 'default.jpg')
{
    //valeur par d�faut si elles ne sont pas d�finies
    if (!isset($options['width'])) {
        $options['width'] = 50;
    }
    if (!isset($options['height'])) {
        $options['height'] = 50;
    }
    /*$source_dir = 'uploads/'.$folder.'/source/';
      $thumb_dir  = 'uploads/'.$folder.'/thumb/';*/
    $source_dir = 'uploads/' . $folder . '/';
    $thumb_dir = 'uploads/' . $folder . '/thumb/';
    //le fichier source
    $source = $source_dir . $image_name;
    $exist = sfConfig::get('sf_web_dir') . '/' . $source;
    if (!is_file($exist)) {
        $image_name = $default;
        $source = 'images/' . $image_name;
        // la valeur par d�faut
    }
    $new_name = $options['width'] . 'x' . $options['height'] . '_' . $image_name;
    $new_img = $thumb_dir . $new_name;
    // si le thumb n'existe pas ou s'il est plus ancien que le fichier source
    // alors on reg�n�re le thumb
    if (!is_file(sfConfig::get('sf_web_dir') . '/' . $new_img) or filemtime($source) > filemtime($new_img)) {
        $img = new sfImage($source);
        $img->thumbnail($options['width'], $options['height'], $resize)->saveAs($new_img);
    }
    return image_path('/' . $new_img);
}
コード例 #3
0
ファイル: image.php プロジェクト: bcampbell/journalisted
function image_zap($image_id)
{
    $filename = db_getOne("SELECT filename FROM image WHERE id=?", $image_id);
    db_do("DELETE FROM image WHERE id=?", $image_id);
    db_commit();
    unlink(image_path($filename));
}
コード例 #4
0
function lw_image($name = '', $image_path = '', $options = array())
{
    if (strpos($image_path, '://') === false) {
        return lw_link($name, image_path($image_path, true), $options);
    } else {
        return lw_link($name, $image_path, $options);
    }
}
コード例 #5
0
ファイル: ImagesController.php プロジェクト: BePsvPT/CCU
 public function show($hash, $time, $small = false)
 {
     $image = Image::where('hash', '=', $hash)->where('uploaded_at', '=', Carbon::createFromTimestamp($time))->first();
     if (null === $image) {
         throw new NotFoundHttpException();
     }
     return $this->imageResponse(image_path($hash, $time, $small), $image->getAttribute('mime_type'));
 }
コード例 #6
0
ファイル: Avatar.php プロジェクト: BePsvPT/CCU
 /**
  * Delete the profile picture.
  *
  * @param $id
  */
 protected function deleteOldProfilePicture($id)
 {
     $image = Image::find($id);
     if (null !== $image) {
         unlink(image_path($image->getAttribute('hash'), $image->getAttribute('uploaded_at')->timestamp));
         unlink(image_path($image->getAttribute('hash'), $image->getAttribute('uploaded_at')->timestamp, true));
         $image->delete();
     }
 }
コード例 #7
0
ファイル: comments_helper.php プロジェクト: 8496tar/pyrocms
/**
 * Function to process the items in an X amount of comments
 * 
 * @param array $comments The comments to process
 * @return array
 */
function process_comment_items($comments)
{
    $ci =& get_instance();
    foreach ($comments as &$comment) {
        // work out who did the commenting
        if ($comment->user_id > 0) {
            $comment->name = anchor('admin/users/edit/' . $comment->user_id, $comment->name);
        }
        // What did they comment on
        switch ($comment->module) {
            case 'pages':
                if ($page = $ci->pages_m->get($comment->module_id)) {
                    $comment->item = anchor('admin/pages/preview/' . $page->id, $page->title, 'class="modal-large"');
                    break;
                }
            case 'news':
                if (!module_exists('news')) {
                    break;
                }
                $ci->load->model('news/news_m');
                if ($article = $ci->news_m->get($comment->module_id)) {
                    $comment->item = anchor('admin/news/preview/' . $article->id, $article->title, 'class="modal-large"');
                    break;
                }
            case 'photos':
                if (!module_exists('photos')) {
                    break;
                }
                $ci->load->model('photos/photos_m');
                $ci->load->model('photos/photo_albums_m');
                $photo = $ci->photos_m->get($comment->module_id);
                if ($photo && ($album = $ci->photo_albums_m->get($photo->album_id))) {
                    $comment->item = anchor(image_path('photos/' . $album->id . '/' . $photo->filename), $photo->caption, 'class="modal"');
                    break;
                }
            case 'photos-album':
                if (!module_exists('photos')) {
                    break;
                }
                $ci->load->model('photos/photo_albums_m');
                if ($album = $ci->photo_albums_m->get($comment->module_id)) {
                    $comment->item = anchor('photos/' . $album->slug, $album->title, 'class="modal-large iframe"');
                    break;
                }
            default:
                $comment->item = $comment->module . ' #' . $comment->module_id;
                break;
        }
        // Link to the comment
        if (strlen($comment->comment) > 30) {
            $comment->comment = character_limiter($comment->comment, 30);
        }
    }
    return $comments;
}
コード例 #8
0
ファイル: actions.class.php プロジェクト: 42medien/spreadly
 public function executeGet_images(sfWebRequest $request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Asset');
     $this->getResponse()->setContentType('application/json');
     $lUrl = $request->getParameter("url");
     $lImages = ImageParser::fetch($lUrl);
     $lImages[] = image_path("/img/share/default.png", true);
     $lReturn['count'] = count($lImages);
     $lReturn['html'] = $this->getPartial('like/meta_images_list', array('pImages' => $lImages));
     return $this->renderText(json_encode($lReturn));
 }
コード例 #9
0
 public function configure()
 {
     $startYear = sfConfig::get('app_year_range_start', date('Y') - 5);
     $years = range($startYear, date('Y') + 5);
     $sfWidgetFormI18nJQueryDateOptions = array('culture' => $this->getOption('culture', 'en'), 'image' => image_path('icons/calendar.png'), 'config' => "{ duration: '' }", 'years' => array_combine($years, $years));
     $this->setWidgets(array('query' => new sfWidgetFormInputText(), 'from' => new sfWidgetFormI18nJQueryDate($sfWidgetFormI18nJQueryDateOptions), 'to' => new sfWidgetFormI18nJQueryDate($sfWidgetFormI18nJQueryDateOptions), 'quick_dates' => new sfWidgetFormChoice(array('choices' => InvoiceSearchForm::getQuickDates()))));
     $this->widgetSchema->setLabels(array('query' => 'Search', 'from' => 'from', 'to' => 'to', 'quick_dates' => ' '));
     $dateRangeValidatorOptions = array('required' => false);
     $this->setValidators(array('query' => new sfValidatorString(array('required' => false, 'trim' => true)), 'from' => new sfValidatorDate($dateRangeValidatorOptions), 'to' => new sfValidatorDate($dateRangeValidatorOptions)));
     $this->widgetSchema->setNameFormat('search[%s]');
     $this->widgetSchema->setFormFormatterName('list');
 }
コード例 #10
0
 public function formatter($widget, $inputs)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Asset');
     $rows = array();
     foreach ($inputs as $key => $input) {
         $image_option = array('src' => image_path($this->getOption('image_prefix') . $key), 'alt' => $this->getOption('image_prefix') . $key);
         $image = $this->renderTag('img', $image_option);
         $list = $this->renderContentTag('dt', $image) . $this->renderContentTag('dd', $input['input'] . $this->getOption('label_separator') . $input['label']);
         $rows[] = $this->renderContentTag('dl', $list);
     }
     return $this->renderContentTag('div', implode($this->getOption('separator'), $rows), array('class' => $this->getOption('class')));
 }
コード例 #11
0
function image_tag($filename, $options = array())
{
    $options['src'] = image_path($filename);
    if (!isset($options['alt'])) {
        list($alt, ) = explode('.', basename($options['src']));
        $options['alt'] = ucfirst($alt);
    }
    if (isset($options['size'])) {
        list($options['width'], $options['height']) = explode('x', $options['size']);
        unset($options['size']);
    }
    return tag('img', $options);
}
コード例 #12
0
 public function configure()
 {
     $startYear = sfConfig::get('app_year_range_start', date('Y') - 5);
     $years = range($startYear, date('Y') + 5);
     $sfWidgetFormI18nJQueryDateOptions = array('culture' => $this->getOption('culture', 'en'), 'image' => image_path('icons/calendar.png'), 'config' => "{ duration: '' }", 'years' => array_combine($years, $years));
     $this->setWidgets(array('query' => new sfWidgetFormInputText(), 'from' => new sfWidgetFormI18nJQueryDate($sfWidgetFormI18nJQueryDateOptions), 'to' => new sfWidgetFormI18nJQueryDate($sfWidgetFormI18nJQueryDateOptions), 'quick_dates' => new sfWidgetFormChoice(array('choices' => InvoiceSearchForm::getQuickDates())), 'series_id' => new sfWidgetFormChoice(array('choices' => array('' => '') + SeriesTable::getChoicesForSelect(false))), 'customer_id' => new sfWidgetFormChoice(array('choices' => array())), 'tags' => new sfWidgetFormInputHidden(), 'status' => new sfWidgetFormInputHidden(), 'sent' => new sfWidgetFormChoice(array('choices' => array('' => '', 1 => 'yes', 0 => 'no')))));
     $this->widgetSchema->setLabels(array('query' => 'Search', 'from' => 'from', 'to' => 'to', 'quick_dates' => ' ', 'series_id' => 'Series', 'customer_id' => 'Customer', 'sent' => 'Sent'));
     $dateRangeValidatorOptions = array('required' => false);
     $this->setValidators(array('query' => new sfValidatorString(array('required' => false, 'trim' => true)), 'from' => new sfValidatorDate($dateRangeValidatorOptions), 'to' => new sfValidatorDate($dateRangeValidatorOptions), 'customer_id' => new sfValidatorString(array('required' => false, 'trim' => true)), 'tags' => new sfValidatorString(array('required' => false, 'trim' => true)), 'status' => new sfValidatorString(array('required' => false, 'trim' => true))));
     // autocomplete for customer
     $this->widgetSchema['customer_id']->setOption('renderer_class', 'sfWidgetFormJQueryAutocompleter');
     $this->widgetSchema['customer_id']->setOption('renderer_options', array('url' => url_for('search/ajaxCustomerAutocomplete'), 'value_callback' => 'CustomerTable::getCustomerName'));
     $this->widgetSchema->setNameFormat('search[%s]');
     $this->widgetSchema->setFormFormatterName('list');
 }
コード例 #13
0
ファイル: LightboxHelper.php プロジェクト: net7/Talia-CMS
/**
 * Returns an image link to use the lightbox function for 1 image.
 *
 * @param string $thumbnail Name of thumbnail to display
 * @param string $image     Name of full size image to display
 * @param array  $options   Options of the link
 * 
 * @author COil
 * @since 1.0.0 - 5 feb 07
 */
function light_image($link_content, $image, $link_options = array(), $image_options = array(), $li = false, $link_type = 'IMAGE')
{
    _addLbRessources();
    $link_options = _parse_attributes($link_options);
    $image_options = _parse_attributes($image_options);
    // Lightbox specific
    $link_options['rel'] = isset($link_options['rel']) ? $link_options['rel'] : 'lightbox';
    // Resources type
    switch ($link_type) {
        case 'IMAGE':
            $link_content = image_tag($link_content, $image_options);
            break;
    }
    return ($li ? '<li>' : '') . link_to($link_content, image_path($image, true), $link_options) . ($li ? '</li>' : '');
}
コード例 #14
0
    /**
     * Render the changelog for $object (if any) as a tooltip.
     * This method can't be called directly, instead use self::render().
     *
     * @see render()
     *
     * @param  mixed $object Any object using ncPropelChangeLogBehavior.
     *
     * @return string
     */
    protected static function renderAsTooltip($object)
    {
        sfContext::getInstance()->getResponse()->addJavascript('changelog');
        self::loadHelpers('Asset');
        $klass = get_class($object);
        $id = $object->getId();
        $html_id = "changelog_for_{$klass}_{$id}";
        $html = <<<HTML
<a href="#" style="display: inline-block; margin: 1px;" onclick="changelog_render_tooltip('%url%','%klass%','%id%','#%html_id%'); return false;">
  <img style="vertical-align: middle;" src="%img_src%" alt="%img_alt%" title="%img_title%" />
</a>
<div id="%html_id%" class="nc_changelog_tooltip" style="display: none;"></div>
HTML;
        return strtr($html, array('%klass%' => $klass, '%url%' => url_for('@changelog_helper'), '%id%' => $id, '%html_id%' => $html_id, '%img_src%' => image_path('clock.png'), '%img_alt%' => __('Change log', array(), 'nc_change_log_behavior'), '%img_title%' => __('See change log', array(), 'nc_change_log_behavior')));
    }
コード例 #15
0
ファイル: websites.php プロジェクト: cutout/ptd
/**
 * list of websites to display on the showcase
 */
function get_website_data()
{
    /**
     * properties:
     * url = url for website to showcase
     * name = website name
     * theme = name of theme being used on that site
     * featured = if the site will display on the featured toggle. Remove property if not true
     * image = fallback image in case auto screenshot doesn't work for whatever reason. Image should be 400 x 300
     */
    /**
       '' => array(
           'url' => '',
           'name' => '',
           'theme' => 'themeslug',
           'tags' => array( 'themeslug', 'featured' ),
           'image' => '',
       ),
    */
    $websites = array('absurdisan' => array('url' => 'http://absurdisan.com/', 'name' => 'Absudisan', 'theme' => 'romero', 'tags' => array('featured')), 'ahoboawake' => array('url' => 'https://ahoboawake.com/', 'name' => 'Ahoboawake', 'theme' => 'broadsheet', 'tags' => array('featured')), 'latteluxury' => array('url' => 'https://latteluxurynews.com/', 'name' => 'Latte Lixiry News', 'theme' => 'broadsheet'), 'tanboy' => array('url' => 'https://prialterno.wordpress.com/', 'name' => 'Tan Boy', 'theme' => 'broadsheet', 'tags' => array('featured')), 'lockelandspringsteen' => array('url' => 'https://lockelandspringsteen.com/', 'name' => 'Lokeland Springsteen', 'theme' => 'broadsheet'), 'ahoboawake' => array('url' => 'https://ahoboawake.com/', 'name' => 'Ahoboawake', 'theme' => 'broadsheet'), 'aosugo' => array('url' => 'http://aosugo.com/', 'name' => 'Ausogo', 'theme' => 'romero'), 'mostvaluablepodcasts' => array('url' => 'http://mostvaluablepodcasts.com/', 'name' => 'Most Valuable Podcasts', 'theme' => 'romero'), 'shortblacktechie' => array('url' => 'http://shortblacktechie.com/', 'name' => 'Short Black Techie', 'theme' => 'romero', 'tags' => array('featured')), 'drummajorsociety' => array('url' => 'http://drummajorsociety.org/', 'name' => 'Drum Major Society', 'theme' => 'romero'), 'wethemeeple' => array('url' => 'http://blog.wethemeeple.co/', 'name' => 'We The Meeple', 'theme' => 'romero'), 'theneocom' => array('url' => 'http://theneocom.com/', 'name' => 'The Neocom', 'theme' => 'romero'), 'psvitaaddict' => array('url' => 'http://psvitaaddict.com/', 'name' => 'PS Vita Addict', 'theme' => 'romero'), 'industrialminds' => array('url' => 'http://industrial-minds.net/', 'name' => 'Industrial Minds', 'theme' => 'romero', 'tags' => array('featured')), 'filmexposure' => array('url' => 'http://filmexposure.ch/', 'name' => 'Film Exposure', 'theme' => 'romero'), 'bestgameever' => array('url' => 'http://bestgameever.co.uk/', 'name' => 'Best Game Ever', 'theme' => 'romero'), 'ninauthority' => array('url' => 'http://ninauthority.com/', 'name' => 'Nintendo Authority', 'theme' => 'romero'), 'barry-corner' => array('url' => 'http://barrycomersblog.com', 'name' => 'Barry Corner', 'theme' => 'monet', 'tags' => array('featured'), 'image' => 'barrycorner'), 'vuurig' => array('url' => 'http://sonjavanvuure.com', 'name' => 'Vuurig', 'theme' => 'monet', 'image' => 'vuurig'), 'legos-and-friends' => array('url' => 'http://legosandfriends.com', 'name' => 'Legos and Friends', 'theme' => 'romero'), 'mgarciadigital' => array('url' => 'https://mgarciadigital.wordpress.com/', 'name' => 'Marco Garcia', 'theme' => 'puzzle', 'image' => 'mgarciadigital', 'tags' => array('puzzle', 'featured')), 'clear-sight' => array('url' => 'http://bjdeming.com', 'name' => 'Clear Sight', 'image' => 'bjdeming', 'theme' => 'opti'), 'press-the-button' => array('url' => 'http://pressthepsbutton.com', 'name' => 'Press the Button', 'theme' => 'chronicle', 'tags' => array('chronicle')), 'hanley-strength' => array('url' => 'http://hanleystrength.com', 'name' => 'Hanley Strength', 'theme' => 'romero', 'tags' => array('featured')), 'should-i-go-see-it' => array('url' => 'http://shouldigoseeit.com', 'name' => 'Should I Go See It', 'image' => 'shouldigoseeit', 'theme' => 'puzzle'), 'noise-nation' => array('url' => 'https://noisenation.wordpress.com', 'name' => 'Noise Nation', 'image' => 'noisenation', 'theme' => 'opti'), 'the-fourth-crown' => array('url' => 'http://thefourthcrown.com', 'name' => 'The Fourth Crown', 'theme' => 'broadsheet', 'tags' => array('featured')), 'torrent-this' => array('url' => 'http://torrentthis.tv', 'name' => 'Torrent This', 'theme' => 'romero', 'tags' => array('romero', 'featured')), 'geeks-down-under' => array('url' => 'http://geeksdownunder.com.au', 'name' => 'Geeks Down Under', 'theme' => 'romero'), 'javier-mardueno' => array('url' => 'http://javiermarduenoblog.com', 'name' => 'Javier Mardueno', 'image' => 'javiermardueno', 'theme' => 'puzzle', 'tags' => array('featured')), 'decograffik' => array('url' => 'http://decograffik.com', 'name' => 'Decograffik', 'image' => 'decograffik', 'theme' => 'puzzle'), 'matthew-aaron-goodman' => array('url' => 'http://matthewaarongoodman.com', 'name' => 'Matthew Aaron Goodman', 'image' => 'matthewaarongoodman', 'theme' => 'puzzle'), 'cynthia-lait' => array('url' => 'http://cynthialait.com', 'name' => 'Cynthia Lait', 'image' => 'cynthialait', 'theme' => 'puzzle'), 'maroc-in-style' => array('url' => 'http://marocinstyle.com', 'name' => 'Maroc in Style', 'image' => 'maroc', 'theme' => 'puzzle'), 'flossy-photography' => array('url' => 'https://flossyphotography.wordpress.com', 'name' => 'Flossy Photography', 'image' => 'flossy', 'theme' => 'puzzle'), 'leah-pellegrini' => array('url' => 'http://leahpellegrini.com', 'name' => 'Leah Pellegrini', 'theme' => 'puzzle'), 'cincindos' => array('url' => 'http://cincindos.com', 'name' => 'Cincindos', 'image' => 'cincindos', 'theme' => 'puzzle'), 'sperka' => array('url' => 'http://sperka.info', 'name' => 'Sperka', 'image' => 'sperka', 'theme' => 'puzzle'), 'vocalise' => array('url' => 'https://ballaratvocalise.wordpress.com', 'name' => 'Vocalise', 'theme' => 'opti'), 'bella-caledonia' => array('url' => 'https://bellacaledonia.wordpress.com', 'name' => 'Bella Caledonia', 'image' => 'bellacaledonia', 'theme' => 'opti', 'tags' => array('featured')), 'national-rail-enquiries' => array('url' => 'http://blog.nationalrail.co.uk', 'name' => 'National Rail Enquiries', 'theme' => 'chronicle', 'tags' => array('featured')), 'berkeley-life-centre' => array('url' => 'http://berkeleylifecentre.org', 'name' => 'Berkeley Life Centre', 'theme' => 'chronicle', 'tags' => array('featured')), 'comic-community' => array('url' => 'https://ccommunity.wordpress.com', 'name' => 'Comic Community', 'theme' => 'chronicle'), 'fedali-photography' => array('url' => 'http://fedalijournal.com', 'name' => 'Fedali Photography', 'image' => 'fedalijournal', 'theme' => 'chronicle'), 'cardinal-courier' => array('url' => 'https://cardinalcourieronline.wordpress.com', 'name' => 'Cardinal Courier', 'theme' => 'broadsheet'), 'orange-county-tribune' => array('url' => 'http://orangecountytribune.com', 'name' => 'Orange County Tribune', 'theme' => 'broadsheet'), 'the-sentinel' => array('url' => 'https://shssentinel.wordpress.com', 'name' => 'The Sentinel', 'theme' => 'broadsheet'), 'gentlemans-portion' => array('url' => 'http://gentlemansportion.com', 'name' => 'Gentlemans Portion', 'theme' => 'broadsheet'), 'solar-spindle' => array('url' => 'http://solarspindle.com', 'name' => 'Solar Spindle', 'theme' => 'broadsheet'), 'probe-inernational' => array('url' => 'http://journal.probeinternational.org', 'name' => 'Probe International', 'theme' => 'broadsheet'), 'the-banner' => array('url' => 'http://thebannercsi.com', 'name' => 'The Banner', 'theme' => 'broadsheet'), 'leonardo-zhangelini' => array('url' => 'http://zanghelini.com.br', 'name' => 'Leonardo Zhangelini', 'theme' => 'monet', 'image' => 'leonardozhangelini'), 'bailey-english-studio' => array('url' => 'http://baileyenglishstudio.com', 'name' => 'Bailey English Studio', 'theme' => 'monet', 'image' => 'baileyenglishstudio'), 'red-electric' => array('url' => 'http://redeclectic.com.au', 'name' => 'Red Electric', 'theme' => 'monet', 'image' => 'redelectric'));
    $processed = array();
    foreach ($websites as $key => $site) {
        // preview url
        $site['url-preview'] = path('showcase-preview/' . $key . '/');
        $site['showcase-target'] = '';
        //var_dump( $site[ 'url' ] );
        //var_dump( strpos( $site[ 'url' ], 'https://' ) );
        if (strpos($site['url'], 'http://') !== false) {
            $site['url-preview'] = $site['url'];
            $site['showcase-target'] = '_blank';
        }
        // preview url
        $site['url-showcase'] = path('theme-showcase/' . $site['theme'] . '/#' . $key);
        // iframe url
        $site['url-iframe'] = $site['url'];
        // add theme slug to tags
        $site['tags'][] = $site['theme'];
        // setup site screenshots
        $site['image-preview'] = site_screenshot($site['url']);
        $site['image-url'] = $site['image-preview'];
        // change dynamic url for static image if it exists. Static image is needed for themes that use js for positioning (masonry) since the dynamic screenshot system does not support js.
        if (!empty($site['image'])) {
            $site['image-url'] = image_path('showcase/' . $site['image'] . '.jpg');
        }
        $processed[$key] = $site;
    }
    return $processed;
}
コード例 #16
0
ファイル: mp3Handler.php プロジェクト: EQ4/smint
 public static function mp3PlayerTag($options = array(), $options_html = array())
 {
     $player = sfConfig::get('app_mp3player_defaultplayer', 'worldpress');
     switch ($player) {
         case 'flash-mp3-player':
             $options = _parse_attributes($options);
             $options_html = _parse_attributes($options_html);
             $trackURI = urlencode(isset($options['trackURI']) ? $options['trackURI'] : '');
             $trackURInotencoded = isset($options['trackURI']) ? $options['trackURI'] : '';
             $flashplayerid = isset($options['flashplayerid']) ? $options['flashplayerid'] : '';
             $customSkin = isset($options['customSkin']) ? $options['customSkin'] : '';
             $playerConfig = sfConfig::get('app_mp3player_flash-mp3-player');
             $autoplay = isset($playerConfig['autoplay']) ? $playerConfig['autoplay'] : '1';
             $width = isset($playerConfig['width']) ? $playerConfig['width'] : '200';
             $img = isset($playerConfig['img']) ? image_path($playerConfig['img']) : 'nopreview.defined';
             $imgmouseover = isset($playerConfig['imgmouseover']) ? image_path($playerConfig['imgmouseover']) : 'nopreview.defined';
             $options_html['onClick'] = "javascript: swfobject.createSWF(\n          { data:'" . public_path("/mp3player/player_mp3_maxi.swf") . "', width:'{$width}', height:'15' }, \n          { flashvars:'mp3={$trackURI}&amp;showslider=1&amp;width={$width}&amp;height=15&amp;autoplay={$autoplay}'}, \n          '{$flashplayerid}'); \n          return false;";
             $options_html['href'] = "#";
             $options_html['onmouseover'] = "this.src='{$imgmouseover}'";
             $options_html['onmouseout'] = "this.src='{$img}'";
             $options_html['alt'] = "no preview defined?";
             return image_tag($img, $options_html);
             break;
         case 'worldpress':
             $options = _parse_attributes($options);
             $options_html = _parse_attributes($options_html);
             $trackURI = urlencode(isset($options['trackURI']) ? $options['trackURI'] : '');
             $trackURInotencoded = isset($options['trackURI']) ? $options['trackURI'] : '';
             $flashplayerid = isset($options['flashplayerid']) ? $options['flashplayerid'] : '';
             $customSkin = isset($options['customSkin']) ? $options['customSkin'] : '';
             $playerConfig = sfConfig::get('app_mp3player_worldpress');
             $img = isset($playerConfig['img']) ? image_path($playerConfig['img']) : 'nopreview.defined';
             $imgmouseover = isset($playerConfig['imgmouseover']) ? image_path($playerConfig['imgmouseover']) : 'nopreview.defined';
             $img = isset($options['customSkinImage']) ? image_path($options['customSkinImage']) : $img;
             $imgmouseover = isset($options['customSkinImageMouseover']) ? image_path($options['customSkinImageMouseover']) : $imgmouseover;
             $options_html['onClick'] = "javascript: if( isiPhone() ) document.getElementById('{$flashplayerid}').innerHTML='<audio controls=\"true\" autoplay=\"true\" width=\"150px\" height=\"24px\"> <source src=\"{$trackURInotencoded}\" type=\"audio/mp3\"> </audio>'; else AudioPlayer.embed('{$flashplayerid}', {soundFile: '{$trackURI}', {$customSkin}}); return false;";
             $options_html['href'] = "#";
             $options_html['onmouseover'] = "this.src='{$imgmouseover}'";
             $options_html['onmouseout'] = "this.src='{$img}'";
             $options_html['alt'] = "no preview defined?";
             return image_tag($img, $options_html);
             break;
         case 'smintplayer':
         default:
             return "todo";
             break;
     }
 }
コード例 #17
0
ファイル: sfIconHelper.php プロジェクト: sgrove/cothinker
function icon_both($type, $name, $size = 'small')
{
    // Size definition
    $sizes = array('small' => '16x16', 'normal' => '24x24', 'large' => '32x32', 'huge' => '48x48');
    // Set small if wrong size
    if (!in_array($size, array_keys($sizes))) {
        $size = 'small';
    }
    $abs_name = '/sfIconPlugin/images/icons/' . $sizes[$size] . '/' . $name;
    if ($type == 'tag') {
        return image_tag($abs_name, array("style" => 'vertical-align:middle;'));
    } else {
        if ($type = 'path') {
            return image_path($abs_name);
        }
    }
}
 static public function getButtons()
 {
   return array(
     'op_kakiage_copy_from_previous_day' => array(
       'caption' => 'Copy from previous day',
       'imageURL' => image_path('/opKakiagePlugin/images/deco_op_kakiage_copy_from_previous_day.png'),
     ),
     'op_kakiage_nocall' => array(
       'caption' => '%nocall',
       'imageURL' => image_path('/opKakiagePlugin/images/deco_op_kakiage_nocall.png'),
     ),
     'op_kakiage_get_redmine_ticket' => array(
       'caption' => 'get your redmine ticket',
       'imageURL' => image_path('/opKakiagePlugin/images/redmine_fluid_icon.png'),
     ),
   );
 }
コード例 #19
0
ファイル: ObjectAdminHelper.php プロジェクト: taryono/school
/**
 * ObjectHelper for admin generator.
 *
 * @package    symfony
 * @subpackage helper
 * @author     Fabien Potencier <*****@*****.**>
 * @version    SVN: $Id: ObjectAdminHelper.php 3746 2007-04-11 08:08:38Z fabien $
 */
function object_admin_input_file_tag($object, $method, $options = array())
{
    $options = _parse_attributes($options);
    $name = _convert_method_to_name($method, $options);
    $html = '';
    $value = _get_object_value($object, $method);
    if ($value) {
        if ($include_link = _get_option($options, 'include_link')) {
            $image_path = image_path('/' . sfConfig::get('sf_upload_dir_name') . '/' . $include_link . '/' . $value);
            $image_text = ($include_text = _get_option($options, 'include_text')) ? __($include_text) : __('[show file]');
            $html .= sprintf('<a onclick="window.open(this.href);return false;" href="%s">%s</a>', $image_path, $image_text) . "\n";
        }
        if ($include_remove = _get_option($options, 'include_remove')) {
            $html .= checkbox_tag(strpos($name, ']') !== false ? substr($name, 0, -1) . '_remove]' : $name) . ' ' . ($include_remove != true ? __($include_remove) : __('remove file')) . "\n";
        }
    }
    return input_file_tag($name, $options) . "\n<br />" . $html;
}
コード例 #20
0
 protected static function getButtons()
 {
     $buttons = array();
     foreach (self::$buttons as $key => $button) {
         if (is_numeric($key)) {
             $buttonName = $button;
             $buttonConfig = array('imageURL' => image_path('deco_' . $buttonName . '.gif'));
         } else {
             $buttonName = $key;
             if (!isset($button['imageURL'])) {
                 $button['imageURL'] = image_path('deco_' . $buttonName . '.gif');
             }
             $buttonConfig = $button;
         }
         $buttons[$buttonName] = $buttonConfig;
     }
     return $buttons;
 }
コード例 #21
0
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Asset');
     $id = $this->getOption('id') ? $this->getOption('id') : 'wrapper_' . $this->generateId($name, $value);
     $html = '';
     if (!is_null($this->getOption('content'))) {
         if ($this->getOption('content') instanceof sfWidget) {
             $attrs = array_merge($this->attributes, $attributes);
             $html = $this->getOption('content')->render($name, $value, $attrs, $errors);
         } else {
             $html = $this->getOption('content');
         }
     }
     $loader_id = $this->getOption('ajax_loader_id') ? $this->getOption('ajax_loader_id') : 'wrapper_loader_' . $this->generateId($name, $value);
     $loader_path = image_path($this->getOption('ajax_loader_url'));
     $loader_html = $this->getOption('provide_ajax_loader') ? '<img style="%%style%%" id="%%loader_id%%" src="%%loader_path%%" alt="ajax_loader">' : '';
     $loader_html = str_replace(array('%%loader_id%%', '%%loader_path%%', '%%style%%'), array($loader_id, $loader_path, $this->getOption('ajax_loader_css')), $loader_html);
     return str_replace(array('%%wrapper%%', '%%id%%', '%%html%%', '%%loader%%', '%%post_content%%'), array($this->getOption('wrapper'), $id, $html, $loader_html, $this->getOption('post_content')), '%%loader%%<%%wrapper%% id="%%id%%">%%html%%%%post_content%%</%%wrapper%%>');
 }
コード例 #22
0
 public function executeCheckState(sfWebRequest $request)
 {
     $this->getContext()->getConfiguration()->loadHelpers('Asset');
     $c_image = image_path('control.png', true);
     $w_image = image_path('warning.png', true);
     $warning = array();
     $event = sensor_eventTable::getInstance()->createQuery('e')->select()->where('e.place_id = 2')->limit(1)->orderBy('e.created_at desc')->execute();
     if (!empty($event[0])) {
         if (strlen($event[0]['description']) > 0) {
             $warning[] = array('id' => $event[0]['place_id'], 'description' => $event[0]['description'], 'image' => $w_image);
         } else {
             $warning[] = array('id' => $event[0]['place_id'], 'description' => $event[0]['description'], 'image' => $c_image);
         }
     }
     $event = sensor_eventTable::getInstance()->createQuery('e')->select()->where('e.place_id = 3')->limit(1)->orderBy('created_at desc')->execute();
     if (!empty($event[0])) {
         if (strlen($event[0]['description']) > 0) {
             $warning[] = array('id' => $event[0]['place_id'], 'description' => $event[0]['description'], 'image' => $w_image);
         } else {
             $warning[] = array('id' => $event[0]['place_id'], 'description' => $event[0]['description'], 'image' => $c_image);
         }
     }
     $event = sensor_eventTable::getInstance()->createQuery('e')->select()->where('e.place_id = 4')->limit(1)->orderBy('created_at desc')->execute();
     if (!empty($event[0])) {
         if (strlen($event[0]['description']) > 0) {
             $warning[] = array('id' => $event[0]['place_id'], 'description' => $event[0]['description'], 'image' => $w_image);
         } else {
             $warning[] = array('id' => $event[0]['place_id'], 'description' => $event[0]['description'], 'image' => $c_image);
         }
     }
     $event = sensor_eventTable::getInstance()->createQuery('e')->select()->where('e.place_id = 5')->limit(1)->orderBy('created_at desc')->execute();
     if (!empty($event[0])) {
         if (strlen($event[0]['description']) > 0) {
             $warning[] = array('id' => $event[0]['place_id'], 'description' => $event[0]['description'], 'image' => $w_image);
         } else {
             $warning[] = array('id' => $event[0]['place_id'], 'description' => $event[0]['description'], 'image' => $c_image);
         }
     }
     return $this->renderText(json_encode($warning));
 }
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     if (sfConfig::get('sf_app') == 'mobile_frontend') {
         return parent::render($name, $value, $attributes, $errors);
     }
     $js = '';
     foreach (self::$buttons as $key => $button) {
         if (is_numeric($key)) {
             $buttonName = $button;
             $buttonConfig = array('isEnabled' => 1, 'imageURL' => image_path('deco_' . $buttonName . '.gif'));
         } else {
             $buttonName = $key;
             $buttonConfig = $button;
         }
         $config[$buttonName] = $buttonConfig;
     }
     if (self::$isFirstRenderOpenPNE) {
         sfProjectConfiguration::getActive()->loadHelpers('Partial');
         sfContext::getInstance()->getResponse()->addJavascript('/sfProtoculousPlugin/js/prototype');
         sfContext::getInstance()->getResponse()->addJavascript('op_emoji');
         sfContext::getInstance()->getResponse()->addJavascript('Selection');
         sfContext::getInstance()->getResponse()->addJavascript('decoration');
         $relativeUrlRoot = sfContext::getInstance()->getRequest()->getRelativeUrlRoot();
         foreach ($this->loadPluginList as $key => $path) {
             $js .= sprintf('tinymce.PluginManager.load("%s", "%s");' . "\n", $key, $path);
         }
         $js .= sprintf("function op_mce_editor_get_config() { return %s; }\n", json_encode($config));
         $js .= sprintf('function op_get_relative_uri_root() { return "%s"; }', $relativeUrlRoot);
         self::$isFirstRenderOpenPNE = false;
     }
     if ($js) {
         sfProjectConfiguration::getActive()->loadHelpers('Javascript');
         $js = javascript_tag($js);
     }
     $id = $this->getId($name, $attributes);
     $this->setOption('textarea_template', '<div id="' . $id . '_buttonmenu" class="' . $id . '">' . get_partial('global/richTextareaOpenPNEButton', array('id' => $id, 'configs' => $config, 'onclick_actions' => self::$buttonOnclickActions)) . '</div>' . $this->getOption('textarea_template'));
     return $js . parent::render($name, $value, $attributes, $errors);
 }
コード例 #24
0
 public static function prepareEntityData($entity)
 {
     sfLoader::loadHelpers(array("Asset", "Url"));
     $primary_ext = @$entity["primary_ext"] ? $entity["primary_ext"] : (strpos($entity["url"], "person") === false ? "Org" : "Person");
     $entity["primary_ext"] = $primary_ext;
     if (@$entity["image"] && strpos(@$entity["image"], "netmap") === false && strpos(@$entity["image"], "anon") === false) {
         $image_path = $entity["image"];
     } elseif (@$entity["filename"]) {
         $image_path = image_path(ImageTable::getPath($entity['filename'], 'profile'));
     } else {
         $image_path = $primary_ext == "Person" ? image_path("system/netmap-person.png") : image_path("system/netmap-org.png");
     }
     try {
         $url = url_for(EntityTable::generateRoute($entity));
     } catch (Exception $e) {
         $url = 'http://littlesis.org/' . strtolower($primary_ext) . '/' . $entity['id'] . '/' . LsSlug::convertNameToSlug($entity['name']);
     }
     if (@$entity["blurb"]) {
         $description = $entity["blurb"];
     } else {
         $description = @$entity["description"];
     }
     return array("id" => self::integerize(@$entity["id"]), "name" => $entity["name"], "image" => $image_path, "url" => $url, "description" => $description, "x" => @$entity["x"], "y" => @$entity["y"], "fixed" => true);
 }
コード例 #25
0
<?php 
$cant = sizeof($pelicula);
if ($cant >= 1) {
    ?>
        

    <?php 
    foreach ($pelicula as $peli) {
        ?>
        
            <h1 class="alert-heading"><?php 
        echo $peli->getTitulo();
        ?>
</h1>
            <img src="<?php 
        echo image_path($peli->getImagen());
        ?>
"
                 alt="<?php 
        echo $peli->getTitulo();
        ?>
"></img>                                        
            <fieldset>
            <h3><legend>Sinopsis</legend><?php 
        echo $peli->getSinopsis();
        ?>
</h3>
            </fieldset>
    <?php 
    }
} else {
コード例 #26
0
ファイル: printCoverSuccess.php プロジェクト: taryono/school
                                    <tr>
                                        <td align="center">
                                                <center class="title" style="font-size: 24px; font-weight: normal;">YAYASAN PESANTREN ISLAM AL-AZHAR</center>
                                                <center class="title" style="font-size: 24px; font-weight: normal;">Kebayoran Baru Jakarta Selatan</center>
                                        </td>
                                    </tr>
                                </table>
                    
                    <?php 
    } else {
        ?>
                    
                                <table width="100%" border="0" style="page-break-after: always;">
                                    <tr><td height="50px"></td></tr>
                                    <tr><td align="center"><img  src='<?php 
        echo image_path('logo_ypi.jpg', true);
        ?>
' border=0 ></td></tr>
                                    <tr><td height="50px"></td></tr>
                                    <tr>
                                        <td align="center">
                                                <center class="title" style="font-size: 24px;">LAPORAN<br>HASIL BELAJAR MURID</center><br>
                                                <center class="title" style="font-size: 20px;">SEKOLAH MENENGAH ATAS ISLAM AL AZHAR</center>
                                        </td>
                                    </tr>
                                    <tr><td height="50px"></td></tr>
                                    <tr>
                                        <td align="left">
                                            <table border="0" width="100%">
                                                <tr>
                                                    <td width="30%" align="left" style="font-size: 120%; font-weight: bold;">Nama Sekolah</td>
コード例 #27
0
ファイル: login.php プロジェクト: droiter/openwrt-on-android
		<p class="groupbottom">
			<input type="password" name="password" id="password" value=""
				placeholder="<?php 
p($l->t('Password'));
?>
"
				<?php 
p($_['user_autofocus'] ? '' : 'autofocus');
?>
				autocomplete="on" autocapitalize="off" autocorrect="off" required />
			<label for="password" class="infield"><?php 
p($l->t('Password'));
?>
</label>
			<img class="svg" id="password-icon" src="<?php 
print_unescaped(image_path('', 'actions/password.svg'));
?>
" alt=""/>
		</p>

		<?php 
if (isset($_['invalidpassword']) && $_['invalidpassword']) {
    ?>
		<a id="lost-password" class="warning" href="">
			<?php 
    p($l->t('Forgot your password? Reset it!'));
    ?>
		</a>
		<?php 
}
?>
コード例 #28
0
?>
">TypeScript Compiler Test</a></li>
                    <li><a href="<?php 
echo site_url('playground/colorbox');
?>
">Colorbox Test</a></li>
                    <li><a href="<?php 
echo site_url('playground/jsonmin');
?>
">JSON Minification Test</a></li>
                    <li><a href="<?php 
echo site_url('playground/animate');
?>
">Animate,css Test</a></li>
                </ul>

            </div>

            <div class="col-sm-4">

                  <img src="<?php 
echo image_path('playground.jpg');
?>
" class="thumbnail img-responsive" />

            </div>

        </div>

    </section>
コード例 #29
0
script('core', 'lostpassword');
?>

<form action="<?php 
print_unescaped($_['link']);
?>
" id="reset-password" method="post">
	<fieldset>
		<p>
			<label for="password" class="infield"><?php 
p($l->t('New password'));
?>
</label>
			<input type="password" name="password" id="password" value="" placeholder="<?php 
p($l->t('New Password'));
?>
" required />
		</p>
		<input type="submit" id="submit" value="<?php 
p($l->t('Reset password'));
?>
" />
		<p class="text-center">
			<img class="hidden" id="float-spinner" src="<?php 
p(image_path('core', 'loading-dark.gif'));
?>
"/>
		</p>
	</fieldset>
</form>
コード例 #30
0
ファイル: showSuccess.php プロジェクト: ArnaudD/RdvZ
  <?php 
    }
}
?>
</tr>
<!--
<tr>
<td class="poll_empty"></td>
<?php 
foreach ($md as $d) {
    ?>
  <?php 
    if (in_array($d->getId(), $bests->getRawValue())) {
        ?>
    <td colspan="1"><img src="<?php 
        echo image_path('/images/star_16.png');
        ?>
" alt="Starred meeting" title="<?php 
        echo __('Meilleur choix');
        ?>
" /></td>  
  <?php 
    } else {
        ?>
    <td class="poll_empty"></td>
  <?php 
    }
}
?>
</tr>
-->