/** * @param foolic_licensekey $key * * @return array */ function foolic_license_listing_get_sorted_domains($key) { $domain_array = $key->get_domains(); $domain_objects = array(); if ($domain_array !== false) { foreach ($domain_array as $domain) { $domain_object = foolic_domain::get($domain); $domain_object->attached = $key->is_domain_attached($domain_object->url); if ($domain_object->attached) { $domain_object->sort_order = 0; } else { if ($domain_object->localhost) { $domain_object->sort_order = 2; } else { if ($domain_object->blacklisted) { $domain_object->sort_order = 3; } else { $domain_object->sort_order = 1; } } } $domain_objects[] = $domain_object; } usort($domain_objects, 'foolic_license_listing_sort_compare'); } return $domain_objects; }
public static function get($post) { $domain = new foolic_domain(); $domain->load($post); return $domain; }
function render_domain_details_metabox($post) { $domain = new foolic_domain(); $domain->load($post); ?> <input type="hidden" name="<?php echo FOOLIC_CPT_DOMAIN; ?> _nonce" id="<?php echo FOOLIC_CPT_DOMAIN; ?> _nonce" value="<?php echo wp_create_nonce(plugin_basename($this->_plugin_file)); ?> " /> <table class="form-table"> <tbody> <tr> <td style="width:150px" class="first-column" valign="top"><?php _e('Localhost', 'foolic'); ?> </td> <td> <?php echo $domain->localhost ? "<strong>YES</strong>" : "no"; ?> <input name="<?php echo FOOLIC_CPT_DOMAIN; ?> [localhost]" type="checkbox" value="on" <?php echo $domain->localhost ? 'checked="checked"' : ''; ?> /> </td> </tr> <tr> <td style="width:150px" class="first-column" valign="top"><?php _e('Blacklisted', 'foolic'); ?> </td> <td> <?php echo $domain->blacklisted ? "<strong>YES</strong>" : "no"; ?> <input name="<?php echo FOOLIC_CPT_DOMAIN; ?> [blacklisted]" type="checkbox" value="on" <?php echo $domain->blacklisted ? 'checked="checked"' : ''; ?> /> </td> </tr> <tr> <td style="width:150px" class="first-column" valign="top"><?php _e('Marked For Blacklisting', 'foolic'); ?> </td> <td> <?php echo $domain->marked_for_blacklisting ? "<strong>YES</strong>" : "no"; ?> <input name="<?php echo FOOLIC_CPT_DOMAIN; ?> [marked_for_blacklisting]" type="checkbox" value="on" <?php echo $domain->marked_for_blacklisting ? 'checked="checked"' : ''; ?> /> </td> </tr> <?php do_action('foolic_render_domain_details_metabox', $post); ?> </tbody> </table><?php }
function get_attached_domains() { //lazy load the attached domains if ($this->_attached_domains === false) { //load all connected domains $domains = $this->get_domains(); $this->_attached_domains = array(); if ($domains) { //mark the licensekey as activated $this->activated = true; //loop thru all domains and if they are attached then increment attached_count foreach ($domains as $domain) { $attached = p2p_get_meta($domain->p2p_id, 'attached', true); //ignore localhost domains $domain_object = foolic_domain::get($domain); if ($attached == "1" && $domain_object->localhost === false) { $this->_attached_domains[] = $domain_object; } } } } return $this->_attached_domains; }