Example #1
0
 public static function getTweets($username = '******', $consumerkey = '', $consumersecret = '', $accesstoken = '', $accesstokensecret = '', $count = 5, $ignore_replies = false, $include_rts = false)
 {
     $cache_path = JPATH_CACHE . '/com_sppagebuilder/addons/tweet';
     $cache_file = $cache_path . '/cache.txt';
     $cachetime = 60 * 15;
     $tweets = '';
     //Create cache folder if not exists
     if (!JFolder::exists($cache_path)) {
         JFolder::create($cache_path);
     }
     $cache_file_created = Jfile::exists($cache_file) ? filemtime($cache_file) : 0;
     if (time() - $cachetime < $cache_file_created) {
         $tweets = json_decode(JFile::read($cache_file));
     } else {
         $connection = new TwitterOAuth($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
         if ($connection) {
             $get_tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=" . $username . "&count=" . $count . "&include_rts=" . $include_rts . "&exclude_replies=" . $ignore_replies);
             $tweets = json_encode($get_tweets);
             JFile::write($cache_file, $tweets);
             $tweets = $get_tweets;
         }
     }
     return $tweets;
 }
Example #2
0
    public function getPrettyPhoto($type, $source, $width = 50, $height = 50, $option = 'smart', $quality = 90, $theme = 'facebook', $padding = 10, $opacity = '0.8', $title = false, $speed = 'normal', $user = false, $apikey = false, $setid = false, $number = false, $extlink)
    {
        // Import libraries
        jimport('joomla.filesystem.file');
        jimport('joomla.filesystem.folder');
        //define variables
        $show_title = $title === false ? false : true;
        $html = '';
        switch ($type) {
            case 'popup':
                if (Jfile::exists($source) === false) {
                    return;
                }
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $resized = resizeImageHelper::getResizedImage($source, $width, $height, $option, $quality);
                $html .= '<a href="' . $source . '" rel="prettyPhoto" title="' . $title . '"><img src="' . $resized . '" class="thumbnail" alt="' . $title . '" border="0" title="' . $title . '"></a>';
                break;
            case "iframe":
                //if (Jfile::exists($source)===false){return;}
                //if (Jfile::exists($source)===false){return;}
                //define variables
                $show_title = $title === false ? false : true;
                $extlink = 'http://' . str_replace('http://', '', trim($extlink));
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto[iframes]\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $resized = resizeImageHelper::getResizedImage($source, $width, $height, $option, $quality);
                $html .= '<a href="' . $extlink . '?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]" title="' . $title . '"><img src="' . $resized . '" class="thumbnail" alt="' . $title . '" border="0" title="' . $title . '"></a>';
                break;
            case "inline":
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto[inline]\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $html .= '<div class="pp_inline clearfix">{content}</div>';
                $html .= '<a href="#inline-1" rel="prettyPhoto" ><img src="/wp-content/themes/NMFE/images/thumbnails/earth-logo.jpg" alt="" width="50" /></a>
		<div id="inline-1" class="hide">
			<p>This is inline content opened in prettyPhoto.</p>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p></div>
		</div>';
                break;
            case "quicktime":
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $html .= '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>';
                break;
            case "flash":
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $html .= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>';
                break;
            case "flickr":
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                break;
            case "picasa":
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                break;
            case "gallery":
                if (Jfolder::exists($source) === false) {
                    return;
                }
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $html .= '<div class="pp_gallery">
									<a href="#" class="pp_arrow_previous">Previous</a>
									<ul>
										{gallery}
									</ul>
									<a href="#" class="pp_arrow_next">Next</a>
								</div>';
                break;
            case "slideshow":
                if (Jfolder::exists($source) === false) {
                    return;
                }
                $html .= '<script type="text/javascript" charset="utf-8">
				(function($) {
				$(document).ready(function(){
				$("a[rel^=\'prettyPhoto\']").prettyPhoto({
				animation_speed: "' . $speed . '",
				slideshow: false, 
				autoplay_slideshow: false,
				opacity: "' . $opacity . '", 
				show_title: "' . $show_title . '",
				allow_resize: true,
				default_width: 500,
				default_height: 350,
				counter_separator_label: "/", 
				theme: "' . $theme . '",
				hideflash: false, 
				wmode: "opaque", 
				autoplay: true,
				modal: false,
				overlay_gallery: true,
				keyboard_shortcuts: true
				});
				})})(jQuery);</script>';
                $html .= '<div class="pp_pic_holder">
							<div class="ppt">&nbsp;</div>
							<div class="pp_top">
								<div class="pp_left"></div>
								<div class="pp_middle"></div>
								<div class="pp_right"></div>
							</div>
							<div class="pp_content_container">
								<div class="pp_left">
								<div class="pp_right">
									<div class="pp_content">
										<div class="pp_loaderIcon"></div>
										<div class="pp_fade">
											<a href="#" class="pp_expand" title="Expand the image">Expand</a>
											<div class="pp_hoverContainer">
												<a class="pp_next" href="#">next</a>
												<a class="pp_previous" href="#">previous</a>
											</div>
											<div id="pp_full_res"></div>
											<div class="pp_details clearfix">
												<p class="pp_description"></p>
												<a class="pp_close" href="#">Close</a>
												<div class="pp_nav">
													<a href="#" class="pp_arrow_previous">Previous</a>
													<p class="currentTextHolder">0/0</p>
													<a href="#" class="pp_arrow_next">Next</a>
												</div>
											</div>
										</div>
									</div>
								</div>
								</div>
							</div>
							<div class="pp_bottom">
								<div class="pp_left"></div>
								<div class="pp_middle"></div>
								<div class="pp_right"></div>
							</div>
						</div>
						<div class="pp_overlay"></div>';
                break;
        }
        return $html;
    }
Example #3
0
 public function easyblog()
 {
     $helperFile = JPATH_ROOT . '/components/com_easyblog/helpers/helper.php';
     if (!Jfile::exists($helperFile)) {
         return JText::_('COM_EASYDISCUSS_EASYBLOG_DOES_NOT_EXIST');
     }
     require_once $blogHelper;
 }
Example #4
0
 /**
  * Create the list of all modules published as Object
  *
  * $file string the image path
  * $x integer the new image width
  * $y integer the new image height
  *
  * @return Boolean True on Success
  */
 static function resizeImage($file, $x, $y = '', $thumbpath = 'th', $thumbsuffix = '_th')
 {
     if (!$file) {
         return;
     }
     $params = self::$slideshowparams;
     if (!$params->get('autocreatethumbs', '1')) {
         return;
     }
     $thumbext = explode(".", $file);
     $thumbext = end($thumbext);
     $thumbfile = str_replace(JFile::getName($file), $thumbpath . "/" . JFile::getName($file), $file);
     $thumbfile = str_replace("." . $thumbext, $thumbsuffix . "." . $thumbext, $thumbfile);
     $filetmp = JPATH_ROOT . '/' . $file;
     $filetmp = str_replace("%20", " ", $filetmp);
     if (!Jfile::exists($filetmp)) {
         return;
     }
     $size = getimagesize($filetmp);
     if ($size[0] > $size[1]) {
         $y = $x * $size[1] / $size[0];
     } else {
         //			$tmpx = $x;
         //			$x = $y;
         //			$y = $tmpx * $size[0] / $size[1];
         $x = $y * $size[0] / $size[1];
     }
     if ($size) {
         if (JFile::exists($thumbfile)) {
             return $thumbfile;
             // $thumbsize = getimagesize(JPATH_ROOT . '/' . $thumbfile);
             // if ($thumbsize[0] == $x || $thumbsuffix == '') {
             // return $thumbfile;
             // }
         }
         $thumbfolder = str_replace(JFile::getName($file), $thumbpath . "/", $filetmp);
         if (!JFolder::exists($thumbfolder)) {
             JFolder::create($thumbfolder);
             JFile::copy(JPATH_ROOT . '/modules/mod_slideshowck/index.html', $thumbfolder . 'index.html');
         }
         if ($size['mime'] == 'image/jpeg') {
             $img_big = imagecreatefromjpeg($filetmp);
             # On ouvre l'image d'origine
             $img_new = imagecreate($x, $y);
             # création de la miniature
             $img_mini = imagecreatetruecolor($x, $y) or $img_mini = imagecreate($x, $y);
             // copie de l'image, avec le redimensionnement.
             imagecopyresized($img_mini, $img_big, 0, 0, 0, 0, $x, $y, $size[0], $size[1]);
             imagejpeg($img_mini, JPATH_ROOT . '/' . $thumbfile);
         } elseif ($size['mime'] == 'image/png') {
             $img_big = imagecreatefrompng($filetmp);
             # On ouvre l'image d'origine
             $img_new = imagecreate($x, $y);
             # création de la miniature
             $img_mini = imagecreatetruecolor($x, $y) or $img_mini = imagecreate($x, $y);
             // copie de l'image, avec le redimensionnement.
             imagecopyresized($img_mini, $img_big, 0, 0, 0, 0, $x, $y, $size[0], $size[1]);
             imagepng($img_mini, JPATH_ROOT . '/' . $thumbfile);
         } elseif ($size['mime'] == 'image/gif') {
             $img_big = imagecreatefromgif($filetmp);
             # On ouvre l'image d'origine
             $img_new = imagecreate($x, $y);
             # création de la miniature
             $img_mini = imagecreatetruecolor($x, $y) or $img_mini = imagecreate($x, $y);
             // copie de l'image, avec le redimensionnement.
             imagecopyresized($img_mini, $img_big, 0, 0, 0, 0, $x, $y, $size[0], $size[1]);
             imagegif($img_mini, JPATH_ROOT . '/' . $thumbfile);
         }
         //echo 'Image redimensionnée !';
     }
     return $thumbfile;
 }
Example #5
0
 /**
  * Clean up unwanted stuff.
  *
  * @throws EcrExceptionZiper
  * @return EcrProjectZiper
  */
 private function cleanProject()
 {
     $this->logger->log('Starting CleanUp');
     $folders = JFolder::folders($this->temp_dir, '.', true, true);
     $files = JFolder::files($this->temp_dir, '.', true, true);
     $stdHtmlPath = ECRPATH_EXTENSIONTEMPLATES . DS . 'std' . DS . 'std_index.html';
     $cntIndex = 0;
     $cntAautoCode = 0;
     if ($this->preset->createIndexhtml) {
         foreach ($folders as $folder) {
             if (false == Jfile::exists($folder . DS . 'index.html')) {
                 JFile::copy($stdHtmlPath, $folder . DS . 'index.html');
                 $cntIndex++;
             }
         }
         $this->logger->log(sprintf('%s index.html files created', $cntIndex));
     }
     if ($this->preset->removeAutocode) {
         /**
          * @todo remove AutoCode
          */
     }
     //-- If we are building a "package package", override the preset settings from the package
     //-- with the setting from the request.
     if ($this->preset->includeEcrProjectfile && true == $this->buildopts['include_ecr_projectfile']) {
         $src = ECRPATH_SCRIPTS . DS . $this->project->getEcrXmlFileName();
         if (JFolder::exists($this->temp_dir . DS . 'admin')) {
             $dst = $this->temp_dir . DS . 'admin' . DS . 'easycreator.xml';
         } else {
             if (JFolder::exists($this->temp_dir . DS . 'site')) {
                 $dst = $this->temp_dir . DS . 'site' . DS . 'easycreator.xml';
             } else {
                 $s = JFile::getName($src);
                 if (substr($s, 0, 3) == 'pkg') {
                     //-- EasyCreator project file for packages goes to packageroot..
                     $dst = $this->temp_dir . DS . 'easycreator.xml';
                 } else {
                     throw new EcrExceptionZiper(__METHOD__ . ' - Neither admin or site dir found - Failed to copy EasyCreator project xml');
                 }
             }
         }
         if (false == JFile::copy($src, $dst)) {
             throw new EcrExceptionZiper(sprintf('%s - %s &rArr; %s Failed to copy EasyCreator project xml', __METHOD__, $src, $dst));
         }
         $this->logger->log('EasyCreator project xml copied');
     }
     //-- Look for unwanted files
     $unwanted = array('Thumbs.db');
     foreach ($files as $file) {
         foreach ($unwanted as $item) {
             //-- Simple check if the full path contains an 'unwanted' string
             if (strpos($file, $item)) {
                 $this->logger->log('Removing unwanted ' . $item . ' at ' . $file);
                 if (false == JFile::delete($file)) {
                     $this->logger->log('Unable to remove ' . $file, 'ERROR');
                 }
             }
         }
     }
     //-- Clean up language version files
     $paths = array('admin/language', 'site/language');
     $cnt = 0;
     foreach ($paths as $path) {
         if (false == JFolder::exists($this->temp_dir . '/' . $path)) {
             continue;
         }
         $files = JFolder::files($this->temp_dir . '/' . $path, '.', true, true);
         foreach ($files as $file) {
             if ('ini' != JFile::getExt($file) && 'html' != JFile::getExt($file)) {
                 if (false == JFile::delete($file)) {
                     throw new EcrExceptionZiper(__METHOD__ . ' - Can not delete language version file: ' . $file);
                 }
                 $cnt++;
             }
         }
     }
     $this->logger->log(sprintf('%d language version files deleted', $cnt));
     return $this;
 }