• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP nggdb类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中nggdb的典型用法代码示例。如果您正苦于以下问题:PHP nggdb类的具体用法?PHP nggdb怎么用?PHP nggdb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了nggdb类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: validation

 /**
  * Validates whether the gallery can be saved
  */
 function validation()
 {
     // If a title is present, we can auto-populate some other properties
     if (isset($this->object->title)) {
         // If no name is present, use the title to generate one
         if (!isset($this->object->name)) {
             $this->object->name = sanitize_file_name(sanitize_title($this->object->title));
             $this->object->name = apply_filters('ngg_gallery_name', $this->object->name);
         }
         // If no slug is set, use the title to generate one
         if (!isset($this->object->slug)) {
             $this->object->slug = nggdb::get_unique_slug(sanitize_title($this->object->title), 'gallery');
         }
     }
     // Set what will be the path to the gallery
     if (empty($this->object->path)) {
         $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
         $this->object->path = $storage->get_upload_relpath($this->object);
         unset($storage);
     }
     $this->object->validates_presence_of('title');
     $this->object->validates_presence_of('name');
     $this->object->validates_uniqueness_of('slug');
     $this->object->validates_numericality_of('author');
     return $this->object->is_valid();
 }
开发者ID:namwoody,项目名称:curry,代码行数:29,代码来源:class.gallery.php


示例2: nggMeta

 /**
  * nggMeta::nggMeta()
  * 
  * @param int $image path to a image
  * @param bool $onlyEXIF parse only exif if needed
  * @return
  */
 function nggMeta($pic_id, $onlyEXIF = false)
 {
     //get the path and other data about the image
     $this->image = nggdb::find_image($pic_id);
     $this->image = apply_filters('ngg_find_image_meta', $this->image);
     if (!file_exists($this->image->imagePath)) {
         return false;
     }
     $this->size = @getimagesize($this->image->imagePath, $metadata);
     if ($this->size && is_array($metadata)) {
         // get exif - data
         if (is_callable('exif_read_data')) {
             $this->exif_data = @exif_read_data($this->image->imagePath, 0, true);
         }
         // stop here if we didn't need other meta data
         if ($onlyEXIF) {
             return true;
         }
         // get the iptc data - should be in APP13
         if (is_callable('iptcparse') && isset($metadata['APP13'])) {
             $this->iptc_data = @iptcparse($metadata['APP13']);
         }
         // get the xmp data in a XML format
         if (is_callable('xml_parser_create')) {
             $this->xmp_data = $this->extract_XMP($this->image->imagePath);
         }
         return true;
     }
     return false;
 }
开发者ID:Ashleyotero,项目名称:oldest-old,代码行数:37,代码来源:meta.php


示例3: slideshow

    public function slideshow($galleryID, $type)
    {
        if (!$galleryID) {
            return "";
        }
        $fade = $type == "widget" ? 'data-fade="enabled"' : "";
        $picturelist = nggdb::get_gallery($galleryID, $this->options['galSort'], $this->options['galSortDir']);
        $html = '<div class="sliderWrap"><div class="slider" data-delay="3" data-pause="enabled" ' . $fade . '>';
        $blank = PE_THEME_URL . "/img/blank.png";
        $first = true;
        foreach ($picturelist as $p) {
            if ($first) {
                $src = $p->thumbURL;
                $data = "";
                $first = false;
            } else {
                $src = $blank;
                $data = $p->thumbURL;
            }
            $html .= <<<EOL
<a data-target="prettyphoto" href="{$p->imageURL}" title="{$p->title}"><img src="{$src}" data-src="{$data}" alt="{$p->title}"/></a>
EOL;
        }
        $html .= "</div></div>";
        return $html;
    }
开发者ID:JeffreyBue,项目名称:jb,代码行数:26,代码来源:PeThemeNgg.php


示例4: ngg_ajax_operation

/**
 * Image edit functions via AJAX
 *
 * @author Alex Rabe
 *
 *
 * @return void
 */
