Пример #1
0
function tool_logo_is_active($active)
{
    $active_option = custom_get_option('tool-logo-active');
    if (!empty($active_option) && $active_option == "on") {
        $active = true;
    }
    return $active;
}
Пример #2
0
function tool_googleanalytics_is_active($active)
{
    $active_option = custom_get_option('tool-googleanalytics-active');
    if (!empty($active_option) && $active_option == "on") {
        $active = true;
    }
    return $active;
}
Пример #3
0
function tool_breadcrumb_is_active($active)
{
    $active_option = custom_get_option('tool-breadcrumb-active');
    if (!empty($active_option) && $active_option == "on") {
        $active = true;
    }
    return $active;
}
Пример #4
0
function tool_shortcodes_is_active($active)
{
    $active_option = custom_get_option('tool-shortcodes-active');
    if (!empty($active_option) && $active_option == "on") {
        $active = true;
    }
    return $active;
}
Пример #5
0
/**
 * Is secure failtoban active
 * @return boolean
 */
function secure_is_failtoban_active()
{
    $failtoban_active = custom_get_option("tool-secure-failtoban-active");
    if (!empty($failtoban_active) && $failtoban_active == "on") {
        return true;
    }
    return false;
}
Пример #6
0
function tool_pagination_is_active($active)
{
    $active_option = custom_get_option('tool-pagination-active');
    if (!empty($active_option) && $active_option == "on") {
        $active = true;
    }
    return $active;
}
Пример #7
0
function tool_backgroundimage_is_active($active)
{
    $active_option = custom_get_option('tool-backgroundimage-active');
    if (!empty($active_option) && $active_option == "on") {
        $active = true;
    }
    return $active;
}
Пример #8
0
 /**
  * custom registration
 * @return boolean
 */
 function custom_is_registered()
 {
     global $custom_config_ac;
     if (!isset($custom_config_ac)) {
         $custom_config_ac = false;
         $key = custom_get_option("key-activation");
         if (!empty($key)) {
             $reload = true;
             $already_activated = false;
             $key_changed = false;
             $old_key = get_option('custom-old-key-activation', null);
             $last_update = get_option('custom-activated-update', null);
             $now = new DateTime();
             if ($last_update != null) {
                 $last_update->add(new DateInterval('PT1H'));
                 if ($last_update > $now) {
                     $already_activated = true;
                 }
             }
             if (empty($old_key) || $old_key != $key) {
                 $key_changed = true;
             }
             if (!$key_changed && $already_activated) {
                 $reload = false;
             }
             if ($reload) {
                 $custom_config_ac = false;
                 $url = CUSTOM_API_URL;
                 $url = add_query_arg(array("api-action" => "active"), $url);
                 $url = add_query_arg(array("api-package" => CUSTOM_PLUGIN_NAME), $url);
                 $url = add_query_arg(array("api-host" => get_site_url()), $url);
                 $url = add_query_arg(array("api-key" => $key), $url);
                 $request_body = wp_remote_retrieve_body(wp_remote_get($url));
                 if (!empty($request_body)) {
                     $request_body = @json_decode($request_body);
                     if (isset($request_body->active) && $request_body->active == true) {
                         $custom_config_ac = true;
                     }
                 }
                 if ($last_update != null) {
                     delete_option('custom-activated-update');
                 }
                 if ($custom_config_ac) {
                     add_option('custom-activated-update', $now, '', false);
                 }
                 if ($old_key != null) {
                     delete_option('custom-old-key-activation');
                 }
                 add_option('custom-old-key-activation', $key, '', false);
             } else {
                 $custom_config_ac = $already_activated;
             }
         }
     }
     return $custom_config_ac;
 }
Пример #9
0
 /**
  * replace thumbnail by featured video if exists and if has auto-insert configuration
  * @param unknown $html
  * @param unknown $post_id
  * @param unknown $post_thumbnail_id
  * @param unknown $size
  * @param unknown $attr
  */
 function tool_video_post_thumbnail_filter($html, $post_id, $post_thumbnail_id, $size, $attr)
 {
     $auto_insert = custom_get_option("tool-video-auto-insert");
     if (!empty($auto_insert) && $auto_insert == 'on') {
         $default_width = custom_get_option("tool-video-default-width");
         $default_height = custom_get_option("tool-video-default-height");
         $video_embed = video_get_featured_video($post_id, $default_width, $default_height);
         if (!empty($video_embed)) {
             $html = '<div class="featured-video">' . $video_embed . '</div>';
         }
     }
     $html = apply_filters("post_featured_video_html", $html, $post_id, $post_thumbnail_id, $size, $attr);
     return $html;
 }
Пример #10
0
 /**
  * Display background image/color/opacity
 * @param boolean $auto_insert : boolean - do not specify true if you use this method manualy in your template theme
 */
 function custom_backgroundimage_autoinsert($auto_insert = false)
 {
     $backgroundimage_autoinsert = custom_get_option('tool-backgroundimage-auto-insert');
     if (!empty($backgroundimage_autoinsert) && $backgroundimage_autoinsert == 'on') {
         custom_backgroundimage(true);
     }
 }