function plugin_sws_css_tooltip_install()
{
    global $bundle;
    require_once ABSPATH . 'wp-content/plugins/' . basename(dirname(__FILE__)) . '/includes/bundle.php';
    $o = new ImportExport();
    $o->import_bundle($bundle, $error);
    return true;
}
Exemplo n.º 2
0
 function sws_install()
 {
     global $bundle;
     require_once WPCSS_PATH . 'includes/bundle.php';
     require_once WPCSS_PATH . 'includes/class.ImportExport.php';
     require_once WPCSS_PATH . 'includes/class.CSShortcodes.php';
     CSShortcodes::init_taxonomy();
     CSShortcodes::init_post_type();
     $o = new ImportExport();
     $o->import_bundle($bundle, $error);
     return true;
 }
Exemplo n.º 3
0
 function sws_install()
 {
     global $bundle;
     require_once WPCSS_PATH . 'includes/bundle.php';
     require_once WPCSS_PATH . 'includes/class.ImportExport.php';
     require_once WPCSS_PATH . 'includes/class.CSShortcodes.php';
     CSShortcodes::init_taxonomy();
     CSShortcodes::install_init_post_type();
     $o = new ImportExport();
     $o->import_bundle($bundle, $error);
     //--custom capabilities
     global $wp_roles;
     $wp_roles->add_cap('administrator', 'manage_sws');
     //--
     return true;
 }
Exemplo n.º 4
0
        include 'cl/Destinations.php';
        $ctr = new Destinations();
        $result = $ctr->process($a, $post, $get);
        break;
    case 'destination':
        include 'cl/Destinations.php';
        $ctr = new Destinations();
        $result = $ctr->process($a, $post, $get);
        break;
    case 'screen':
        include 'cl/Screen.php';
        $ctr = new Screen();
        $result = $ctr->process($a, $post, $get);
        break;
    case 'importexport':
        include 'cl/ImportExport.php';
        $ctr = new ImportExport();
        $result = $ctr->process($a, json_decode(file_get_contents("php://input")), $get);
        break;
}
if (is_string($result)) {
    echo $result;
} else {
    header('Content-type: application/json');
    echo json_encode($result);
}
function utils()
{
    include 'cl/Utils.php';
    return new Utils();
}
 function handle_multisite_subsite_bundle()
 {
     if (is_multisite() && is_admin() && WPCSS > get_option('WPCSS')) {
         global $wpdb;
         $sql = "SELECT COALESCE((SELECT 1 FROM `{$wpdb->posts}` WHERE post_type='csshortcode' LIMIT 1),0)";
         if (0 == $wpdb->get_var($sql, 0, 0)) {
             $import_export = new ImportExport();
             $res = $import_export->restore_bundle_from_name('starter', $error);
             update_option('WPCSS', WPCSS);
         }
     }
 }
 **/
ob_start();
Header('Cache-Control: no-cache');
Header('Pragma: no-cache');
require_once '../../../../../../wp-load.php';
$content = ob_get_contents();
ob_end_clean();
//sleep(1);
function send_error_die($msg)
{
    die(json_encode(array('R' => 'ERR', 'MSG' => $msg)));
}
$post_id = intval($_REQUEST['ID']);
if ($post_id == 0) {
    send_error_die('Post ID is not valid.');
}
//-----------
if (!wp_verify_nonce($_REQUEST['nonce'], 'csshortcode-css-nonce')) {
    send_error_die('Settings error, no access.');
}
if (!current_user_can('edit_post', $post_id)) {
    send_error_die('No access.');
}
//-------------
$sco = new ImportExport();
$data = $sco->get_shortcode_from_post_id($post_id, $error, true);
if (false === $data) {
    send_error_die('Error generating export data: ' . $error);
}
$ret = array('R' => 'OK', 'MSG' => '', 'DATA' => $data);
die(json_encode($ret));
 function sws_sc_moreinfo()
 {
     $post_id = intval($_REQUEST['ID']);
     if ($post_id == 0) {
         $this->send_error_die('Post ID is not valid.');
     }
     //-----------
     $this->verify_nonce_and_access($post_id);
     //-------------
     global $wpdb;
     $code = $_REQUEST['code'];
     $sco = new ImportExport();
     $obj = $sco->string_to_obj($code);
     if (false === $obj) {
         $this->send_error_die('Error reading code. (2)');
     }
     if (false === $sco->check_shortcode_obj($obj, $error)) {
         $this->send_error_die($error . print_r($obj, true));
     }
     $categories = array();
     if (isset($obj->sc_terms) && is_array($obj->sc_terms) && count($obj->sc_terms) > 0) {
         foreach ($obj->sc_terms as $t) {
             $categories[] = $t->name;
         }
     }
     $data = (object) array();
     $data->name = $obj->post_title;
     $data->shortcode = $obj->sc_shortcode;
     $data->category = $categories;
     $data->bundle = $obj->sc_bundle;
     $data->info = property_exists($obj, 'sc_info') ? $obj->sc_info : array('author' => '', 'url' => '');
     $data->warnings = array();
     $sql = "SELECT P.ID FROM `{$wpdb->postmeta}` M INNER JOIN `{$wpdb->posts}` P ON P.ID = M.post_id WHERE P.ID!={$post_id} AND M.meta_key = \"sc_shortcode\" AND M.meta_value=\"{$obj->sc_shortcode}\" AND P.post_status IN ('publish', 'draft')";
     $data->duplicate_posts = $wpdb->get_col($sql, 0);
     $data->duplicate_links = array();
     if (is_array($data->duplicate_posts) && count($data->duplicate_posts) > 0) {
         foreach ($data->duplicate_posts as $duplicate_id) {
             $data->duplicate_links[] = sprintf("<a href=\"%s\">%s</a>", html_entity_decode(get_edit_post_link($duplicate_id)), $duplicate_id);
         }
     }
     //---check that a required script is present
     if (property_exists($obj, 'sc_scripts') && is_array($obj->sc_scripts) && count($obj->sc_scripts) > 0) {
         global $wp_scripts;
         foreach ($obj->sc_scripts as $handle) {
             if (!array_key_exists($handle, $wp_scripts->registered)) {
                 $data->warnings[] = sprintf("Shortcode requires a registered javascript library (%s), but it is not active in the system.", $handle);
             }
         }
     }
     if (property_exists($obj, 'sc_styles') && is_array($obj->sc_styles) && count($obj->sc_styles) > 0) {
         global $wp_styles;
         foreach ($obj->sc_styles as $handle) {
             if (!array_key_exists($handle, $wp_styles->registered)) {
                 $data->warnings[] = sprintf("Shortcode requires a registered stylesheet (%s), but it is not active in the system.", $handle);
             }
         }
     }
     $ret = array('R' => 'OK', 'MSG' => '', 'DATA' => $data);
     die(json_encode($ret));
 }
 * @version $Id$
 * @copyright 2003 
 **/