function ngg_ajax_operation()
{
    // if nonce is not correct it returns -1
    check_ajax_referer("ngg-ajax");
    // check for correct capability
    if (!is_user_logged_in()) {
        die('-1');
    }
    // check for correct NextGEN capability
    if (!current_user_can('NextGEN Upload images') && !current_user_can('NextGEN Manage gallery')) {
        die('-1');
    }
    // include the ngg function
    include_once dirname(__FILE__) . '/functions.php';
    // Get the image id
    if (isset($_POST['image'])) {
        $id = (int) $_POST['image'];
        // let's get the image data
        $picture = nggdb::find_image($id);
        // what do you want to do ?
        switch ($_POST['operation']) {
            case 'create_thumbnail':
                $result = nggAdmin::create_thumbnail($picture);
                break;
            case 'resize_image':
                $result = nggAdmin::resize_image($picture);
                break;
            case 'rotate_cw':
                $result = nggAdmin::rotate_image($picture, 'CW');
                nggAdmin::create_thumbnail($picture);
                break;
            case 'rotate_ccw':
                $result = nggAdmin::rotate_image($picture, 'CCW');
                nggAdmin::create_thumbnail($picture);
                break;
            case 'set_watermark':
                $result = nggAdmin::set_watermark($picture);
                break;
            case 'recover_image':
                $result = nggAdmin::recover_image($id) ? '1' : '0';
                break;
            case 'import_metadata':
                $result = C_Image_Mapper::get_instance()->reimport_metadata($id) ? '1' : '0';
                break;
            case 'get_image_ids':
                $result = nggAdmin::get_image_ids($id);
                break;
            default:
                do_action('ngg_ajax_' . $_POST['operation']);
                die('-1');
                break;
        }
        // A success should return a '1'
        die($result);
    }
    // The script should never stop here
    die('0');
}
开发者ID:kixortillan,项目名称:dfosashworks,代码行数:66,代码来源:ajax.php


示例5: set_defaults

 /**
  * Sets the defaults for an album
  * @param C_DataMapper_Model|C_Album|stdClass $entity
  */
 function set_defaults($entity)
 {
     $this->object->_set_default_value($entity, 'name', '');
     $this->object->_set_default_value($entity, 'albumdesc', '');
     $this->object->_set_default_value($entity, 'sortorder', array());
     $this->object->_set_default_value($entity, 'previewpic', 0);
     $this->object->_set_default_value($entity, 'exclude', 0);
     $this->object->_set_default_value($entity, 'slug', nggdb::get_unique_slug(sanitize_title($entity->name), 'album'));
 }
开发者ID:jeanpage,项目名称:ca_learn,代码行数:13,代码来源:class.album_mapper.php


示例6: ewww_added_new_image

 function ewww_added_new_image($image, $storage = null)
 {
     ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
     global $ewww_defer;
     if (empty($storage)) {
         // creating the 'registry' object for working with nextgen
         $registry = C_Component_Registry::get_instance();
         // creating a database storage object from the 'registry' object
         $storage = $registry->get_utility('I_Gallery_Storage');
     }
     // find the image id
     if (is_array($image)) {
         $image_id = $image['id'];
         $image = $storage->object->_image_mapper->find($image_id, TRUE);
     } else {
         $image_id = $storage->object->_get_image_id($image);
     }
     ewwwio_debug_message("image id: {$image_id}");
     if ($ewww_defer && ewww_image_optimizer_get_option('ewww_image_optimizer_defer')) {
         ewww_image_optimizer_add_deferred_attachment("nextgen2,{$image_id}");
         return;
     }
     // get an array of sizes available for the $image
     $sizes = $storage->get_image_sizes();
     // run the optimizer on the image for each $size
     foreach ($sizes as $size) {
         if ($size === 'full') {
             $full_size = true;
         } else {
             $full_size = false;
         }
         // get the absolute path
         $file_path = $storage->get_image_abspath($image, $size);
         ewwwio_debug_message("optimizing (nextgen): {$file_path}");
         // optimize the image and grab the results
         $res = ewww_image_optimizer($file_path, 2, false, false, $full_size);
         ewwwio_debug_message("results {$res[1]}");
         // only if we're dealing with the full-size original
         if ($size === 'full') {
             // update the metadata for the optimized image
             $image->meta_data['ewww_image_optimizer'] = $res[1];
         } else {
             $image->meta_data[$size]['ewww_image_optimizer'] = $res[1];
         }
         nggdb::update_image_meta($image_id, $image->meta_data);
         ewwwio_debug_message('storing results for full size image');
     }
     return $image;
 }
开发者ID:agiper,项目名称:wordpress,代码行数:49,代码来源:nextgen2-integration.php


