/** * PHP5 type constructor */ function __construct() { $this->_db =& PhotoQSingleton::getInstance('PhotoQDB'); $this->_oc =& PhotoQSingleton::getInstance('PhotoQOptionController'); //get Queue from DB $this->load(); }
/** * PHP5 type constructor */ function __construct($name, $imgName, $yearMonthDir, $originalWidth, $originalHeight) { $this->_name = $name; $this->_imgName = $imgName; $this->_yearMonthDir = $yearMonthDir; $this->_originalWidth = $originalWidth; $this->_originalHeight = $originalHeight; $this->_ratio = $this->_originalWidth / $this->_originalHeight; $this->_oc =& PhotoQSingleton::getInstance('PhotoQOptionController'); $this->_dirPath = $this->_oc->getImgDir() . $this->_name . '/'; $this->_yearMonthDirPath = $this->_dirPath . $this->_yearMonthDir; $this->_path = $this->_yearMonthDirPath . $this->_imgName; $this->_quality = $this->_oc->getValue($this->_name . '-imgQuality'); $this->_watermark = $this->_oc->getValue($this->_name . '-watermark'); $this->_crop = false; }
/** * PHP5 type constructor * * @access public */ function __construct() { global $wpdb; //get the PhotoQ error stack for easy access $this->_errStack =& PEAR_ErrorStack::singleton('PhotoQ'); // set wordpress database $this->_wpdb =& $wpdb; // some methods need access to options so instantiate an OptionController $this->_oc =& PhotoQSingleton::getInstance('PhotoQOptionController'); // set names of database tables used and created by photoq $this->QUEUEMETA_TABLE = $wpdb->prefix . "photoqmeta"; $this->QUEUE_TABLE = $wpdb->prefix . "photoq"; $this->QFIELDS_TABLE = $wpdb->prefix . "photoqfields"; $this->QCAT_TABLE = $wpdb->prefix . "photoq2cat"; $this->QBATCH_TABLE = $wpdb->prefix . "photoqbatch"; // set names of wordpress database tables used by photoq $this->POSTS_TABLE = $wpdb->prefix . "posts"; $this->POSTMETA_TABLE = $wpdb->prefix . "postmeta"; }
/** * PHP5 type constructor */ function __construct($name, $imgName, $yearMonthDir, $originalWidth, $originalHeight) { $this->_name = $name; $this->_imgName = $imgName; $this->_yearMonthDir = $yearMonthDir; $this->_originalWidth = $originalWidth; $this->_originalHeight = $originalHeight; //PhotoQHelper::debug('name: ' . $imgName); //PhotoQHelper::debug('height: ' . $originalHeight); $this->_ratio = $this->_originalWidth / $this->_originalHeight; $this->_oc =& PhotoQSingleton::getInstance('PhotoQOptionController'); $this->_dirPath = $this->_oc->getImgDir() . $this->_name . '/'; $this->_yearMonthDirPath = $this->_dirPath . $this->_yearMonthDir; $this->_path = $this->_yearMonthDirPath . $this->_imgName; if (!is_a($this, 'PhotoQOriginalImageSize')) { $this->_quality = $this->_oc->getValue($this->_name . '-imgQuality'); $this->_watermark = $this->_oc->getValue($this->_name . '-watermark'); } $this->_crop = false; }
/** * PHP5 type constructor */ function __construct($id, $title, $descr, $exif, $path, $imgname, $tags = '', $slug = '', $edited = false) { //get the PhotoQ error stack for easy access $this->_errStack =& PEAR_ErrorStack::singleton('PhotoQ'); //get the other singletons $this->_oc =& PhotoQSingleton::getInstance('PhotoQOptionController'); $this->_db =& PhotoQSingleton::getInstance('PhotoQDB'); $this->id = $id; $this->imgname = $imgname; $this->_tags = $tags; $this->title = $title; $this->descr = $descr; $this->exif = maybe_unserialize($exif); if (empty($path)) { $this->_path = $this->_oc->getQDir() . $this->imgname; } else { $this->_path = $path; } //mute this one because it can issue warnings if the original does not exist. @$this->initImageSizes(); }
function process(&$context) { $result = new PhotoQBatchResult(); $timer =& PhotoQSingleton::getInstance('PhotoQTimers'); while ($timer->read('batchProcessing') < 1000) { $op =& array_shift($this->_operations); if (is_null($op)) { //we are done $result->done(); break; } // Process the current operation. list($functionName, $args, $state) = $op; $status = call_user_func_array(array(&$context, $functionName), array_merge($args, array($state))); if ($status->hasError()) { $result->setError(__('An error occured.', 'PhotoQ')); break; } elseif ($status->isDone()) { //that's what is remaining to be done $result->setPercentage(1.0 - count($this->_operations) / $this->_totalOps); } else { $result->setPercentage(1.0 - (count($this->_operations) + 1.0 - $status->getPercentage()) / $this->_totalOps); //we are not yet done, put it back with updated state array_unshift($this->_operations, array($functionName, $args, $status->getState())); } } return $result; }
/** * Shows the list of meta fields * @param $id int if given shows the meta field of queued photo with this id. */ function showMetaFieldList($id = 0) { $db =& PhotoQSingleton::getInstance('PhotoQDB'); if ($results = $db->getAllFields()) { echo '<div class="info_group">'; foreach ($results as $field_entry) { if ($id) { //get posted values if any from common info $field_value = attribute_escape(stripslashes($_POST[$field_entry->q_field_name][0])); if (empty($field_value)) { //get the stored values $field_value = $this->_db->getFieldValue($id, $field_entry->q_field_id); } } echo '<div class="info_unit">' . $field_entry->q_field_name . ':<br /><textarea style="font-size:small;" name="' . $field_entry->q_field_name . '[]" cols="30" rows="3" class="uploadform">' . $field_value . '</textarea></div>'; } echo '</div>'; } }
*/ //if we don't define this switch, PhotoQ doesn't run define('EXPORTING_PHOTOQ_XML', true); //Load WordPress Bootstrap require_once 'whoismanu-photoq-wploader.php'; //next are some access and nonce checks if (!is_user_logged_in()) { die('-1'); } check_admin_referer('photoqExportXML-nonce', 'photoqExportXML-nonce'); //Do we come from the form if (isset($_GET['download'])) { // setting up options $oc =& PhotoQSingleton::getInstance('PhotoQOptionController'); // get the database access object $db =& PhotoQSingleton::getInstance('PhotoQDB'); //create the filename if (!empty($_GET['xml-filename'])) { $filename = attribute_escape($_GET['xml-filename']) . '.xml'; } else { $filename = 'my-theme-preset.' . date('Y-m-d') . '.xml'; } //send the proper headers header('Content-Description: File Transfer'); header("Content-Disposition: attachment; filename={$filename}"); header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n"; ?> <!-- generator="PhotoQ/<?php echo $photoq->getVersion();
/** * Process previously stored BatchSets * @param $id integer The id of the batch to be executed * @return PhotoQBatchResult the result of the operation */ function executeBatch($id) { PhotoQHelper::debug('enter executeBatch()'); $timer =& PhotoQSingleton::getInstance('PhotoQTimers'); $timer->start('batchProcessing'); $bp =& new PhotoQBatchProcessor($this, $id); PhotoQHelper::debug('calling process()'); return $bp->process(); }
function __construct($xmlFile) { $this->_xmlFile = $xmlFile; //get the PhotoQ error stack for easy access $this->_errStack =& PEAR_ErrorStack::singleton('PhotoQ'); $this->_db =& PhotoQSingleton::getInstance('PhotoQDB'); }
/** * Rename an exising custom field. * * @param int $id The id of the field to be renamed. * @param string $newName The new name of the field to be renamed. * @access public */ function renameField($id, $newName) { // TODO: prohibit two fields with same name // instantiate an OptionController $oc =& PhotoQSingleton::getInstance('PhotoQOptionController'); //get the old name $oldName = $this->_wpdb->get_var("SELECT q_field_name FROM {$this->QFIELDS_TABLE} WHERE q_field_id = {$id}"); //remove whitespace as this will also be used as mysql column header $newName = preg_replace('/\\s+/', '_', $newName); //update DB entry $this->_wpdb->query("UPDATE {$this->QFIELDS_TABLE} SET q_field_name = '{$newName}' WHERE q_field_id = '{$id}'"); if ($oc->getValue('fieldRenamePosted')) { //update already posted posts $this->_wpdb->query("UPDATE {$this->POSTMETA_TABLE} SET meta_key = '{$newName}' WHERE meta_key = '{$oldName}'"); } }
get_header(); $current_cat = get_query_var('cat'); $category_posts = new WP_Query("cat=" . $current_cat . "&showposts=-1"); ?> <div id="photobook" class="autosize"> <div id="photolist"> <?php if ($category_posts->have_posts()) { while ($category_posts->have_posts()) { $category_posts->the_post(); ?> <?php echo PhotoQSingleton::getInstance('PhotoQDB')->getPublishedPhoto($post->ID)->generateImgTag('main', ''); ?> <?php } } ?> </div> </div> <div class="textset"> <h1><?php echo $last_category->name; ?> </h1> </div>
<div id="photobook"> <div class='nav'> <a class="next"><img src="<?php bloginfo('template_directory'); ?> /images/arrow_next.png"/></a> </div> <?php $category_posts = new WP_Query("cat=" . $current_cat . "&showposts=-1"); if ($category_posts->have_posts()) { while ($category_posts->have_posts()) { $category_posts->the_post(); $photo_db = PhotoQSingleton::getInstance('PhotoQDB'); $photo = $photo_db->getPublishedPhoto($post->ID); if (isset($photo)) { echo $photo->generateImgTag('main', 'photo'); } ?> <div class='nav'> <a class="prev"><img src="<?php bloginfo('template_directory'); ?> /images/arrow_prev.png"/></a> <a class="next"><img src="<?php bloginfo('template_directory'); ?> /images/arrow_next.png"/></a>
function initQueue() { if (!isset($this->_queue)) { //lazy initialization, creating queue $this->_queue =& PhotoQSingleton::getInstance('PhotoQQueue'); } }