当前位置: 首页>>代码示例>>PHP>>正文


PHP RevSliderFunctionsWP::initStaticVars方法代码示例

本文整理汇总了PHP中RevSliderFunctionsWP::initStaticVars方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderFunctionsWP::initStaticVars方法的具体用法?PHP RevSliderFunctionsWP::initStaticVars怎么用?PHP RevSliderFunctionsWP::initStaticVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RevSliderFunctionsWP的用法示例。


在下文中一共展示了RevSliderFunctionsWP::initStaticVars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wp_upload_dir

            //for WP < 4.0.0
            $attachment_id = false;
            // If there is no url, return.
            if ('' == $image_url) {
                return;
            }
            // Get the upload directory paths
            $upload_dir_paths = wp_upload_dir();
            // Make sure the upload path base directory exists in the attachment URL, to verify that we're working with a media library image
            if (false !== strpos($image_url, $upload_dir_paths['baseurl'])) {
                // If this is the URL of an auto-generated thumbnail, get the URL of the original image
                $image_url = preg_replace('/-\\d+x\\d+(?=\\.(jpg|jpeg|png|gif)$)/i', '', $image_url);
                // Remove the upload path base directory from the attachment URL
                $image_url = str_replace($upload_dir_paths['baseurl'] . '/', '', $image_url);
                // Finally, run a custom database query to get the attachment ID from the modified attachment URL
                $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT wposts.ID FROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $image_url));
            }
        }
        return $attachment_id;
    }
}
//end of the class
//init the static vars
RevSliderFunctionsWP::initStaticVars();
/**
 * old classname extends new one (old classnames will be obsolete soon)
 * @since: 5.0
 **/
class UniteFunctionsWPRev extends RevSliderFunctionsWP
{
}
开发者ID:iq007,项目名称:MadScape,代码行数:31,代码来源:functions-wordpress.class.php


注:本文中的RevSliderFunctionsWP::initStaticVars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。