示例7: ewww_added_new_image

 function ewww_added_new_image($image, $storage = null)
 {
     global $ewww_debug;
     $ewww_debug .= "<b>ewww_added_new_image()</b><br>";
     if (empty($storage)) {
         // creating the 'registry' object for working with nextgen
         $registry = C_Component_Registry::get_instance();
         // creating a database storage object from the 'registry' object
         $storage = $registry->get_utility('I_Gallery_Storage');
     }
     // find the image id
     $image_id = $storage->object->_get_image_id($image);
     $ewww_debug .= "image id: {$image_id}<br>";
     // get an array of sizes available for the $image
     $sizes = $storage->get_image_sizes();
     // run the optimizer on the image for each $size
     foreach ($sizes as $size) {
         if ($size === 'full') {
             $full_size = true;
         } else {
             $full_size = false;
         }
         // get the absolute path
         $file_path = $storage->get_image_abspath($image, $size);
         $ewww_debug .= "optimizing (nextgen): {$file_path}<br>";
         // optimize the image and grab the results
         $res = ewww_image_optimizer($file_path, 2, false, false, $full_size);
         $ewww_debug .= "results " . $res[1] . "<br>";
         // only if we're dealing with the full-size original
         if ($size === 'full') {
             // update the metadata for the optimized image
             $image->meta_data['ewww_image_optimizer'] = $res[1];
         } else {
             $image->meta_data[$size]['ewww_image_optimizer'] = $res[1];
         }
         nggdb::update_image_meta($image_id, $image->meta_data);
         $ewww_debug .= 'storing results for full size image<br>';
     }
     ewww_image_optimizer_debug_log();
     return $image;
 }
开发者ID:hkarriche,项目名称:wordpress,代码行数:41,代码来源:nextgen2-integration.php


示例8: ngg_ajax_operation

function ngg_ajax_operation()
{
    global $wpdb;
    // if nonce is not correct it returns -1
    check_ajax_referer("ngg-ajax");
    // check for correct capability
    if (!is_user_logged_in()) {
        die('-1');
    }
    // check for correct NextGEN capability
    if (!current_user_can('NextGEN Upload images') || !current_user_can('NextGEN Manage gallery')) {
        die('-1');
    }
    // include the ngg function
    include_once dirname(__FILE__) . '/functions.php';
    // Get the image id
    if (isset($_POST['image'])) {
        $id = (int) $_POST['image'];
        // let's get the image data
        $picture = nggdb::find_image($id);
        // what do you want to do ?
        switch ($_POST['operation']) {
            case 'create_thumbnail':
                $result = nggAdmin::create_thumbnail($picture);
                break;
            case 'resize_image':
                $result = nggAdmin::resize_image($picture);
                break;
            case 'set_watermark':
                $result = nggAdmin::set_watermark($picture);
                break;
            default:
                die('-1');
                break;
        }
        // A success should retun a '1'
        die($result);
    }
    // The script should never stop here
    die('0');
}
开发者ID:pravinhirmukhe,项目名称:flow1,代码行数:41,代码来源:ajax.php


示例9: add_gallery_gid

    function add_gallery_gid($gid = '', $title = '', $path = '', $description = '',
        $pageid = 0, $previewpic = 0, $author = 0  )
    {
        global $wpdb;
       
        $slug = nggdb::get_unique_slug( sanitize_title( $title ), 'gallery' );
		
		if ( false === $wpdb->query( $wpdb->prepare(
            "INSERT INTO $wpdb->nggallery (
                gid, name, slug, path, title, galdesc, pageid, previewpic, author
            ) VALUES (
                %d, %s, %s, %s, %s, %s, %d, %d, %d)",
            $gid, $slug, $slug, $path, $title, $description, $pageid, $previewpic, $author )))
        {
			return false;
		}
		
		$galleryID = (int) $wpdb->insert_id;
         
		//and give me the new id		
		return $galleryID;
    }
开发者ID:robehickman,项目名称:Scripts,代码行数:22,代码来源:gengal.php


示例10: getNGGalleryImages

