/** * Enqueue styles for the back end. */ function tool_wall_custom_admin_enqueue_styles_tools($dependencies) { $css_wall = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . WALL_TOOL_NAME . '/css/tool-wall-admin.css'); if (!empty($css_wall)) { wp_enqueue_style('tool-wall-css', $css_wall, $dependencies, '1.0'); } }
/** * Enqueue scripts for the back end. */ function tool_shortcodes_custom_admin_enqueue_scripts_tools($dependencies) { $js_tool_shortcodes = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . SHORTCODES_TOOL_NAME . '/js/tool-shortcodes.js'); if (!empty($js_tool_shortcodes)) { wp_enqueue_script('tool-shortcodes-script', $js_tool_shortcodes, $dependencies, '1.0', true); } }
/** * Enqueue scripts for the back end. */ function tool_social_custom_admin_enqueue_scripts_tools($dependencies) { $js_tool_social = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . SOCIAL_TOOL_NAME . '/js/tool-social.js'); if (!empty($js_tool_social)) { wp_enqueue_script('tool-social-script', $js_tool_social, $dependencies, '1.0', true); } }
/** * Enqueue styles for the front end. */ function tool_private_custom_front_enqueue_styles_tools($dependencies) { $css_private = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . PRIVATE_TOOL_NAME . '/css/tool-private.css'); if (!empty($css_private)) { wp_enqueue_style('tool-private-css', $css_private, $dependencies, '1.0'); } }
/** * Enqueue scripts for the front end. */ function tool_gallery_custom_front_enqueue_scripts_tools($dependencies) { $js_tool_gallery_fancybox = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . GALLERY_TOOL_NAME . '/js/tool-gallery-fancybox.js'); if (!empty($js_tool_gallery_fancybox)) { wp_enqueue_script('tool-gallery-script-fancybox', $js_tool_gallery_fancybox, $dependencies, '1.0', true); } }
/** * Enqueue styles for the front end. */ function tool_cookies_custom_front_enqueue_styles_tools($dependencies) { $css_cookies = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . COOKIES_TOOL_NAME . '/css/tool-cookies.css'); if (!empty($css_cookies)) { wp_enqueue_style('tool-cookies-css', $css_cookies, $dependencies, '1.0'); } }
/** * Enqueue styles for the front end. */ function tool_breadcrumb_custom_front_enqueue_styles_tools($dependencies) { $css_breadcrumb = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . BREADCRUMB_TOOL_NAME . '/css/tool-breadcrumb.css'); if (!empty($css_breadcrumb)) { wp_enqueue_style('tool-breadcrumb-css', $css_breadcrumb, $dependencies, '1.0'); } }
/** * register JS */ function postpicker_ajax_admin_enqueue_scripts() { $postpicker_ajax_js_file = locate_web_ressource(CUSTOM_PLUGIN_COMMONS_FOLDER . 'postpicker/postpicker.js'); if (!empty($postpicker_ajax_js_file)) { wp_enqueue_script('postpicker-ajax', $postpicker_ajax_js_file, array('jquery'), "1.0"); wp_localize_script('postpicker-ajax', 'Postpicker', array('ajaxUrl' => admin_url('admin-ajax.php'), 'ajaxNonce' => wp_create_nonce('postpicker-ajax-nonce'), 'doneButtonText' => __("Done", CUSTOM_PLUGIN_TEXT_DOMAIN), 'orderButtonText' => __("Order", CUSTOM_PLUGIN_TEXT_DOMAIN))); } }
/** * register JS */ function video_ajax_admin_enqueue_scripts() { $video_ajax_js_file = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . VIDEO_TOOL_NAME . '/ajax/video-ajax.js'); if (!empty($video_ajax_js_file)) { wp_enqueue_script('video-ajax', $video_ajax_js_file, array('jquery'), "1.0"); wp_localize_script('video-ajax', 'VideoAjax', array('ajaxUrl' => admin_url('admin-ajax.php'), 'ajaxNonce' => wp_create_nonce('video-ajax-nonce'))); } }
/** * login template scripts */ function tool_login_enqueue_scripts_tools() { $js_login = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . LOGIN_TOOL_NAME . '/js/tool-login.js'); if (!empty($js_login)) { wp_enqueue_script('tool-login-script', $js_login, array('jquery'), '1.0', true); wp_localize_script('tool-login-script', 'ToolLogin', array('url_title' => get_bloginfo('name'), 'url_site' => get_site_url(), 'message' => '', 'placeholder_login' => __("login", CUSTOM_PLUGIN_TEXT_DOMAIN), 'placeholder_password' => __("password", CUSTOM_PLUGIN_TEXT_DOMAIN), 'placeholder_email' => __("email", CUSTOM_PLUGIN_TEXT_DOMAIN))); } }
/** * register JS */ function wall_ajax_admin_enqueue_scripts() { $wall_ajax_js_file = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . WALL_TOOL_NAME . '/ajax/wall-ajax.js'); if (!empty($wall_ajax_js_file)) { wp_enqueue_script('wall-ajax', $wall_ajax_js_file, array('jquery'), "1.0"); wp_localize_script('wall-ajax', 'GalleryAjax', array('ajaxUrl' => admin_url('admin-ajax.php'), 'ajaxNonce' => wp_create_nonce('wall-ajax-nonce'))); } }
/** * Xml site Map generator * @param array $availables_post_types * @return true if success, false otherwise */ function seo_update_xmlsitemap($availables_post_types) { $success = false; // $xmlsitemappath = trailingslashit(get_home_path()) . "sitemap.xml"; makes error with woocommerce payplug/paypal purchase method $xmlsitemappath = trailingslashit(ABSPATH) . "sitemap.xml"; if (($fp = @fopen($xmlsitemappath, 'w')) !== FALSE) { $xml_sitemap = ""; $xml_sitemap .= '<?xml version="1.0" encoding="UTF-8"?>'; $xsl = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . SEO_TOOL_NAME . '/xmlsitemap/xmlsitemap.xsl'); if (!empty($xsl)) { $xml_sitemap .= "\n" . '<?xml-stylesheet type="text/xsl" href="' . $xsl . '"?>'; } $xml_sitemap .= "\n" . '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; // root $lm = intval(get_timestamp_from_mysql(get_lastpostmodified('GMT'))); $date = date('Y-m-d\\TH:i:s+00:00', $lm); $xml_sitemap .= "\n\t" . '<url>'; $xml_sitemap .= "\n\t\t" . '<loc>' . get_bloginfo('url') . '</loc>'; $xml_sitemap .= "\n\t\t" . '<lastmod>' . $date . '</lastmod>'; $xml_sitemap .= "\n\t\t" . '<changefreq>weekly</changefreq>'; $xml_sitemap .= "\n\t\t" . '<priority>1.0</priority>'; $xml_sitemap .= "\n\t" . '</url>'; if ($availables_post_types) { // posts $posts = get_posts(array('numberposts' => -1, 'orderby' => 'modified', 'order' => 'DESC', 'post_type' => $availables_post_types, 'suppress_filters' => true)); foreach ($posts as $post) { $lm = intval(get_timestamp_from_mysql($post->post_modified_gmt)); $date = date('Y-m-d\\TH:i:s+00:00', $lm); $xml_sitemap .= "\n\t" . '<url>'; $xml_sitemap .= "\n\t\t" . '<loc>' . get_permalink($post->ID) . '</loc>'; $xml_sitemap .= "\n\t\t" . '<lastmod>' . $date . '</lastmod>'; $xml_sitemap .= "\n\t\t" . '<changefreq>weekly</changefreq>'; $xml_sitemap .= "\n\t\t" . '<priority>0.6</priority>'; $xml_sitemap .= "\n\t" . '</url>'; } } $xml_sitemap .= "\n" . '</urlset>'; // ecriture du fichier fwrite($fp, $xml_sitemap); fclose($fp); $success = true; } else { trace_err("Impossible d'écrire le fichier : " . trailingslashit(get_home_path()) . "sitemap.xml"); } return $success; }
/** * Enqueue scripts for the front end. */ function tool_menu_custom_front_enqueue_scripts_tools($dependencies) { /** * enqueue menu-hightlight javascript file */ $js_tool_menu_hightlight = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . MENU_TOOL_NAME . '/js/tool-menu-hightlight.js'); if (!empty($js_tool_menu_hightlight)) { if (is_multisite()) { $home_url = get_site_url(BLOG_ID_CURRENT_SITE); $home_minisite_url = get_site_url(get_current_blog_id()); } else { $home_url = home_url('/'); $home_minisite_url = ""; } $id_blog_page = get_option('page_for_posts'); if (!empty($id_blog_page) && is_numeric($id_blog_page)) { $blog_url = get_permalink($id_blog_page); } else { $blog_url = ""; } if (is_single() && get_post_type() == 'post') { $is_post = "1"; } else { $is_post = "0"; } $current_url = get_current_url(); wp_enqueue_script('tool-menu-script-menu-hightlight', $js_tool_menu_hightlight, $dependencies, '1.0', true); wp_localize_script('tool-menu-script-menu-hightlight', 'ToolMenu', array('current_url' => $current_url, 'home_url' => $home_url, 'home_minisite_url' => $home_minisite_url, 'blog_url' => $blog_url, 'is_post' => $is_post)); } /** * enqueue menu-toggle javascript file */ $js_tool_menu_toggle = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . MENU_TOOL_NAME . '/js/tool-menu-toggle.js'); if (!empty($js_tool_menu_toggle)) { wp_enqueue_script('tool-menu-script-menu-toggle', $js_tool_menu_toggle, $dependencies, '1.0', true); } /** * enqueue menu-fixed-on-scroll javascript file */ $js_tool_menu_fixed_on_scroll = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . MENU_TOOL_NAME . '/js/tool-menu-fixed-on-scroll.js'); if (!empty($js_tool_menu_fixed_on_scroll)) { wp_enqueue_script('tool-menu-script-fixed-on-scroll', $js_tool_menu_fixed_on_scroll, $dependencies, '1.0', true); } }
/** * Enqueue styles for the front end. */ function tool_wip_custom_front_enqueue_styles_tools($dependencies) { if (tool_wip_is_wip()) { $css_wip = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . WIP_TOOL_NAME . '/css/tool-wip.css'); if (!empty($css_wip)) { wp_enqueue_style('tool-wip-css', $css_wip, $dependencies, '1.0'); } } }
/** * Enqueue scripts for the login end. */ function tool_secure_custom_login_enqueue_scripts_tools($dependencies) { $js_tool_secure = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . SECURE_TOOL_NAME . '/js/tool-secure.js'); if (!empty($js_tool_secure)) { wp_enqueue_script('tool-secure-script', $js_tool_secure, $dependencies, '1.0', true); } }
/** * Enqueue scripts and styles for the login page. * * @return void */ function custom_login_scripts_styles() { // Fontawesome $css_fontawesome = locate_web_ressource(CUSTOM_PLUGIN_TEMPLATES_FOLDER . '/' . CUSTOM_PLUGIN_FONTS_FOLDER . 'fontawesome/fontawesome-4.4.0.css'); if (!empty($css_fontawesome)) { wp_enqueue_style('custom-login-css-fontawesome', $css_fontawesome, array(), '4.4.0'); } // Loads Utils $js_utils = locate_web_ressource(CUSTOM_PLUGIN_TEMPLATES_FOLDER . CUSTOM_PLUGIN_JS_FOLDER . 'custom-utils.js'); if (!empty($js_utils)) { wp_enqueue_script('custom-script-utils', $js_utils, array('jquery'), '1.0', true); } // Action for stylesheets tools do_action("custom_login_enqueue_styles_tools", array()); // Action for javascript tools do_action("custom_login_enqueue_scripts_tools", array("custom-script-utils")); }