Example #1
0
/**
 * [get_wpfeatured_image_url_with_default description]
 *
 * @see http://stackoverflow.com/questions/6384431/creating-anonymous-objects-in-php
 * @see https://wordpress.org/support/topic/getting-a-post-featured-image-url
 * @see https://wordpress.org/support/topic/retrieveing-featured-image-url
 * @see http://stackoverflow.com/questions/11261883/how-to-get-wordpress-post-featured-image-url
 * 
 * @param  [type] $post_id [description]
 * @return [type]          [description]
 */
function get_wpfeatured_image_url_with_default($post_id = 0)
{
    $wpfeatured_image_url = get_wpfeatured_image_url($post_id);
    if (is_null_or_empty_string($wpfeatured_image_url)) {
        $wpfeatured_image_url = get_default_featured_image_url();
    }
    return $wpfeatured_image_url;
}
Example #2
0
 private function get_fb_meta_query($key, $type)
 {
     $where = array();
     if (!is_null_or_empty_string($key)) {
         $where['key'] = $key;
     }
     if (!is_null_or_empty_string($type)) {
         $where['type'] = $type;
     }
     $this->db->select('value');
     $this->db->where($where);
     $query = $this->db->get($this->tbl_fb_meta);
     return $query;
 }
Example #3
0
 /**
  * validateIcon.
  *
  * @param null|string $slug
  *
  * @return $this
  *
  * @throws IconCreatorException
  */
 protected function validateIcon($slug = null)
 {
     if (is_null_or_empty_string($slug)) {
         throw new IconCreatorException('An icon type was not provided.', IconCreatorException::CODE_MISSING_ARGS);
     }
     $this->setIconSlug($slug);
     $this->lookupIcon();
     return $this;
 }
require_once $CFG->libdir . '/formslib.php';
require_once 'lib/panopto_data.php';
global $courses;
// Populate list of servernames to select from.
$aserverarray = array();
$appkeyarray = array();
if (isset($_SESSION['numservers'])) {
    $maxval = $_SESSION['numservers'];
} else {
    $maxval = 1;
}
for ($x = 0; $x < $maxval; $x++) {
    // Generate strings corresponding to potential servernames in $CFG.
    $thisservername = 'block_panopto_server_name' . ($x + 1);
    $thisappkey = 'block_panopto_application_key' . ($x + 1);
    if (isset($CFG->{$thisservername}) && !is_null_or_empty_string($CFG->{$thisservername}) && !is_null_or_empty_string($CFG->{$thisappkey})) {
        $aserverarray[$x] = $CFG->{$thisservername};
        $appkeyarray[$x] = $CFG->{$thisappkey};
    }
}
/**
 * Create form for server selection.
 *
 * @package block_panopto
 * @copyright  Panopto 2009 - 2015
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class panopto_provision_form extends moodleform
{
    protected $title = '';
    protected $description = '';
Example #5
0
 private function test_utility_helper()
 {
     $this->unit->use_strict(true);
     $this->unit->run(get_github_url(), 'is_string', 'get_github_url()');
     $this->unit->run(get_facebook_url(), 'is_string', 'get_facebook_url()');
     $this->unit->run(get_twitter_url(), 'is_string', 'get_twitter_url()');
     $this->unit->run(get_google_map_key(), 'is_string', 'get_google_map_key()');
     $this->unit->run(get_ga_code(), 'is_string', 'get_ga_code()');
     $this->unit->run(is_null_or_empty_string(''), 'is_true', 'is_null_or_empty_string()');
     $this->unit->run(is_null_or_empty_string('test'), 'is_false', 'is_null_or_empty_string()');
     $this->unit->run(is_null_or_empty_string(1), 'is_false', 'is_null_or_empty_string()');
     $this->unit->run(start_with('abcdef', 'ab'), 'is_true', 'start_with()');
     $this->unit->run(start_with('abcdef', 'cd'), 'is_false', 'start_with()');
     $this->unit->run(start_with('abcdef', 'ef'), 'is_false', 'start_with()');
     $this->unit->run(start_with('abcdef', ''), 'is_true', 'start_with()');
     $this->unit->run(start_with('', 'abcdef'), 'is_false', 'start_with()');
     $this->unit->run(end_with("abcdef", "ab"), 'is_false', 'end_with()');
     $this->unit->run(end_with("abcdef", "cd"), 'is_false', 'end_with()');
     $this->unit->run(end_with("abcdef", "ef"), 'is_true', 'end_with()');
     $this->unit->run(end_with("abcdef", ""), 'is_true', 'end_with()');
     $this->unit->run(end_with("", "abcdef"), 'is_false', 'end_with()');
     $this->unit->run(get_domain_name('http://somedomain.co.uk'), 'somedomain.co.uk', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www2.manager.co.th'), 'manager.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://test.manager.co.th'), 'manager.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://manager.co.th'), 'manager.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://thaiware.com'), 'thaiware.com', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.thaiware.com'), 'thaiware.com', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://test.thaiware.com'), 'thaiware.com', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/'), 'ktb.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/dasdasdasd.html'), 'ktb.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th?quewadsas=2faddasdas'), 'ktb.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/2011/20/01?=asdasdasdasd'), 'ktb.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://pantip.com/forum/siam'), 'pantip.com', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.wegointer.com/category/variety/'), 'wegointer.com', 'get_domain_name()');
     $this->unit->run(get_domain_name(), 'lab.jojoee.com', 'get_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.wegointer.com/category/variety/'), 'www.wegointer.com', 'get_domain_name()');
     $this->unit->run(get_full_domain_name('http://somedomain.co.uk'), 'somedomain.co.uk', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www2.manager.co.th'), 'www2.manager.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://test.manager.co.th'), 'test.manager.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://manager.co.th'), 'manager.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://thaiware.com'), 'thaiware.com', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.thaiware.com'), 'www.thaiware.com', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://test.thaiware.com'), 'test.thaiware.com', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/dasdasdasd.html'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th?quewadsas=2faddasdas'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/2011/20/01?=asdasdasdasd'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://pantip.com/forum/siam'), 'pantip.com', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.wegointer.com/category/variety/'), 'www.wegointer.com', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name(), 'lab.jojoee.com', 'get_full_domain_name()');
     $url = 'http://sub.wegointer.com/category/variety/';
     $this->unit->run(get_request_url($url, get_full_domain_name($url)), '/category/variety', 'get_request_url()');
     $url = 'http://www.wegointer.com/category/variety/';
     $this->unit->run(get_request_url($url, get_full_domain_name($url)), '/category/variety', 'get_request_url()');
     $this->unit->run(get_full_url(), 'http://lab.jojoee.com/nn/test', 'get_full_url()');
     // 404, 301
     // $this->unit->run(is_url_exists('http://jojoee.com/404'), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_url_exists('http://fashion.spokedark.tv/2015/04/24/dichan-magazine/'), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_url_exists('http://www.jojoee.com/'), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_url_exists('http://test4041.com/'), 'is_false', 'is_url_exists()');
     // $this->unit->run(is_url_exists('http://test4041.com/'), 'is_false', 'is_url_exists()');
     // $this->unit->run(is_url_redirects('http://www.jojoee.com/'), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_404('http://jojoee.com/404'), 'is_true', 'is_404()');
     // $url = 'http://fashion.spokedark.tv/?p=6600';
     // $this->unit->run(is_url_exists($url), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_url_redirects($url), 'is_true', 'is_url_redirects()');
     // don't know why it doesn't work
     // $url = 'http://movies.spokedark.tv?p=10054/';
     // $this->unit->run(is_url_exists($url), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_url_redirects($url), 'is_true', 'is_url_redirects()');
     $this->unit->run(get_extension('file.jpeg'), 'jpeg', 'get_extension()');
     $this->unit->run(get_extension('file.bk.zip'), 'zip', 'get_extension()');
     $this->unit->run(remove_trailing_slash('/category/product/'), '/category/product', 'remove_trailing_slash()');
     $this->unit->run(remove_trailing_slash('/category/product'), '/category/product', 'remove_trailing_slash()');
     $this->unit->run(remove_trailing_slash('category/product/'), 'category/product', 'remove_trailing_slash()');
     for ($i = 0; $i < 20; $i++) {
         $urls = $this->get_posts();
         foreach ($urls as $url) {
             $this->unit->run($url['is_publish'], '0', 'get_posts()');
         }
     }
 }
Example #6
0
/**
 * Get full domain name (domain name including sub domain)
 * TESTED
 * 
 * @param  string $url [description]
 * @return [type]      [description]
 */
