function __construct($total, $max_items = 0) { $this->total = $total; if ($max_items == 0) { $this->maxItems = WiziappConfig::getInstance()->posts_list_limit; } else { $this->maxItems = $max_items; } $this->page = isset($_GET['wizipage']) ? $_GET['wizipage'] : 0; if (!empty($this->page)) { $this->offset = $this->maxItems * $this->page; } else { $this->offset = 0; } // With the offset which post have we reached? $totalShown = $this->maxItems + $this->maxItems * $this->page; // Find the total number of posts in the blog if ($totalShown < $total) { $leftToShow = $total - $totalShown; $this->showMore = $leftToShow < $this->maxItems ? $leftToShow : $this->maxItems; $this->leftToShow = $leftToShow > $this->maxItems ? $this->maxItems : $leftToShow; } else { $this->showMore = FALSE; } }
public static function getInstance() { if (is_null(self::$_instance)) { self::$_instance = new WiziappConfig(); } return self::$_instance; }
/** * Attribute getter method * * @return the imageURL of the component */ function get_imageURL_attr() { $image = new WiziappImageHandler($this->data[0]['imageURL']); $size = WiziappConfig::getInstance()->getImageSize('audio_thumb'); return $image->getResizedImageUrl(htmlspecialchars_decode($this->data[0]['imageURL']), $size['width'], $size['height']); // return $this->data[0]['imageURL']; }
function get_imageURL_attr() { $GLOBALS['WiziappLog']->write('info', "The preview image is:" . $this->data[0]['images'][0], 'imageGalleryCellItem.get_imageURL_attr'); $image = new WiziappImageHandler($this->data[0]['images'][0]); $size = WiziappConfig::getInstance()->getImageSize('album_thumb'); return $image->getResizedImageUrl($this->data[0]['images'][0], $size['width'], $size['height']); //return $this->data[0]['images'][0]; }
public function resize($image, $file, $width, $height, $type, $allow_up = false) { $image = urlencode($image); $service = 'https://' . WiziappConfig::getInstance()->api_server . '/index.php/simulator/resize'; $qs = "?src={$image}&w={$width}&h={$height}&t={$type}"; if ($allow_up) { $qs .= '&u=1'; } $this->newHeight = $height; $this->newWidth = $width; return $service . $qs; }
function wiziapp_dashboard_widget_function() { if (empty(WiziappConfig::getInstance()->app_token)) { echo __("Error activating the wiziapp plugin", 'wiziapp'); } else { global $current_user; get_currentuserinfo(); $perms = wiziapp_dirs_perms(); echo __('Needed dirs writable: ', 'wiziapp') . ($perms['cache'] && $perms['logs'] ? '<span style="color:green;">' . __('ok', 'wiziapp') . '</span>' : '<span style="color:red;">' . __('error', 'wiziapp') . '</spna>') . '<br />'; echo __('Cache time: ', 'wiziapp') . date('F j, Y H:i:s', WiziappConfig::getInstance()->last_recorded_save); } }
/** * Attribute getter method * * @returns the css class of the component */ function get_class_attr() { $class = $this->layoutClasses[$this->layout]; if (WiziappConfig::getInstance()->zebra_lists) { // If the index was supplied and it is even alter the class $index = $this->data[1]; if (!empty($index) && $index % 2 == 0) { $class = $class . "_even"; } } return $class; }
function wiziapp_do_content_get_post_headers() { global $post, $wp_query; if (isset($wp_query->posts[$wp_query->current_post + 1])) { $nextPost = $wp_query->posts[$wp_query->current_post + 1]; $nextURL = wiziapp_buildPostLink($nextPost->ID); } if (isset($wp_query->posts[$wp_query->current_post - 1])) { $prevPost = $wp_query->posts[$wp_query->current_post - 1]; $prevURL = wiziapp_buildPostLink($prevPost->ID); } $authorId = $post->post_author; $authorInfo = get_userdata($authorId); $authorName = $authorInfo->display_name; if (strlen($authorName) > 15) { $authorName = substr($authorName, 0, 12) . '...'; } $totalComments = $post->comment_count; $postDate = wiziapp_formatDate(strip_tags($post->post_date)); //$meta = "nextURL={$nextURL}&prevURL={$prevURL}&postID={$post->ID}&numOfComments={$totalComments}&author={$authorName}&newCommentURL=".wiziapp_buildPostNewCommentLink($post->ID); $limitSize = WiziappConfig::getInstance()->getImageSize('limit_post_thumb'); $size = WiziappConfig::getInstance()->getImageSize('posts_thumb'); $imageURL = wiziapp_getPostThumbnail($post, $size, $limitSize, FALSE); $c = new WiziappPostDescriptionCellItem('L1', array(), FALSE); $default_class = $c->getDefaultClass(); $showCommentsIcon = TRUE; if ($totalComments == 0 && 'open' != $post->comment_status) { $showCommentsIcon = FALSE; } else { // Might be turned off due to the theme settings if (isset($c->themeRemoveAttr)) { if (in_array('numOfComments', $c->themeRemoveAttr)) { $showCommentsIcon = FALSE; } } } $header = array("layout" => "L0", "class" => "{$default_class}", "nextURL" => "{$nextURL}", "prevURL" => "{$prevURL}", "postID" => $post->ID, "title" => strip_tags($post->post_title), 'screenTitle' => WiziappConfig::getInstance()->app_name, "imageURL" => $imageURL, "canComment" => 'open' == $post->comment_status, "showCommentsIcon" => $showCommentsIcon); if (isset($c->themeRemoveAttr)) { if (!in_array('author', $c->themeRemoveAttr)) { $header['author'] = "{$authorName}"; } if (!in_array('date', $c->themeRemoveAttr)) { $header['date'] = "{$postDate}"; } if (!in_array('numOfComments', $c->themeRemoveAttr)) { $header['numOfComments'] = $totalComments; } } return $header; }
function wiziapp_getAllLinks() { $header = array('action' => 'wiziapp_getAllLinks', 'status' => TRUE, 'code' => 200, 'message' => ''); $linksLimit = WiziappConfig::getInstance()->links_list_limit; $pageNumber = isset($_GET['wizipage']) ? $_GET['wizipage'] : 0; $links = get_bookmarks(array('limit' => $linksLimit, 'offset' => $pageNumber * $linksLimit)); $linksSummary = array(); foreach ($links as $link) { $linksSummary[$link->link_url] = $link->link_name; } // Get the total number of pages $total = $GLOBALS['WiziappDB']->get_links_count(); echo json_encode(array('header' => $header, 'links' => $linksSummary, 'total' => $total)); }
public function getAll() { $albums = array(); // Get all the images grouped by the content $data = WiziappDB::getInstance()->get_images_for_albums(); if ($data !== FALSE) { // We have images, now we need to sort them into albums if they fit the rules foreach ($data as $content_id => $images) { $minimumForAppearInAlbums = WiziappConfig::getInstance()->count_minimum_for_appear_in_albums; if (count($images) >= $minimumForAppearInAlbums) { $albums[] = $this->_prepareAlbumBasicData($content_id, $images); } } } return $albums; }
/** * Revert the installation to remove everything the plugin added */ public function uninstall() { WiziappDB::getInstance()->uninstall(); // Remove scheduled tasks wp_clear_scheduled_hook('wiziapp_daily_function_hook'); wp_clear_scheduled_hook('wiziapp_weekly_function_hook'); wp_clear_scheduled_hook('wiziapp_monthly_function_hook'); // Deactivate the blog with the global services try { $cms = new WiziappCms(); $cms->deactivate(); } catch (Exception $e) { // If it failed, it's ok... move on } // Remove all options - must be done last delete_option('wiziapp_screens'); delete_option('wiziapp_components'); delete_option('wiziapp_pages'); delete_option('wiziapp_last_processed'); WiziappConfig::getInstance()->uninstall(); }
function wiziapp_get_pageflip_albums($existing_albums) { if (!is_array($existing_albums)) { return $existing_albums; } global $pageFlip; if (is_object($pageFlip) && is_a($pageFlip, 'pageFlip_plugin_base')) { $metadata = $GLOBALS['WiziappDB']->get_media_metadata('image', array('pageflipbook-id')); foreach ($metadata as $media_id => $keys) { $galleries[$media_id] = $keys['pageflipbook-id']; } // $galleries = array_unique($galleries); foreach ($galleries as $media_id => $gallery) { $post_ID = $GLOBALS['WiziappDB']->get_content_by_media_id($media_id); $the_post = get_post($post_ID); $dateline = $the_post->post_date; $book = new Book($gallery); $book->load(); $images_url = array(); $pages = array_slice($book->pages, 0); $minimumForAppearInAlbums = WiziappConfig::getInstance()->count_minimum_for_appear_in_albums; if (count($pages) >= $minimumForAppearInAlbums) { foreach ($pages as $page) { /** We dont resize images anymore!!! Only thumbnails, on demand. $realImage = new WiziappImageHandler(htmlspecialchars_decode($page->image)); $url_to_resized_image = $realImage->getResizedImageUrl($page->image, wiziapp_getMultiImageWidthLimit(), 0, 'resize'); */ $images_url[] = $page->image; } $imagesCount = count($images_url); // if ($imagesCount >= $minimumForAppearInAlbums) { // $images_url = array_slice($images_url, 0, 3); //Limit to 3 for display $album = array('id' => $book->id, 'postID' => $post_ID, 'name' => str_replace('&', '&', $the_post->post_title), 'plugin' => 'pageflip', 'numOfImages' => $imagesCount, 'images' => $images_url, 'publish_date' => $dateline); $existing_albums[] = $album; // } } } } return $existing_albums; }
public function render() { // Load the form from the api services inside an iframe // show the iframe as an overlay $httpProtocol = 'https'; $iframeSrc = $httpProtocol . '://' . WiziappConfig::getInstance()->api_server . '/cms/reportIssue/?v=' . WIZIAPP_P_VERSION; $iframeSrc .= '&d=' . urlencode($this->data) . '&c=' . urlencode(get_bloginfo('url') . "/?wiziapp/system/frame&report=1"); ?> <?php // <script src="http://cdn.jquerytools.org/1.2.5/all/jquery.tools.min.js"></script> ?> <script type="text/javascript" src="<?php echo get_bloginfo('url') . '/wp-content/plugins/wiziapp/themes/admin/report_issue.js'; ?> "></script> <style> #wiziapp_report_issue_container{ height: 420px; margin: 0 auto; width: 530px; } #wiziapp_report_issue_container iframe{ width: 100%; height: 100%; border: 0px none; overflow:hidden; } </style> <div id="wiziapp_report_issue_container"> <iframe id="wiziapp_report_frame" src="<?php echo $iframeSrc; ?> " frameborder="0" data-origin="<?php echo "{$httpProtocol}://" . WiziappConfig::getInstance()->api_server; ?> "></iframe> </div> <?php }
function wiziapp_get_wordpress_albums($existing_albums) { if (!is_array($existing_albums)) { return $existing_albums; } $albumsFromWordpress = array(); $albums = array(); $data = $GLOBALS['WiziappDB']->get_media_metadata('image', array('wordpress-gallery-id')); //$data = $GLOBALS['WiziappDB']->get_media_metadata_not_equal('image', array('cincopa-id'=>'', 'nextgen-gallery-id'=>'', 'nextgen-album-id'=>'', 'pageflipbook-id'=>'')); if ($data !== FALSE) { foreach ($data as $content_id => $medias) { $minimumForAppearInAlbums = WiziappConfig::getInstance()->count_minimum_for_appear_in_albums; if (count($medias) >= $minimumForAppearInAlbums) { $images = array(); foreach ($medias as $media) { /** We dont resize images anymore!!! Only thumbnails, on demand. $realImage = new WiziappImageHandler($media[info]->attributes->src); $url_to_resized_image = $realImage->getResizedImageUrl($media[info]->attributes->src, wiziapp_getMultiImageWidthLimit(), 0, 'resize'); $width = $realImage->getNewWidth(); $height = $realImage->getNewHeight(); */ $images[] = $media['info']->attributes->src; } $imagesCount = count($images); $GLOBALS['WiziappLog']->write('info', "The Wordpress album ID is " . $content_id, 'wordpress_plugin.wiziapp_get_wordpress_albums'); $albumsFromWordpress[] = array('content_id' => $content_id, 'count' => $imagesCount, 'images' => $images); } } } if (!empty($albumsFromWordpress)) { foreach ($albumsFromWordpress as $gallery) { $the_post = get_post($gallery['content_id']); $album = array('id' => (string) $gallery['content_id'], 'postID' => $the_post->ID, 'name' => (string) str_replace('&', '&', $the_post->post_title), 'plugin' => (string) 'wordpress', 'numOfImages' => (int) $gallery['count'], 'images' => $gallery['images'], 'publish_date' => $the_post->post_date); $albums[] = $album; } } $result = array_merge($existing_albums, $albums); return $result; }
/** * Helper function to send post http requests to wiziapp admin server * * @param array $params the parameters to send * @param string $url the url to access * @param string $method the connection method * @param array $headers the custom headers to send with the request * * @return array as follows: * array( * 'headers'=>an array of response headers, such as "x-powered-by" => "PHP/5.2.1", * 'body'=>the response string sent by the server, as you would see it with you web browser * 'response'=>an array of HTTP response codes. Typically, you'll want to have array('code'=>200, 'message'=>'OK'), * 'cookies'=>an array of cookie information * ) */ function wiziapp_http_request($params, $path, $method = 'POST', $headers = array()) { global $wp_version; /* * Wordpress 2.7 and above have a built in class for that. * Using it will let us be more flexible with our requirements. */ if (!class_exists('WP_Http', false)) { include_once ABSPATH . WPINC . '/http.php'; } $http_host = WiziappConfig::getInstance()->api_server; $api_url = "https://{$http_host}{$path}"; $GLOBALS['WiziappLog']->write('debug', "Contacting wiziapp server: {$api_url}", "http_requests.wiziapp_http_request"); $headers = array_merge(WiziappConfig::getInstance()->getCommonApiHeaders(), $headers); $headers = array_filter($headers); $GLOBALS['WiziappLog']->write('debug', "Contacting wiziapp server with headers: " . print_r($headers, TRUE) . " and params: " . print_r($params, TRUE), "http_requests.wiziapp_http_request"); $request = new WP_Http(); $params = array('method' => $method, 'body' => $params, 'timeout' => 60, 'blocking' => TRUE, 'sslverify' => FALSE, 'headers' => $headers); $params = apply_filters('wiziapp_request_params', $params, $http_host); $result = $request->request($api_url, $params); $GLOBALS['WiziappLog']->write('info', "The result was: " . print_r($result, TRUE), "http_requests.wiziapp_http_request"); return $result; }
public function testToken() { // If we don't have a token, try to get it again $activated = !empty(WiziappConfig::getInstance()->app_token); if (!$activated) { $cms = new WiziappCms(); $activated = $cms->activate(); } if (!$activated) { $errors = new WiziappError(); if (!$this->testedConnection) { $connTest = $this->testConnection(); if (WiziappError::isError($connTest)) { $errors = $connTest; } } if (!$this->hadConnectionError) { // If we already had connections errors, we are showing the problems from those errors // Else... $this->critical = TRUE; $errors->add('missing_token', __('Oops! It seems that the main server is not responding. Please make sure that your internet connection is working, and try again.', 'wiziapp')); } return $errors; } return TRUE; }
function wiziapp_hide_upgrade_msg() { $status = TRUE; WiziappConfig::getInstance()->show_need_upgrade_msg = FALSE; WiziappConfig::getInstance()->last_version_shown = WiziappConfig::getInstance()->wiziapp_avail_version; $header = array('action' => 'hideUpgradeMsg', 'status' => $status, 'code' => $status ? 200 : 4004, 'message' => ''); echo json_encode(array('header' => $header)); exit; }
$GLOBALS['WiziappEtagOverride'] .= serialize($post); $GLOBALS['WiziappLog']->write('info', "The id: {$post->ID}", "themes.default.index"); if (isset($GLOBALS['wp_posts_listed'])) { if (in_array($post->ID, $GLOBALS['wp_posts_listed'])) { continue; } else { $GLOBALS['wp_posts_listed'][] = $post->ID; } } /** * In this template we are only doing posts list * for posts list we will to pre-load the post template so get the template * inside a string to pass it to the component building functions */ $contents = null; if (WiziappConfig::getInstance()->usePostsPreloading()) { $GLOBALS['WiziappLog']->write('info', "Preloading the posts", "themes.default.index"); ob_start(); include '_content.php'; $contents = ob_get_contents(); // Inject the doLoad method to avoid timing issues when getting the post in this bundle $contents = str_replace('</body>', $injectLoadedScript . '</body>', $contents); ob_end_clean(); } wiziapp_appendComponentByLayout($cPage, $wiziapp_block, $post->ID, $contents); } ob_end_clean(); // End capturing output from loop events // In case something in the template changed, add the modified date to the etag $GLOBALS['WiziappEtagOverride'] .= date("F d Y H:i:s.", filemtime(dirname(__FILE__) . '/_content.php')); $GLOBALS['WiziappEtagOverride'] .= date("F d Y H:i:s.", filemtime(dirname(__FILE__) . '/index.php'));
/** * Attribute getter method * * @return the imageURL of the component */ function get_imageURL_attr() { $type = $this->imageSizes['default']; if (isset($this->imageSizes[$this->layout])) { $type = $this->imageSizes[$this->layout]; } $size = WiziappConfig::getInstance()->getImageSize($type); $limitSize = WiziappConfig::getInstance()->getImageSize('limit_post_thumb'); return wiziapp_getPostThumbnail($this->post, $size, $limitSize, FALSE); }
function wiziapp_buildAboutScreen() { $actions = array(); $pages = get_option('wiziapp_pages'); foreach ($pages['about'] as $aboutPage) { $actions[] = array('imageURL' => 'cuts_reg_gold', 'title' => "{$aboutPage}", 'actionURL' => wiziapp_buildBlogPageLink($aboutPage)); } $app_name = WiziappConfig::getInstance()->app_name; if (strlen($app_name) > 20) { $app_name = wiziapp_makeShortString($app_name, 20); } $page = array('title' => $app_name, 'version' => __('version') . ' ' . WiziappConfig::getInstance()->version, 'imageURL' => WiziappConfig::getInstance()->getAppIcon(), 'aboutTitle' => __('About', 'wiziapp') . ' ' . $app_name, 'aboutContent' => WiziappConfig::getInstance()->getAppDescription(), 'actions' => array()); $screen = wiziapp_prepareScreen($page, __(WiziappConfig::getInstance()->getScreenTitle('about'), 'wiziapp'), 'about'); $screen['screen']['class'] = 'about_screen'; echo json_encode($screen); }
/** * @package WiziappWordpressPlugin * @subpackage AdminDisplay * @author comobix.com plugins@comobix.com */ function wiziapp_generator_display() { // Before opening this display get a one time usage token $response = wiziapp_http_request(array(), '/generator/getToken?app_id=' . WiziappConfig::getInstance()->app_id, 'GET'); $tokenResponse = json_decode($response['body'], TRUE); $iframeId = 'wiziapp_generator' . time(); if (!$tokenResponse['header']['status']) { // There was a problem with the token echo '<div class="error">' . $tokenResponse['header']['message'] . '</div>'; } else { $token = $tokenResponse['token']; $httpProtocol = 'https'; ?> <script src="http://cdn.jquerytools.org/1.2.5/all/jquery.tools.min.js"></script> <style> .overlay_close { background-image:url(<?php echo WiziappConfig::getInstance()->getCdnServer(); ?> /images/generator/close.png); position:absolute; right:-17px; top:-17px; cursor:pointer; height:35px; width:35px; } #wiziappBoxWrapper{ width: 390px; height: 760px; margin: 0px auto; padding: 0px; background: url(<?php echo WiziappConfig::getInstance()->getCdnServer(); ?> /images/simulator/phone.png) no-repeat scroll 8px 8px; } #wiziappBoxWrapper.sim_loaded{ background-image: none; } #wiziappBoxWrapper #loading_placeholder{ position: absolute; color:#E0E0E0; font-weight:bold; height:60px; top: 260px; left: 170px; width:75px; z-index: 0; } #wiziappBoxWrapper.sim_loaded #loading_placeholder{ display: none; } #wiziappBoxWrapper iframe{ visibility: hidden; } #wiziappBoxWrapper.sim_loaded iframe{ visibility: visible; } #wiziapp_generator_container{ background: #fff; } .processing_modal{ background: url(<?php echo WiziappConfig::getInstance()->getCdnServer(); ?> /images/generator/Pament_Prossing_Lightbox.png) no-repeat top left; display:none; height: 70px; padding: 25px 35px; width: 426px; } #publish_modal .processing_message{ font-size: 17px; } #publish_modal .loading_indicator{ margin: 8px auto 2px; } #create_account_modal_close{ display: none; clear: both; float: none; } .processing_modal .error{ margin: 0px; width: 407px; } .processing_message{ color: #000000; font-size: 18px; font-family: arial; margin: 2px 0; padding-left: 20px; } .processing_modal .loading_indicator{ background: url(<?php echo WiziappConfig::getInstance()->getCdnServer(); ?> /images/generator/lightgrey_counter.gif) no-repeat; width: 35px; height: 35px; margin: 2px auto; } #general_error_modal{ z-index: 999; } </style> <div id="wiziapp_generator_container"> <?php //$iframeSrc = 'http://'.wiziapp_getApiServer().'/generator?t='.$token; //$iframeSrc = $httpProtocol.'://'.wiziapp_getServicesServer().'/generator?t='.$token; $iframeSrc = $httpProtocol . '://' . WiziappConfig::getInstance()->api_server . '/generator/index/' . $token . '?v=' . WIZIAPP_P_VERSION; ?> <script type="text/javascript"> var WIZIAPP_HANDLER = (function(){ jQuery(document).ready(function(){ jQuery('.report_issue').click(reportIssue); jQuery('.retry_processing').click(retryProcessing); jQuery('#general_error_modal').bind('closingReportForm', function(){ jQuery(this).addClass('s_container'); }); }); function wiziappReceiveMessage(event){ // Just wrap our handleRequest if ( event.origin == '<?php echo "{$httpProtocol}://" . WiziappConfig::getInstance()->api_server; ?> ' ){ WIZIAPP_HANDLER.handleRequest(event.data); } }; if ( window.addEventListener ){ window.addEventListener("message", wiziappReceiveMessage, false); } var actions = { informErrorProcessing: function(params){ var $box = jQuery('#'+params.el); $box .find('.processing_message').hide().end() .find('.loading_indicator').hide().end() .find('.error').text(params.message).show().end() .find('.close').show().end(); $box = null; }, closeProcessing: function(params){ jQuery('#'+params.el).data("overlay").close(); if (typeof(params.reload) != 'undefined'){ if (params.reload == 1){ if (typeof(params.qs) != 'undefined'){ var href = top.location.href; var seperator = '?'; if (href.indexOf('?')) { seperator = '&'; } href += seperator + unescape(params.qs); top.location.replace(href); } else { top.location.reload(true); } } } if ( typeof(params.resizeTo) != 'undefined' ){ actions.resizeGeneratorIframe({height: params.resizeTo}); } }, informGeneralError: function(params){ var $box = jQuery('#'+params.el); $box .find('.wiziapp_error').text(params.message).end(); if ( parseInt(params.retry) == 0 ){ $box.find('.retry_processing').hide(); } else { $box.find('.retry_processing').show(); } if ( parseInt(params.report) == 0 ){ $box.find('.report_issue').hide(); } else { $box.find('.report_issue').show(); } if (!$box.data("overlay")){ $box.overlay({ fixed: true, top: 200, left: (screen.width / 2) - ($box.outerWidth() / 2), /**mask: { color: '#444444', loadSpeed: 200, opacity: 0.9 },*/ // disable this for modal dialog-type of overlays closeOnClick: false, closeOnEsc: false, // load it immediately after the construction load: true, onBeforeLoad: function(){ var $toCover = jQuery('#wpbody'); var $mask = jQuery('#wiziapp_error_mask'); if ( $mask.length == 0 ){ $mask = jQuery('<div></div>').attr("id", "wiziapp_error_mask"); jQuery("body").append($mask); } $mask.css({ position:'absolute', top: $toCover.offset().top, left: $toCover.offset().left, width: $toCover.outerWidth(), height: $toCover.outerHeight(), display: 'block', opacity: 0.9, backgroundColor: '#444444' }); $mask = $toCover = null; } }); } else { $box.show(); $box.data("overlay").load(); } $box = null; }, showProcessing: function(params){ var $box = jQuery('#'+params.el); $box .find('.error').hide().end() .find('.loading_indicator').show().end() .find('.close').hide().end() .find('.processing_message').show().end(); if (!$box.data("overlay")){ $box.overlay({ fixed: true, top: 200, left: (screen.width / 2) - ($box.outerWidth() / 2), mask: { color: '#444444', loadSpeed: 200, opacity: 0.9 }, // disable this for modal dialog-type of overlays closeOnClick: false, // load it immediately after the construction load: true }); } else { $box.show(); $box.data("overlay").load(); } $box = null; }, showSim: function(params){ var url = decodeURIComponent(params.url); url = url + '&rnd=' + Math.floor(Math.random()*999999); var $box = jQuery("#wiziappBoxWrapper"); if ($box.length == 0){ $box = jQuery("<div id='wiziappBoxWrapper'><div class='close overlay_close'></div><div id='loading_placeholder'>Loading...</div><iframe id='wiziappBox'></iframe>"); $box.find("iframe").attr('src', url+"&preview=1").unbind('load').bind('load', function(){ jQuery("#wiziappBoxWrapper").addClass('sim_loaded'); }); $box.appendTo(document.body); $box.find("iframe").css({ 'border': '0px none', 'height': '760px', 'width': '390px' }); $box.overlay({ top: 20, fixed: false, mask: { color: '#444', loadSpeed: 200, opacity: 0.8 }, closeOnClick: true, onClose: function(){ jQuery("#wiziappBoxWrapper").remove(); }, load: true }); } else { $box.show(); $box.data("overlay").load(); } $box = null; }, resizeGeneratorIframe: function(params){ jQuery("#<?php echo $iframeId; ?> ").css({ 'height': (parseInt(params.height) + 50) + 'px' }); } }; function retryProcessing(event){ event.preventDefault(); document.location.reload(true); return false; }; function reportIssue(event){ // Change the current box style so it will enable containing the report form event.preventDefault(); var $box = jQuery('#general_error_modal'); var $el = $box.find('.report_container'); var params = { action: 'wiziapp_report_issue', data: $box.find('.wiziapp_error').text() }; $el.load(ajaxurl, params, function(){ var $mainEl = jQuery('#general_error_modal'); $mainEl .removeClass('s_container') .find(".errors_container").hide().end() .find(".report_container").show().end(); $mainEl = null; }); var $el = null; return false; }; return { handleRequest: function(q){ var paramsArray = q.split('&'); var params = {}; for (var i = 0; i < paramsArray.length; ++i) { var parts = paramsArray[i].split('='); params[parts[0]] = decodeURIComponent(parts[1]); } if (typeof(actions[params.action]) == "function"){ actions[params.action](params); } params = q = paramsArray = null; } }; })(); jQuery(document).ready(function($){ var $iframe = $("<iframe frameborder='0'>"); $("#wiziapp_generator_container").prepend($iframe); $iframe.css({ 'overflow': 'hidden', 'width': '100%', 'height': '1000px', 'border': '0px none' }).attr({ 'src': "<?php echo $iframeSrc; ?> ", 'frameborder': '0', 'id': '<?php echo $iframeId; ?> ' }); }); </script> </div> <div class="hidden wiziapp_errors_container s_container" id="general_error_modal"> <div class="errors_container"> <div class="errors"> <div class="wiziapp_error"></div> </div> <div class="buttons"> <a href="javascript:void(0);" class="report_issue">Report a Problem</a> <a class="retry_processing close" href="javascript:void(0);">Retry</a> </div> </div> <div class="report_container hidden"> </div> </div> <div class="processing_modal" id="create_account_modal"> <p class="processing_message">Please wait while we place your order...</p> <div class="loading_indicator"></div> <p class="error" class="errorMessage hidden"></p> <a class="close hidden" href="javascript:void(0);">Go back</a> </div> <div class="processing_modal" id="publish_modal"> <p class="processing_message">Please wait while we are processing your request...</p> <div class="loading_indicator"></div> <p class="error" class="errorMessage hidden"></p> <a class="close hidden" href="javascript:void(0);">Go back</a> </div> <div class="processing_modal" id="reload_modal"> <p class="processing_message">It seems your session has timed out.</p> <p>please <a href="javascript:top.document.location.reload(true);">refresh</a> this page to try again</p> <p class="error" class="errorMessage hidden"></p> <a class="close hidden" href="javascript:void(0);">Go back</a> </div> <?php } }
function wiziapp_getCacheTimestampKey() { return WiziappConfig::getInstance()->last_recorded_save; }
public function deactivate() { // Inform the system control $blogUrl = get_bloginfo('url'); $urlData = explode('://', $blogUrl); $response = wiziapp_http_request(array(), '/cms/deactivate?app_id=' . WiziappConfig::getInstance()->app_id . '&url=' . urlencode($urlData[1]), 'POST'); $this->deleteUser(); }
wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?> </title> <meta name="viewport" content="width=device-width,user-scalable=no" /> <?php /** * The application is preloading the posts as strings, we need to include as much * data as we can and save on network connections, so load the css directly in the file */ ?> <style type="text/css"> <?php $cssFileName = dirname(__FILE__) . '/' . WiziappConfig::getInstance()->wiziapp_theme_name . '.css'; $baseCssFileName = dirname(__FILE__) . '/style.css'; $baseFile = file_get_contents($baseCssFileName); $file = file_get_contents($cssFileName); $css = $baseFile . $file; /* remove comments */ $css = preg_replace('!/\\*[^*]*\\*+([^/][^*]*\\*+)*/!', '', $css); /* remove tabs, spaces, newlines, etc. */ $css = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $css); echo $css; ?> </style> </head> <body class="registration"> <div class="page_content"> <div class="post">
/** * Attribute getter method * * @return the thumbnailURL of the component */ function get_thumbnailURL_attr() { $image = new WiziappImageHandler($this->data[0]['thumb']); $size = WiziappConfig::getInstance()->getImageSize('video_album_thumb'); return $image->getResizedImageUrl($this->data[0]['thumb'], $size['width'], $size['height']); //return $this->data[0]['thumb']; }
function do_admin_head_section() { $cssFile = dirname(__FILE__) . '/../../themes/admin/style.css'; if (file_exists($cssFile)) { $css = file_get_contents($cssFile); /* remove comments */ $css = preg_replace('!/\\*[^*]*\\*+([^/][^*]*\\*+)*/!', '', $css); /* remove tabs, spaces, newlines, etc. */ $css = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $css); $cdnServer = WiziappConfig::getInstance()->getCdnServer(); $css = str_replace('@@@WIZIAPP_CDN@@@', $cdnServer, $css); echo '<style type="text/css">' . $css . '</style>'; } }
function wiziapp_get_cincopa_albums($existing_albums) { /** * @todo: Add a cincopa plugin * The cincopa plugin adds everything as iframes and javascript code, so we need * to digg in and create a new "wordpress plugin" that will use the cincopa api directly */ if (!is_array($existing_albums)) { return $existing_albums; } $cincopaAlbums = array(); $metadata = $GLOBALS['WiziappDB']->get_media_metadata('image', array('cincopa-id')); if ($metadata !== FALSE) { foreach ($metadata as $media_id => $keys) { $cincopaAlbums[$media_id] = $keys['cincopa-id']; } } // $cincopaAlbums = array_unique($cincopaAlbums); if (function_exists('WpMediaCincopa_init') || function_exists('_cpmp_WpMediaCincopa_init')) { $cincopaResponse = array(); $processedAlbums = array(); foreach ($cincopaAlbums as $media_id => $gallery) { $post_ID = $GLOBALS['WiziappDB']->get_content_by_media_id($media_id); if (!isset($processedAlbums[$post_ID])) { $processedAlbums[$post_ID] = array(); } if (!isset($processedAlbums[$post_ID][$gallery])) { $the_post = get_post($post_ID); $dateline = $the_post->post_date; $images_url = array(); $json = array(); if (!isset($cincopaResponse[$post_ID])) { $json = wiziapp_cincopaJson($gallery); $cincopaResponse[$post_ID] = $json; } else { $json = $cincopaResponse[$post_ID]; } $realImages = array_slice($json->items, 0); //All images $minimumForAppearInAlbums = WiziappConfig::getInstance()->count_minimum_for_appear_in_albums; if (count($realImages) >= $minimumForAppearInAlbums) { foreach ($realImages as $image) { /** We dont resize images anymore!!! Only thumbnails, on demand. $realImage = new WiziappImageHandler(htmlspecialchars_decode($image->content_url)); $url_to_resized_image = $realImage->getResizedImageUrl($image->content_url, wiziapp_getMultiImageWidthLimit(), 0, 'resize'); */ $images_url[] = htmlspecialchars_decode($image->thumbnail_url); } $imagesCount = count($images_url); // if ($imagesCount >= $minimumForAppearInAlbums) { // $images_url = array_slice($images_url, 0, 3); //Limit to 3 for display $album = array('id' => (string) $gallery, 'postID' => $post_ID, 'name' => (string) $the_post->post_title, 'plugin' => (string) 'cincopa', 'numOfImages' => (int) $imagesCount, 'images' => $images_url, 'publish_date' => $dateline); $existing_albums[] = $album; // } } $processedAlbums[$post_ID][$gallery] = TRUE; } // Set in the processed array, dont need to process twice... } } return $existing_albums; }
echo '<script type="text/javascript" src="' . WiziappConfig::getInstance()->getCdnServer() . '/scripts/jScrollPane-1.2.3.min.js"></script>'; } else { echo '@@@BASE@@@'; } ?> <style type="text/css"> <?php $cssFileName = dirname(__FILE__) . '/' . WiziappConfig::getInstance()->wiziapp_theme_name . '.css'; $baseCssFileName = dirname(__FILE__) . '/style.css'; $baseFile = file_get_contents($baseCssFileName); $file = file_get_contents($cssFileName); $css = $baseFile . $file; /* remove comments */ $css = preg_replace('!/\\*[^*]*\\*+([^/][^*]*\\*+)*/!', '', $css); /* remove tabs, spaces, newlines, etc. */ $css = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $css); $cdnServer = WiziappConfig::getInstance()->getCdnServer(); $css = str_replace("@@@WIZIAPP_CDN@@@", $cdnServer, $css); if (isset($_GET['sim']) && isset($_GET['sim']) == 1) { $css .= ' body{ overflow-y: hidden; }'; } echo $css; ?> </style> <link id="themeCss" rel="stylesheet" href="https://<?php echo WiziappConfig::getInstance()->api_server . '/application/postViewCss/' . WiziappConfig::getInstance()->app_id . '?v=' . WIZIAPP_VERSION . '&c=' . (WiziappConfig::getInstance()->configured ? 1 : 0); ?> " type="text/css" /> </head> <body>
function wiziapp_push_interval_function($period, $period_text) { if (!WiziappConfig::getInstance()->notify_on_new_post) { return; } $request = null; $tabId = WiziappConfig::getInstance()->main_tab_index; if (WiziappConfig::getInstance()->aggregate_notifications && WiziappConfig::getInstance()->notify_periods == $period) { if (!isset(WiziappConfig::getInstance()->counters)) { // We don't have any counters in place yet, no need to run return; } if (WiziappConfig::getInstance()->counters['posts'] > 0) { $sound = WiziappConfig::getInstance()->trigger_sound; $badge = WiziappConfig::getInstance()->show_badge_number ? WiziappConfig::getInstance()->counters['posts'] : 0; $users = 'all'; $request = array('type' => 1, 'sound' => $sound, 'badge' => $badge, 'users' => $users); if (WiziappConfig::getInstance()->show_notification_text) { $request['content'] = urlencode(stripslashes(WiziappConfig::getInstance()->counters['posts'] . __(' new posts published ', 'wiziapp') . $period_text)); $request['params'] = "{\"tab\": \"{$tabId}\"}"; } // reset the counter WiziappConfig::getInstance()->counters['posts'] = 0; } } }
/** * Attribute getter method * * @return the thumbnailURL of the component */ function get_thumbnailURL_attr() { $image = new WiziappImageHandler($this->image->imageURL); $size = WiziappConfig::getInstance()->getImageSize('images_thumb'); //return $image->getResizedImageUrl($this->image->imageURL, $size['width'], $size['height']); return $image->getResizedImageUrl($this->image->imageURL, $size['width'], 0); //return $this->image->thumbURL; }