function getNGGalleryImages($ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset, &$error)
{
    $result = array();
    $galids = explode(',', $ngGalleries);
    $imgids = explode(',', $ngImages);
    if (!isNGGalleryActive()) {
        return '';
    }
    try {
        $pictures = array();
        foreach ($galids as $g) {
            $pictures = array_merge($pictures, nggdb::get_gallery($g));
        }
        foreach ($imgids as $i) {
            array_push($pictures, nggdb::find_image($i));
        }
        foreach ($pictures as $p) {
            $item = array();
            $item["data"] = $p->thumbHTML;
            if (is_callable('exif_read_data')) {
                $exif = @exif_read_data($p->imagePath);
                if ($exif !== false) {
                    $item["lon"] = getExifGps($exif["GPSLongitude"], $exif['GPSLongitudeRef']);
                    $item["lat"] = getExifGps($exif["GPSLatitude"], $exif['GPSLatitudeRef']);
                    if ($item["lat"] != 0 || $item["lon"] != 0) {
                        $result[] = $item;
                    } else {
                        if (isset($p->imagedate)) {
                            $_dt = strtotime($p->imagedate) + $dtoffset;
                            $_item = findItemCoordinate($_dt, $dt, $lat, $lon);
                            if ($_item != null) {
                                $item["lat"] = $_item["lat"];
                                $item["lon"] = $_item["lon"];
                                $result[] = $item;
                            }
                        }
                    }
                }
            } else {
                $error .= "Sorry, <a href='http://php.net/manual/en/function.exif-read-data.php' target='_blank' >exif_read_data</a> function not found! check your hosting..<br />";
            }
        }
        /* START FIX NEXT GEN GALLERY 2.x */
        if (class_exists("C_Component_Registry")) {
            $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer');
            $params['gallery_ids'] = $ngGalleries;
            $params['image_ids'] = $ngImages;
            $params['display_type'] = NEXTGEN_GALLERY_BASIC_THUMBNAILS;
            $params['images_per_page'] = 999;
            // also add js references to get the gallery working
            $dummy = $renderer->display_images($params, $inner_content);
            /* START FIX NEXT GEN GALLERY PRO */
            if (preg_match("/data-nplmodal-gallery-id=[\"'](.*?)[\"']/", $dummy, $m)) {
                $galid = $m[1];
                if ($galid) {
                    for ($i = 0; $i < count($result); ++$i) {
                        $result[$i]["data"] = str_replace("%PRO_LIGHTBOX_GALLERY_ID%", $galid, $result[$i]["data"]);
                    }
                }
            }
            /* END FIX NEXT GEN GALLERY PRO */
        }
        /* END FIX NEXT GEN GALLERY 2.x */
    } catch (Exception $e) {
        $error .= 'Error When Retrieving NextGen Gallery galleries/images: $e <br />';
    }
    return $result;
}
开发者ID:kanei,项目名称:vantuch.cz,代码行数:68,代码来源:wp-gpx-maps_utils_nggallery.php


示例11: media_upload_nextgen_form


//.........这里部分代码省略.........
    ?>
" class="button-secondary" />
	</div>
	<br style="clear:both;" />
</div>
</form>

<form enctype="multipart/form-data" method="post" action="<?php 
    echo esc_attr($form_action_url);
    ?>