function get_full_domain_name($url = '')
{
    if (is_null_or_empty_string($url)) {
        return $_SERVER['SERVER_NAME'];
    } else {
        return parse_url($url, PHP_URL_HOST);
    }
}
Example #7
0
/* need to improve */
$banner_url = '';
$custom_css = '';
// home only
$title = '';
$subtitle = '';
$home_url = '';
if (is_home()) {
    $title = get_bloginfo('name');
    $subtitle = get_bloginfo('description');
    $home_url = esc_url(home_url('/'));
} else {
    $post_id = get_the_ID();
    $banner_url = get_wpfeatured_image_url($post_id);
    if (is_null_or_empty_string($banner_url)) {
        $banner_url = get_default_banner_url();
        $custom_css = 'default';
    }
}
?>

<header class="banner <?php 
echo $custom_css;
?>
"
  <?php 
the_background_image_style($banner_url);
?>
>
  <div class="container">
Example #8
0
 public function get_sites($type = '')
 {
     $where = array('is_active' => 1);
     if (!is_null_or_empty_string($type)) {
         $where['type'] = $type;
     }
     $this->db->where($where);
     $query = $this->db->get($this->tbl_site);
     return $query->result_array();
 }
Example #9
0
function get_background_image_style($url = '')
{
    $result = !is_null_or_empty_string($url) ? 'style="background-image: url(\'' . $url . '\');"' : '';
    return $result;
}
Example #10
0
/**
 * [the_tag_list description]
 *
 * @see https://codex.wordpress.org/Function_Reference/get_the_tag_list
 * 
 * @return [type] [description]
 */
function the_tag_list()
{
    $tag_list = get_the_tag_list('', __(', ', 'koa'), '');
    if (!is_null_or_empty_string($tag_list)) {
        echo '<div class="tag-list">';
        echo 'Tag: ' . $tag_list;
        echo '</div>';
    }
}