ob_start();
Header('Cache-Control: no-cache');
Header('Pragma: no-cache');
require_once '../../../../../../wp-load.php';
$content = ob_get_contents();
ob_end_clean();
//sleep(1);
function send_error_die($msg)
{
    die(json_encode(array('R' => 'ERR', 'MSG' => $msg)));
}
//-----------
if (!current_user_can('manage_options') && !current_user_can(CSSOptions::capability)) {
    send_error_die('No access');
}
//-------------
$bundle_name = $_REQUEST['bundle'];
if (trim($bundle_name) == '') {
    send_error_die('Settings error, missing parameter.');
}
$import_export = new ImportExport();
$res = $import_export->restore_bundle_from_name($bundle_name, $error);
if (false === $res) {
    $error = trim($error) == '' ? 'Error restoring bundle(Undefined import/export error)' : $error;
    send_error_die($error);
}
$ret = array('R' => 'OK', 'MSG' => '');
die(json_encode($ret));
}
$post_id = intval($_REQUEST['ID']);
if ($post_id == 0) {
    send_error_die('Post ID is not valid.');
}
//-----------
if (!wp_verify_nonce($_REQUEST['nonce'], 'csshortcode-css-nonce')) {
    send_error_die('Settings error, no access.');
}
if (!current_user_can('edit_post', $post_id)) {
    send_error_die('No access.');
}
//-------------
global $wpdb;
$code = $_REQUEST['code'];
$sco = new ImportExport();
$obj = $sco->string_to_obj($code);
if (false === $obj) {
    send_error_die('Error reading code. (2)');
}
if (false === $sco->check_shortcode_obj($obj, $error)) {
    send_error_die($error . print_r($obj, true));
}
$categories = array();
if (isset($obj->sc_terms) && is_array($obj->sc_terms) && count($obj->sc_terms) > 0) {
    foreach ($obj->sc_terms as $t) {
        $categories[] = $t->name;
    }
}
$data = (object) array();
$data->name = $obj->post_title;
Header('Cache-Control: no-cache');
Header('Pragma: no-cache');
require_once '../../../../../../wp-load.php';
$content = ob_get_contents();
ob_end_clean();
//sleep(1);
function send_error_die($msg)
{
    die(json_encode(array('R' => 'ERR', 'MSG' => $msg)));
}
$post_id = intval($_REQUEST['ID']);
if ($post_id == 0) {
    send_error_die('Post ID is not valid.');
}
//-----------
if (!wp_verify_nonce($_REQUEST['nonce'], 'csshortcode-css-nonce')) {
    send_error_die('Settings error, no access.');
}
if (!current_user_can('edit_post', $post_id)) {
    send_error_die('No access.');
}
//-------------
$code = $_REQUEST['code'];
$import_terms = isset($_REQUEST['import_terms']) ? $_REQUEST['import_terms'] : false;
$sco = new ImportExport();
$res = $sco->restore_from_string($post_id, $code, $error, $import_terms);
if (false === $res) {
    send_error_die($error);
}
$ret = array('R' => 'OK', 'MSG' => '', 'URL' => html_entity_decode(get_edit_post_link($post_id)));
die(json_encode($ret));
<?php

namespace TokenToMe\TwitterCards\Admin;

if (!defined('JM_TC_VERSION')) {
    header('Status: 403 Forbidden');
    header('HTTP/1.1 403 Forbidden');
    exit;
}
?>
<div class="wrap">
	<h1 class="page-title-action">JM Twitter Cards : <?php 
echo esc_html(get_admin_page_title());
?>
</h1>

	<?php 
echo Tabs::admin_tabs();
?>

	<?php 
ImportExport::settings_page();
?>
</div>


<?php