" class="media-upload-form" id="library-form">

	<?php 
    wp_nonce_field('ngg-media-form');
    ?>

	<script type="text/javascript">
	<!--
	jQuery(function($){
		var preloaded = $(".media-item.preloaded");
		if ( preloaded.length > 0 ) {
			preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
			updateMediaForm();
		}
	});
	-->
	</script>
	
	<div id="media-items">
	<?php 
    if (is_array($picarray)) {
        foreach ($picarray as $picid) {
            //TODO:Reduce SQL Queries
            $picture = nggdb::find_image($picid);
            ?>
			<div id='media-item-<?php 
            echo $picid;
            ?>
' class='media-item preloaded'>
			  <div class='filename'></div>
			  <a class='toggle describe-toggle-on' href='#'><?php 
            esc_attr(_e('Show', "nggallery"));
            ?>
</a>
			  <a class='toggle describe-toggle-off' href='#'><?php 
            esc_attr(_e('Hide', "nggallery"));
            ?>
</a>
			  <div class='filename new'><?php 
            echo empty($picture->alttext) ? wp_html_excerpt($picture->filename, 60) : stripslashes(wp_html_excerpt($picture->alttext, 60));
            ?>
</div>
			  <table class='slidetoggle describe startclosed'><tbody>
				  <tr>
					<td rowspan='4'><img class='thumbnail' alt='<?php 
            echo esc_attr($picture->alttext);
            ?>
' src='<?php 
            echo esc_attr($picture->thumbURL);
            ?>
'/></td>
					<td><?php 
            esc_attr(_e('Image ID:', "nggallery"));
            echo $picid;
            ?>
</td>
开发者ID:ahsaeldin,项目名称:projects,代码行数:67,代码来源:media-upload.php


示例12: ewww_image_optimizer_bulk_next

function ewww_image_optimizer_bulk_next($delay, $attachments)
{
    // toggle the resume flag to indicate an operation is in progress
    update_option('ewww_image_optimizer_bulk_ngg_resume', 'true');
    // need this file to work with metadata
    require_once WP_CONTENT_DIR . '/plugins/nextcellent-gallery-nextgen-legacy/lib/meta.php';
    foreach ($attachments as $id) {
        sleep($delay);
        // find out what time we started, in microseconds
        $started = microtime(true);
        // get the metadata
        $meta = new nggMeta($id);
        // retrieve the filepath
        $file_path = $meta->image->imagePath;
        // run the optimizer on the current image
        $fres = ewww_image_optimizer($file_path, 2, false, false, true);
        // update the metadata of the optimized image
        nggdb::update_image_meta($id, array('ewww_image_optimizer' => $fres[1]));
        // output the results of the optimization
        WP_CLI::line(__('Optimized image:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . $meta->image->filename);
        WP_CLI::line(sprintf(__('Full size - %s', EWWW_IMAGE_OPTIMIZER_DOMAIN), html_entity_decode($fres[1])));
        // get the filepath of the thumbnail image
        $thumb_path = $meta->image->thumbPath;
        // run the optimization on the thumbnail
        $tres = ewww_image_optimizer($thumb_path, 2, false, true);
        // output the results of the thumb optimization
        WP_CLI::line(sprintf(__('Thumbnail - %s', EWWW_IMAGE_OPTIMIZER_DOMAIN), html_entity_decode($tres[1])));
        // outupt how much time we spent
        $elapsed = microtime(true) - $started;
        WP_CLI::line(sprintf(__('Elapsed: %.3f seconds', EWWW_IMAGE_OPTIMIZER_DOMAIN), $elapsed));
        // get the list of attachments remaining from the db
        $attachments = get_option('ewww_image_optimizer_bulk_ngg_attachments');
        // remove the first item
        if (!empty($attachments)) {
            array_shift($attachments);
        }
        // and store the list back in the db
        update_option('ewww_image_optimizer_bulk_ngg_attachments', $attachments, false);
    }
    // reset all the bulk options in the db
    update_option('ewww_image_optimizer_bulk_ngg_resume', '');
    update_option('ewww_image_optimizer_bulk_ngg_attachments', '', false);
    // and let the user know we are done
    WP_CLI::success(__('Finished Optimization!', EWWW_IMAGE_OPTIMIZER_DOMAIN));
}
开发者ID:aaronfrey,项目名称:PepperLillie-CVM,代码行数:45,代码来源:iocli.php


示例13: display_thumb

 /**
  * display_thumb()
  *
  * This method displays the post thumbnail.
  *
  * @author Luca Grandicelli <[email protected]>
  * @copyright (C) 2011-2014 Luca Grandicelli
  * @package special-recent-posts-free
  * @version 2.0.4
  * @param $post The global WP post object.
  * @access private
  * @return mixed It could return the HTML code for the post thumbnail or false in case of some error.
  */
 private function display_thumb($post)
 {
     // Checking if featured thumbnails setting is active, if the current post has one and if it exists as file.
     if (function_exists('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
         // Fetching Thumbnail ID.
         $thumbnail_id = get_post_thumbnail_id($post->ID);
         // Checking if current featured thumbnail comes from the NExtGen Plugin.
         if (stripos($thumbnail_id, 'ngg-') !== false && class_exists('nggdb')) {
             try {
                 // Creating New NextGen Class instance.
                 $nggdb = new nggdb();
                 // Fetching NGG thumbnail object.
                 $nggImage = $nggdb->find_image(str_replace('ngg-', '', $thumbnail_id));
                 // Retrieving physical path of NGG thumbnail image.
                 $featured_physical_path = $nggImage->imagePath;
                 // Fetching NGG thumbnail image URL.
                 $featured_thumb_url = $nggImage->imageURL;
             } catch (Exception $e) {
             }
         } else {
             // Retrieving featured image attachment src.
             $featured_thumb_attachment = wp_get_attachment_image_src($thumbnail_id, 'large');
             // Retrieving physical path of featured image.
             $featured_physical_path = get_attached_file($thumbnail_id);
             // Retrieving featured image url.
             $featured_thumb_url = $featured_thumb_attachment[0];
         }
         // Parsing featured image url.
         $featured_thumb_url_obj = parse_url($featured_thumb_url);
         // Retrieving featured image basename.
         $featured_thumb_basename = pathinfo(basename($featured_thumb_url));
         // Removing querystring from image to save. This fixed the Jetpack Photon Issue.
         $featured_thumb_basename['extension'] = preg_replace('/\\?.*/', '', $featured_thumb_basename['extension']);
         // Building featured image cached path.
         $featured_thumb_cache = $this->cache_basepath . 'srpthumb-p' . $post->ID . '-' . $this->widget_args['thumbnail_width'] . 'x' . $this->widget_args['thumbnail_height'] . '-' . $this->widget_args['thumbnail_rotation'] . '.' . $featured_thumb_basename['extension'];
         // Checking if the thumbnail already exists. In this case, simply render it. Otherwise generate it.
         if (file_exists(SRP_PLUGIN_DIR . $featured_thumb_cache) || $this->generate_gd_image($post, 'featured', $featured_physical_path, SRP_PLUGIN_DIR . $featured_thumb_cache, $this->widget_args['thumbnail_width'], $this->widget_args['thumbnail_height'], $this->widget_args['thumbnail_rotation'])) {
             // Return cached image as source (URL path).
             $featured_thumb_src = SRP_PLUGIN_URL . $featured_thumb_cache;
             // Generating Image HTML Tag.
             $featured_htmltag = '<img src="' . $featured_thumb_src . '" class="srp-post-thumbnail" alt="' . esc_attr($post->post_title) . '" />';
         } else {
             // No featured image has been found. Trying to fetch the first image tag from the post content.
             $featured_htmltag = $this->get_first_image_url($post, $this->widget_args['thumbnail_width'], $this->widget_args['thumbnail_height'], $post->post_title);
         }
         // Checking if thumbnail should be linked to post.
         if ('yes' == $this->widget_args['thumbnail_link']) {
             // Building featured image link tag.
             $featured_temp_content = $this->srp_create_tag('a', $featured_htmltag, array('class' => 'srp-post-thumbnail-link', 'href' => get_permalink($post->ID), 'title' => $post->post_title));
         } else {
             // Displaying post thumbnail without link.
             $featured_temp_content = $featured_htmltag;
         }
     } else {
         // No featured image has been found. Trying to fetch the first image tag from the post content.
         $featured_htmltag = $this->get_first_image_url($post, $this->widget_args['thumbnail_width'], $this->widget_args['thumbnail_height'], $post->post_title);
         // Checking if returned image is real or it is a false value due to skip_noimage_posts option enabled.
         if ($featured_htmltag) {
             // Checking if thumbnail should be linked to post.
             if ('yes' == $this->widget_args['thumbnail_link']) {
                 // Building image tag.
                 $featured_temp_content = $this->srp_create_tag('a', $featured_htmltag, array('class' => 'srp-post-thumbnail-link', 'href' => get_permalink($post->ID), 'title' => $post->post_title));
             } else {
                 // Displaying post thumbnail without link.
                 $featured_temp_content = $featured_htmltag;
             }
         } else {
             // Return false.
             return false;
         }
     }
     // Return all the image process.
     return $featured_temp_content;
 }
开发者ID:alenteria,项目名称:vitrari,代码行数:87,代码来源:class-main.php


示例14: _wp_post_thumbnail_html

 /**
  * Output HTML for the post thumbnail meta-box.
  *
  * @see wp-admin\includes\post.php
  * @param int $thumbnail_id ID of the image used for thumbnail
  * @return string html output
  */
 function _wp_post_thumbnail_html($thumbnail_id = NULL)
 {
     global $_wp_additional_image_sizes, $post_ID;
     $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__('Set featured image') . '" href="' . esc_url(get_upload_iframe_src('image')) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
     $content = sprintf($set_thumbnail_link, esc_html__('Set featured image'));
     $image = nggdb::find_image($thumbnail_id);
     $img_src = false;
     // get the options
     $ngg_options = nggGallery::get_option('ngg_options');
     if ($image) {
         if (is_array($_wp_additional_image_sizes) && isset($_wp_additional_image_sizes['post-thumbnail'])) {
             // Use post thumbnail settings if defined
             $width = absint($_wp_additional_image_sizes['post-thumbnail']['width']);
             $height = absint($_wp_additional_image_sizes['post-thumbnail']['height']);
             $mode = $_wp_additional_image_sizes['post-thumbnail']['crop'] ? 'crop' : '';
             // check fo cached picture
             $img_src = $image->cached_singlepic_file($width, $height, $mode);
         }
         // if we didn't use a cached image then we take the on-the-fly mode
         if ($img_src == false) {
             $img_src = trailingslashit(home_url()) . 'index.php?callback=image&amp;pid=' . $image->pid . '&amp;width=' . $width . '&amp;height=' . $height . '&amp;mode=crop';
         }
         $thumbnail_html = '<img width="266" src="' . $img_src . '" alt="' . $image->alttext . '" title="' . $image->alttext . '" />';
         if (!empty($thumbnail_html)) {
             $ajax_nonce = wp_create_nonce("set_post_thumbnail-{$post_ID}");
             $content = sprintf($set_thumbnail_link, $thumbnail_html);
             $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__('Remove featured image') . '</a></p>';
         }
     }
     return $content;
 }
开发者ID:BGCX261,项目名称:zhibeifw-in-tibetan-svn-to-git,代码行数:38,代码来源:post-thumbnail.php


示例15: ewww_ngg_optimize

 function ewww_ngg_optimize($id)
 {
     // retrieve the metadata for the image
     $meta = new nggMeta($id);
     // retrieve the image path
     $file_path = $meta->image->imagePath;
     // run the optimizer on the current image
     $fres = ewww_image_optimizer($file_path, 2, false, false, true);
     // update the metadata for the optimized image
     nggdb::update_image_meta($id, array('ewww_image_optimizer' => $fres[1]));
     // get the filepath of the thumbnail image
     $thumb_path = $meta->image->thumbPath;
     // run the optimization on the thumbnail
     $tres = ewww_image_optimizer($thumb_path, 2, false, true);
     return array($fres, $tres);
 }
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:16,代码来源:nextcellent-integration.php


示例16: set_defaults

 function set_defaults($entity)
 {
     // If not set already, we'll add an exclude property. This is used
     // by NextGEN Gallery itself, as well as the Attach to Post module
     $this->object->_set_default_value($entity, 'exclude', 0);
     // Ensure that the object has a description attribute
     $this->object->_set_default_value($entity, 'description', '');
     // If not set already, set a default sortorder
     $this->object->_set_default_value($entity, 'sortorder', 0);
     // The imagedate must be set
     if (!isset($entity->imagedate) or is_null($entity->imagedate) or $entity->imagedate == '0000-00-00 00:00:00') {
         $entity->imagedate = date("Y-m-d H:i:s");
     }
     // If a filename is set, and no alttext is set, then set the alttext
     // to the basename of the filename (legacy behavior)
     if (isset($entity->filename)) {
         $path_parts = pathinfo($entity->filename);
         $alttext = !isset($path_parts['filename']) ? substr($path_parts['basename'], 0, strpos($path_parts['basename'], '.')) : $path_parts['filename'];
         $this->object->_set_default_value($entity, 'alttext', $alttext);
     }
     // Set unique slug
     if (isset($entity->alttext) && !isset($entity->image_slug)) {
         $entity->image_slug = nggdb::get_unique_slug(sanitize_title_with_dashes($entity->alttext), 'image');
     }
     // Ensure that the exclude parameter is an integer or boolean-evaluated
     // value
     if (is_string($entity->exclude)) {
         $entity->exclude = intval($entity->exclude);
     }
     // Trim alttext and description
     $entity->description = trim($entity->description);
     $entity->alttext = trim($entity->alttext);
 }
开发者ID:JeffreyBue,项目名称:jb,代码行数:33,代码来源:class.image_mapper.php


示例17: images_from_ngg_gallery

 public static function images_from_ngg_gallery($nggGallery_ID)
 {
     if (method_exists('nggdb', 'get_gallery')) {
         // if NextGen is installed and the function get_gallery exists
         $options = get_option('wp-supersized_options');
         if ($options['background_url']) {
             $full_background_url = "http://" . $options['background_url'];
         } else {
             $full_background_url = '';
         }
         $full_output = '';
         $imagesList = nggdb::get_gallery($nggGallery_ID, 'sortorder', 'ASC');
         // calls the NextGen Gallery function to retrieve the content of the NextGen gallery with ID $nggGallery_ID. Images are sorted in ascending order of Sort Order.
         if ($imagesList) {
             // if there are images in the gallery
             global $totalSlides;
             $totalSlides = count($imagesList);
             foreach ($imagesList as $image) {
                 $ngggallery_url = $image->imageURL;
                 // full link to the full size image
                 $ngggallery_thumburl = $image->thumbURL;
                 // full link to the thumbnail
                 $ngggallery_title = $image->alttext;
                 // image title
                 $ngggallery_caption = $image->description;
                 // image caption
                 if ($ngggallery_caption == '') {
                     $ngggallery_caption = $ngggallery_title;
                 }
                 // if there is no caption, use title instead
                 $full_output = $full_output . "\n{image : '" . $ngggallery_url . "', title : '" . $ngggallery_caption . "', thumb : '" . $ngggallery_thumburl . "', url : '" . $full_background_url . "'},";
             }
             $full_output = substr($full_output, 0, -1) . "\n";
             // removes the trailing comma to avoid trouble in IE
             echo $full_output;
         } else {
             self::output_error_image('nextgen-gallery_images_not_present');
         }
         // if the requested NextGEN Gallery images are not present, display error image
     }
 }
开发者ID:sdathletics,项目名称:zmc,代码行数:41,代码来源:WPSupersized.php


示例18: get_image_path

 function get_image_path()
 {
     global $post;
     $id = get_post_thumbnail_id();
     // check to see if NextGen Gallery is present
     if (stripos($id, 'ngg-') !== false && class_exists('nggdb')) {
         $nggImage = nggdb::find_image(str_replace('ngg-', '', $id));
         $thumbnail = array($nggImage->imageURL, $nggImage->width, $nggImage->height);
         // otherwise, just get the wp thumbnail
     } else {
         $thumbnail = wp_get_attachment_image_src($id, 'full', true);
     }
     $theimage = $thumbnail[0];
     return $theimage;
 }
开发者ID:nackynoona,项目名称:skeleton_wp,代码行数:15,代码来源:functions.php


示例19: update_pictures

 function update_pictures()
 {
     global $wpdb, $nggdb;
     //TODO:Error message when update failed
     $description = isset($_POST['description']) ? $_POST['description'] : array();
     $alttext = isset($_POST['alttext']) ? $_POST['alttext'] : array();
     $exclude = isset($_POST['exclude']) ? $_POST['exclude'] : false;
     $taglist = isset($_POST['tags']) ? $_POST['tags'] : false;
     $pictures = isset($_POST['pid']) ? $_POST['pid'] : false;
     if (is_array($pictures)) {
         foreach ($pictures as $pid) {
             $image = $nggdb->find_image($pid);
             if ($image) {
                 // description field
                 $image->description = $description[$image->pid];
                 // only uptade this field if someone change the alttext
                 if ($image->alttext != $alttext[$image->pid]) {
                     $image->alttext = $alttext[$image->pid];
                     $image->image_slug = nggdb::get_unique_slug(sanitize_title($image->alttext), 'image', $image->pid);
                 }
                 // set exclude flag
                 if (is_array($exclude)) {
                     $image->exclude = array_key_exists($image->pid, $exclude) ? 1 : 0;
                 } else {
                     $image->exclude = 0;
                 }
                 // update the database
                 $wpdb->query($wpdb->prepare("UPDATE {$wpdb->nggpictures} SET image_slug = '%s', alttext = '%s', description = '%s', exclude = %d WHERE pid = %d", $image->image_slug, $image->alttext, $image->description, $image->exclude, $image->pid));
                 // remove from cache
                 wp_cache_delete($image->pid, 'ngg_image');
                 // hook for other plugins after image is updated
                 do_action('ngg_image_updated', $image);
             }
         }
     }
     //TODO: This produce 300-400 queries !
     if (is_array($taglist)) {
         foreach ($taglist as $key => $value) {
             $tags = explode(',', $value);
             wp_set_object_terms($key, $tags, 'ngg_tag');
         }
     }
     return;
 }
开发者ID:ahsaeldin,项目名称:projects,代码行数:44,代码来源:manage.php


示例20: nggallery_image_upload_hook

 /**
  * call the callback after nggallery image upload
  * @param $image_info
  */
 public function nggallery_image_upload_hook($image_info)
 {
     //get the gallery path gallerypath
     $nggdb = new nggdb();
     $current_gallery = $nggdb->find_gallery($image_info['galleryID']);
     $current_filename = $image_info["filename"];
     //now get the absolute path
     $ws_image_path = $options = get_option('siteurl') . "/" . $current_gallery->path . "/" . $current_filename;
     $static_generator = new StaticGenerator();
     $options = get_option(MakeItStatic::CONFIG_TABLE_FIELD);
     $callback_urls = $options["nggaller 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP nnFrameworkFunctions类代码示例发布时间:2022-05-23
下一篇:
PHP nggGallery类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap