function mye_sname_store() { $eff_shortname = $_POST['s']; if (isset($eff_shortname) && !empty($eff_shortname)) { $eff_shortname = trim($eff_shortname); insertInMyEffectoDb('1', null, "<div>", null, $eff_shortname); } wp_die(); // this is required to terminate immediately and return a proper response }
function myeffecto_admin() { $user_id = get_current_user_id(); $data = null; if (isset($_POST['dataToSend'])) { $data = $_POST['dataToSend']; } $eff_trending_url = null; if (isset($_POST['url'])) { //for trending widget $eff_trending_url = $_POST['url']; } $eff_shortname = null; if (isset($_POST['eff_shortname'])) { $eff_shortname = $_POST['eff_shortname']; } $postID = null; if (isset($_GET['postID'])) { $postID = $_GET['postID']; } $postName = null; if (isset($_GET['postName'])) { $postName = $_GET['postName']; } $postURL = null; if (isset($_GET['postURL'])) { $postURL = $_GET['postURL']; } $shortname = null; if (isset($_GET['shortname'])) { $shortname = $_GET['shortname']; } if (isset($data) && !empty($data)) { $isCodeExistArray = getMyEffectoPluginDetails($postID); $isCodeExist = null; if (isset($isCodeExistArray) && !empty($isCodeExistArray)) { foreach ($isCodeExistArray as $detail) { $isCodeExist = $detail->shortname; } } if ($isCodeExist == null) { if (!isset($postID) || empty($postID)) { $defaultEdit = null; if (isset($_GET['pluginType'])) { $defaultEdit = $_GET['pluginType']; } if (isset($defaultEdit) && $defaultEdit == "defaultEdit") { updateMyeffectoEmbedCode($data, 0, $eff_shortname); ?> <script type="text/javascript"> window.location= <?php echo "'" . $postURL . "&action=edit&plugin=success'"; ?> ; </script><?php } else { insertInMyEffectoDb($user_id, null, $data, null, $eff_shortname); if (isset($postURL) && !empty($postURL)) { ?> <script type="text/javascript"> window.location= <?php echo "'" . $postURL . "&action=edit&plugin=success'"; ?> ; </script> <?php } else { // After Plugin Config exit(wp_redirect(admin_url('options-general.php?page=eff_conf_nav'))); } } } else { insertInMyEffectoDb($user_id, null, $data, $postID, $eff_shortname); ?> <script type="text/javascript"> window.location= <?php echo "'" . $postURL . "&action=edit&plugin=success'"; ?> ; </script> <?php } } else { $addType = $_GET['pluginType']; if ($addType == "postAdd") { updateMyeffectoEmbedCode(null, $postID, $eff_shortname); ?> <script type="text/javascript"> window.location= <?php echo "'" . $postURL . "&action=edit&plugin=success'"; ?> ;</script> <?php } else { $isToInsert = $_GET['isToInsert']; if (isset($isToInsert) && $isToInsert == "true") { insertInMyEffectoDb($user_id, null, $data, $postID, $eff_shortname); ?> <script type="text/javascript">window.location= <?php echo "'" . $postURL . "&action=edit&plugin=success'"; ?> ;</script><?php return; } } } } else { if (isset($eff_trending_url) && !empty($eff_trending_url)) { update_option("trending_url", $eff_trending_url); ?> <script type="text/javascript"> window.location= <?php echo "'" . $postURL . "&action=edit&plugin=success'"; ?> ; </script> <?php } else { $p_type = null; if (isset($_GET['pluginType'])) { $p_type = $_GET['pluginType']; } $configure_tab = "nav-tab-active"; $advSetting_tab = "nav-load"; $plugSetting_tab = "nav-load"; if ($p_type == "advSetting") { $advSetting_tab = "nav-tab-active"; $configure_tab = "nav-load"; $plugSetting_tab = "nav-load"; } else { if ($p_type == "plugSet") { $advSetting_tab = "nav-load"; $configure_tab = "nav-load"; $plugSetting_tab = "nav-tab-active"; } } ?> <style type="text/css">#load {background: url("<?php echo plugins_url('/img/loading.gif', __FILE__); ?> ") no-repeat scroll center center #FFF;bottom: 0;left: 0;position: absolute;opacity: 0.63;right: 0;top: 0;width: 100%;z-index: 1000;}</style> <div class="wrap" style="overflow-wrap : hidden; position : relative;"> <h2 class="nav-tab-wrapper"> <a class="nav-tab <?php echo $configure_tab; ?> " href="<?php echo admin_url('options-general.php?page=eff_conf_nav'); ?> ">Configure</a> <a class="nav-tab <?php echo $plugSetting_tab; ?> " href="<?php echo admin_url('options-general.php?page=eff_conf_nav&pluginType=plugSet'); ?> ">Plugin Settings</a> <a class="nav-tab <?php echo $advSetting_tab; ?> " href="<?php echo admin_url('options-general.php?page=eff_conf_nav&pluginType=advSetting'); ?> ">Advance Settings</a> </h2> <?php global $embedCode; $apiKey = null; $myeffectoArray = array(); delete_option('myeffecto_apikeys' . '#@#' . $user_id); if (get_option('myeffecto_apikeys' . '#@#' . $user_id)) { $myeffectoArray = get_option('myeffecto_apikeys' . '#@#' . $user_id); } else { $isFirstUser = false; global $wpdb; $effecto_db_version = myeffecto_get_version(); $table_name = $wpdb->prefix . "effecto"; $eff_get_dbVersion = get_option('effecto_db_version'); if ($eff_get_dbVersion != $effecto_db_version) { createEffectoTable($effecto_db_version); update_option('effecto_db_version', $effecto_db_version); } else { $apiEmbedArrayDtls = getMyEffectoPluginDetails("0"); $apiEmbedArray = ""; if ($apiEmbedArrayDtls != null) { foreach ($apiEmbedArrayDtls as $detail) { $apiEmbedArray = $detail->embedCode; } } $embedCode = $apiEmbedArray; if (!isset($embedCode) || empty($embedCode)) { $isFirstUser = false; } else { $myeffectoArray['userID'] = $user_id; //$myeffectoArray['apiKey']=$apiEmbedArray->apiKey; $myeffectoArray['embedCode'] = $apiEmbedArray; //update_option('myeffecto_apikeys'.'#@#'.$user_id, $apiEmbedArray); } } echo "<div class='container'>"; if ($isFirstUser || $p_type == 'defaultEdit' || $p_type == 'postAdd') { echoUserScript(); return; } else { if ($p_type == "editExist") { include 'editExisting.php'; return; } else { if ($p_type == "plugSet") { include 'pluginSetting.php'; return; } else { if ($p_type == "advSetting") { include "advanceSetting.php"; } else { allSetCode($embedCode, null); } } } } echo "<script>jQuery('.nav-tab').click(function(){jQuery('#load').css('display','block');});</script></div>"; } ?> </div> <?php } } }