本文整理汇总了PHP中motopressCEGetLanguageDict函数的典型用法代码示例。如果您正苦于以下问题:PHP motopressCEGetLanguageDict函数的具体用法?PHP motopressCEGetLanguageDict怎么用?PHP motopressCEGetLanguageDict使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了motopressCEGetLanguageDict函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: motopressCERemoveTemporaryPost
function motopressCERemoveTemporaryPost()
{
require_once dirname(__FILE__) . '/../verifyNonce.php';
require_once dirname(__FILE__) . '/../settings.php';
require_once dirname(__FILE__) . '/../access.php';
require_once dirname(__FILE__) . '/../Requirements.php';
require_once dirname(__FILE__) . '/../functions.php';
require_once dirname(__FILE__) . '/../getLanguageDict.php';
require_once dirname(__FILE__) . '/ThemeFix.php';
global $motopressCESettings;
$motopressCELang = motopressCEGetLanguageDict();
$errors = array();
$post_id = $_POST['post_id'];
$post = get_post($post_id);
if (!is_null($post)) {
$delete = wp_trash_post($post_id);
new MPCEThemeFix(MPCEThemeFix::ACTIVATE);
if ($delete === false) {
$errors[] = $motopressCELang->CERemoveTemporaryPostError;
}
}
if (!empty($errors)) {
if ($motopressCESettings['debug']) {
print_r($errors);
} else {
motopressCESetError($motopressCELang->CERemoveTemporaryPostError);
}
}
exit;
}
示例2: motopressCEGetAttachmentThumbnail
function motopressCEGetAttachmentThumbnail()
{
require_once dirname(__FILE__) . '/../verifyNonce.php';
require_once dirname(__FILE__) . '/../settings.php';
require_once dirname(__FILE__) . '/../access.php';
require_once dirname(__FILE__) . '/../functions.php';
require_once dirname(__FILE__) . '/../getLanguageDict.php';
$motopressCELang = motopressCEGetLanguageDict();
if (isset($_POST['id']) && !empty($_POST['id'])) {
$id = (int) trim($_POST['id']);
$attachment = get_post($id);
if (!empty($attachment) && $attachment->post_type === 'attachment') {
if (wp_attachment_is_image($id)) {
$srcMedium = wp_get_attachment_image_src($id, 'medium');
$srcFull = wp_get_attachment_image_src($id, 'full');
if (isset($srcMedium[0]) && !empty($srcMedium[0]) && isset($srcFull[0]) && !empty($srcFull[0])) {
$attachmentImageSrc = array();
$attachmentImageSrc['medium'] = $srcMedium[0];
$attachmentImageSrc['full'] = $srcFull[0];
wp_send_json($attachmentImageSrc);
} else {
motopressCESetError($motopressCELang->CEAttachmentImageSrc);
}
} else {
motopressCESetError($motopressCELang->CEAttachmentNotImage);
}
} else {
motopressCESetError($motopressCELang->CEAttachmentEmpty);
}
} else {
motopressCESetError($motopressCELang->CEAttachmentThumbnailError);
}
exit;
}
示例3: motopressCERenderShortcode
function motopressCERenderShortcode()
{
require_once dirname(__FILE__) . '/../verifyNonce.php';
require_once dirname(__FILE__) . '/../settings.php';
require_once dirname(__FILE__) . '/../access.php';
require_once dirname(__FILE__) . '/../functions.php';
require_once dirname(__FILE__) . '/../getLanguageDict.php';
require_once dirname(__FILE__) . '/Shortcode.php';
$motopressCELang = motopressCEGetLanguageDict();
if (isset($_POST['closeType']) && !empty($_POST['closeType']) && isset($_POST['shortcode']) && !empty($_POST['shortcode'])) {
global $motopressCESettings;
$errors = array();
$closeType = $_POST['closeType'];
$shortcode = $_POST['shortcode'];
$parameters = null;
if (isset($_POST['parameters']) && !empty($_POST['parameters'])) {
$parameters = json_decode(stripslashes($_POST['parameters']));
if (!$parameters) {
$errors[] = $motopressCELang->CERenderShortcodeError;
}
}
$styles = null;
if (isset($_POST['styles']) && !empty($_POST['styles'])) {
$styles = json_decode(stripslashes($_POST['styles']));
if (!$styles) {
$errors[] = $motopressCELang->CERenderShortcodeError;
}
}
if (empty($errors)) {
do_action('motopress_render_shortcode', $shortcode);
$s = new MPCEShortcode();
$content = null;
if (isset($_POST['content']) && !empty($_POST['content'])) {
$content = stripslashes($_POST['content']);
if (isset($_POST['wrapRender']) && $_POST['wrapRender'] === 'true') {
$content = motopressCECleanupShortcode($content);
global $motopressCELibrary;
$motopressCELibrary = new MPCELibrary();
$content = motopressCEParseObjectsRecursive($content);
}
}
$str = $s->toShortcode($closeType, $shortcode, $parameters, $styles, $content);
echo do_shortcode($str);
}
if (!empty($errors)) {
if ($motopressCESettings['debug']) {
print_r($errors);
} else {
motopressCESetError($motopressCELang->CERenderShortcodeError);
}
}
} else {
motopressCESetError($motopressCELang->CERenderShortcodeError);
}
exit;
}
示例4: motopressCERenderContent
function motopressCERenderContent()
{
require_once dirname(__FILE__) . '/../verifyNonce.php';
require_once dirname(__FILE__) . '/../settings.php';
require_once dirname(__FILE__) . '/../access.php';
require_once dirname(__FILE__) . '/../Requirements.php';
require_once dirname(__FILE__) . '/../functions.php';
require_once dirname(__FILE__) . '/../getLanguageDict.php';
require_once dirname(__FILE__) . '/postMetaFix.php';
require_once dirname(__FILE__) . '/ThemeFix.php';
$content = trim($_POST['data']);
$post_id = $_POST['post_id'];
global $motopressCESettings;
$motopressCELang = motopressCEGetLanguageDict();
$errors = array();
global $motopressCELibrary;
$motopressCELibrary = new MPCELibrary();
do_action_ref_array('mp_library', array(&$motopressCELibrary));
$content = stripslashes($content);
$content = motopressCECleanupShortcode($content);
if (!empty($content)) {
$content = motopressCEWrapOuterCode($content);
}
$output = motopressCEParseObjectsRecursive($content);
$tmp_post_id = motopressCECreateTemporaryPost($post_id, $output);
if ($tmp_post_id !== 0) {
$themeFix = new MPCEThemeFix(MPCEThemeFix::DEACTIVATE);
$src = get_permalink($tmp_post_id);
//@todo: fix protocol for http://codex.wordpress.org/Administration_Over_SSL
//fix different site (WordPress Address) and home (Site Address) url for iframe security
$siteUrl = get_site_url();
$homeUrl = get_home_url();
$siteUrlArr = parse_url($siteUrl);
$homeUrlArr = parse_url($homeUrl);
if ($homeUrlArr['scheme'] !== $siteUrlArr['scheme'] || $homeUrlArr['host'] !== $siteUrlArr['host']) {
$src = str_replace($homeUrl, $siteUrl, $src);
}
$result = array('post_id' => $tmp_post_id, 'src' => $src, 'headway_themes' => $themeFix->isHeadwayTheme());
echo json_encode($result);
} else {
$errors[] = $motopressCELang->CECreateTemporaryPostError;
}
if (!empty($errors)) {
if ($motopressCESettings['debug']) {
print_r($errors);
} else {
motopressCESetError($motopressCELang->CECreateTemporaryPostError);
}
}
exit;
}
示例5: motopressCEupdatePalettes
function motopressCEupdatePalettes()
{
require_once dirname(__FILE__) . '/../verifyNonce.php';
require_once dirname(__FILE__) . '/../settings.php';
require_once dirname(__FILE__) . '/../access.php';
require_once dirname(__FILE__) . '/../functions.php';
require_once dirname(__FILE__) . '/../getLanguageDict.php';
$motopressCELang = motopressCEGetLanguageDict();
if (isset($_POST['palettes']) && !empty($_POST['palettes'])) {
$palettes = $_POST['palettes'];
update_option('motopress-palettes', $palettes);
echo json_encode(array('palettes' => $palettes));
} else {
motopressCESetError($motopressCELang->CEColorpickerPalettesError);
}
exit;
}
示例6: motopressCEGetLanguageDict
<?php
global $motopressCESettings;
require_once $motopressCESettings['plugin_root'] . '/' . $motopressCESettings['plugin_name'] . '/includes/getLanguageDict.php';
$motopressCELang = motopressCEGetLanguageDict();
$defaultText = $motopressCELang->CEContentDefault;
$featureContent = <<<CONTENT
[mp_row]
[mp_span col="6"]
[mp_image size="full" link_type="custom_url" link="#" target="false" align="left"]
[/mp_span]
[mp_span col="6"]
[mp_text]
{$defaultText}
[/mp_text]
[/mp_span]
[/mp_row]
[mp_row]
[mp_span col="6"]
[mp_text]
{$defaultText}
示例7: motopressTable
public function motopressTable($attrs, $content = null)
{
extract(shortcode_atts(self::addStyleAtts(array()), $attrs));
global $motopressCESettings;
require_once $motopressCESettings['plugin_root'] . '/' . $motopressCESettings['plugin_name'] . '/includes/getLanguageDict.php';
$motopressCELang = motopressCEGetLanguageDict();
if (!empty($classes)) {
$classes = ' ' . $classes;
}
if (self::$isNeedFix && empty($mp_style_classes)) {
if (!empty($style) && $style != 'none') {
$mp_style_classes = 'motopress-table-style-' . $style;
}
if (!empty($custom_class)) {
$mp_style_classes .= ' ' . $custom_class;
}
}
if (!empty($mp_style_classes)) {
$mp_style_classes = ' ' . $mp_style_classes;
}
$result = '<div class="motopress-table-obj' . self::getMarginClasses($margin) . $classes . '">';
$content = trim($content);
$content = preg_replace('/^<p>|<\\/p>$/', '', $content);
$content = preg_replace('/<br[^>]*>\\s*\\r*\\n*/is', "\n", $content);
if (!empty($content)) {
// $result .= '<table class="' . self::getBasicClasses(self::PREFIX . 'table', true) . $mp_style_classes . '">';
$result .= '<table class="' . self::getBasicClasses(self::PREFIX . 'table') . $mp_style_classes . '">';
$i = 0;
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
$rows = explode("\n", $content);
$rowsCount = count($rows);
foreach ($rows as $row) {
$row = str_getcsv($row);
$isLast = $i === $rowsCount - 1 ? true : false;
self::addRow($row, $i, $isLast, $result);
$i++;
}
} else {
$tmpFile = new SplTempFileObject();
$tmpFile->setFlags(SplFileObject::SKIP_EMPTY);
$tmpFile->setFlags(SplFileObject::DROP_NEW_LINE);
$write = $tmpFile->fwrite($content);
if (!is_null($write)) {
$tmpFile->rewind();
while (!$tmpFile->eof()) {
$row = $tmpFile->fgetcsv();
$isLast = $tmpFile->eof();
self::addRow($row, $i, $isLast, $result);
$i++;
}
}
}
$result .= '</table>';
} else {
$result .= $motopressCELang->CETableObjNoData;
}
$result .= '</div>';
return $result;
}
示例8: motopressCEAdminBarMenu
function motopressCEAdminBarMenu($wp_admin_bar)
{
if (is_admin_bar_showing() && !is_admin() && !is_preview()) {
global $wp_the_query, $motopressCESettings;
$current_object = $wp_the_query->get_queried_object();
if (!empty($current_object) && !empty($current_object->post_type) && ($post_type_object = get_post_type_object($current_object->post_type)) && $post_type_object->show_ui && $post_type_object->show_in_admin_bar) {
require_once 'includes/ce/Access.php';
$ceAccess = new MPCEAccess();
$postType = get_post_type();
$postTypes = get_option('motopress-ce-options');
if (!$postTypes) {
$postTypes = array();
}
if (in_array($postType, $postTypes) && post_type_supports($postType, 'editor') && $ceAccess->hasAccess($current_object->ID)) {
require_once 'includes/getLanguageDict.php';
$motopressCELang = motopressCEGetLanguageDict();
$isHideLinkEditWith = apply_filters('mpce_hide_link_edit_with', false);
if (!$isHideLinkEditWith) {
$wp_admin_bar->add_menu(array('href' => get_edit_post_link($current_object->ID) . '&motopress-ce-auto-open=true', 'parent' => false, 'id' => 'motopress-edit', 'title' => strtr($motopressCELang->CEAdminBarMenu, array('%BrandName%' => $motopressCESettings['brand_name'])), 'meta' => array('title' => strtr($motopressCELang->CEAdminBarMenu, array('%BrandName%' => $motopressCESettings['brand_name'])), 'onclick' => 'sessionStorage.setItem("motopressPluginAutoOpen", true);')));
}
}
}
}
}
示例9: motopressPostsGrid
public function motopressPostsGrid($attrs, $content = null)
{
$defaultAttrs = array('query_type' => 'simple', 'post_type' => 'post', 'columns' => 3, 'category' => '', 'tag' => '', 'posts_per_page' => 3, 'posts_order' => 'DESC', 'custom_tax' => '', 'custom_tax_field' => '', 'custom_tax_terms' => '', 'custom_query' => '', 'ids' => '', 'template' => '/plugins/motopress-content-editor/includes/ce/shortcodes/post_grid/templates/template1.php', 'posts_gap' => 30, 'show_featured_image' => 'true', 'image_size' => 'large', 'image_custom_size' => '', 'title_tag' => 'h2', 'show_date_comments' => 'true', 'show_content' => 'short', 'short_content_length' => 200, 'read_more_text' => '', 'pagination' => 'false', 'load_more_btn' => 'false', 'load_more_text' => 'Load More', 'is_ajax' => false, 'ajax_paged' => 1);
$ajaxAttrs = array_merge($defaultAttrs, $attrs);
extract(shortcode_atts(self::addStyleAtts($defaultAttrs), $attrs));
$motopressCELang = motopressCEGetLanguageDict();
$result = '';
$gridId = 'posts_grid_' . uniqid();
$exclude_posts = array();
if (self::isContentEditor()) {
if (isset($_POST['postID']) && !empty($_POST['postID'])) {
$id = $_POST['postID'];
$exclude_posts[] = (int) $_POST['postID'];
} else {
$id = get_the_ID();
}
$editedPost = get_post_meta($id, 'motopress-ce-edited-post', true);
if (!empty($editedPost)) {
$exclude_posts[] = (int) $editedPost;
}
if (isset($_GET['p'])) {
$exclude_posts[] = (int) $_GET['p'];
}
} else {
wp_enqueue_style('mpce-bootstrap-grid');
$id = get_the_ID();
$exclude_posts = array($id);
}
$paged = isset($_GET['mp_posts_grid_paged']) ? $_GET['mp_posts_grid_paged'] : 1;
if ($is_ajax) {
$paged = (int) $ajax_paged;
}
$args = array();
switch ($query_type) {
case 'simple':
$tax_query = array();
if (isset($category) && !empty($category)) {
$tax_query_cat = array('taxonomy' => 'category', 'field' => 'slug');
if (strpos($category, '+') !== false && strpos($category, ',') !== false) {
$cat_regex = '/[+,\\s]+/';
} else {
if (strpos($category, '+') !== false) {
$tax_query_cat['operator'] = 'AND';
$cat_regex = '/[+\\s]+/';
} else {
$cat_regex = '/[,\\s]+/';
}
}
$tax_query_cat['terms'] = array_unique(preg_split($cat_regex, $category));
$tax_query[] = $tax_query_cat;
}
if (isset($tag) && !empty($tag)) {
$tax_query_tag = array('taxonomy' => 'post_tag', 'field' => 'slug');
if (strpos($tag, '+') !== false && strpos($tag, ',') !== false) {
$tag_regex = '/[+,\\s]+/';
} else {
if (strpos($tag, '+') !== false) {
$tax_query_tag['operator'] = 'AND';
$tag_regex = '/[+\\s]+/';
} else {
$tag_regex = '/[,\\s]+/';
}
}
$tax_query_tag['terms'] = array_unique(preg_split($tag_regex, $tag));
$tax_query[] = $tax_query_tag;
}
if (!empty($custom_tax) && !empty($custom_tax_field) && !empty($custom_tax_terms)) {
$tax_query_defaults = array('taxonomy' => $custom_tax, 'field' => $custom_tax_field);
if (strpos($custom_tax_terms, '+') !== false) {
$terms = preg_split('/[+]+/', $custom_tax_terms);
foreach ($terms as $term) {
$tax_query[] = array_merge($tax_query_defaults, array('terms' => array($term)));
}
} else {
$tax_query[] = array_merge($tax_query_defaults, array('terms' => preg_split('/[,]+/', $custom_tax_terms)));
}
}
$args = array('post_type' => $post_type, 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'post__not_in' => $exclude_posts, 'order' => $posts_order, 'paged' => $paged);
if (!empty($tax_query)) {
$args['tax_query'] = $tax_query;
}
break;
case 'custom':
if (!empty($custom_query)) {
$custom_query = base64_decode($custom_query);
$custom_query = html_entity_decode($custom_query);
wp_parse_str($custom_query, $args);
if (isset($args['post__not_in'])) {
if (is_array($args['post__not_in'])) {
$args['post__not_in'] = array_unique(array_merge($args['post__not_in'], $exclude_posts));
}
} else {
if (isset($args['post__in'])) {
if (is_array($args['post__in'])) {
$args['post__in'] = array_diff($args['post__in'], $exclude_posts);
}
} else {
$args['post__not_in'] = $exclude_posts;
}
}
//.........这里部分代码省略.........