コード例 #1
0
ファイル: Path.php プロジェクト: robjcordes/nexnewwp
 public static function getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
コード例 #2
0
ファイル: Manager.php プロジェクト: robjcordes/nexnewwp
 public static function updateTo($version)
 {
     /**
      * Stupidity protection
      * Throw an exception stating that i am idiot because i am trying to
      * overwrite my development files.
      */
     if (Wpjb_Project::VERSION == "#" . "version" . "#") {
         throw new Exception("You are an idiot! You cannot upgrade development version.");
     }
     $id = Wpjb_Utility_Seal::id();
     $ck = Wpjb_Utility_Seal::checksum();
     $version = Wpjb_Project::getInstance()->conf("upgrade")->available->version;
     $url = self::URL . "download/id/" . $id . "/checksum/" . $ck . "/version/" . $version;
     $file = Wpjb_List_Path::getPath("tmp_images") . "/" . md5($url) . ".zip";
     $data = self::_download($url);
     file_put_contents($file, $data);
     chmod($file, 0600);
     $baseDir = Wpjb_Project::getInstance()->getProjectBaseDir();
     //self::unzip($file, dirname($baseDir));
     $zip = new ZipArchive();
     if (!@$zip->open($file)) {
         unlink($file);
         return self::ZIPERR_OPEN;
     }
     if (!@$zip->extractTo(dirname($baseDir))) {
         unlink($file);
         return self::ZIPERR_EXTRACT;
     }
     self::upgrade();
     unlink($file);
 }
コード例 #3
0
ファイル: Abstract.php プロジェクト: robjcordes/nexnewwp
 protected function _sql($version)
 {
     $file = Wpjb_List_Path::getPath("install") . "/install-" . $version . ".sql";
     $queries = explode("; --", file_get_contents($file));
     $db = Daq_Db::getInstance();
     $wpdb = $db->getDb();
     foreach ($queries as $query) {
         $wpdb->query($query);
     }
 }
コード例 #4
0
ファイル: JobMock.php プロジェクト: robjcordes/nexnewwp
 public function getImageUrl()
 {
     if ($this->hasImage()) {
         $url = site_url();
         $url .= "/wp-content/plugins/wpjobboard";
         $url .= Wpjb_List_Path::getRawPath("tmp_images");
         $url .= "/temp_" . session_id() . "." . $this->company_logo_ext;
         return $url;
     }
     return null;
 }
コード例 #5
0
ファイル: Country.php プロジェクト: robjcordes/nexnewwp
 public static function getAll()
 {
     if (!empty(self::$_list)) {
         return self::$_list;
     }
     $file = "country_list.ini";
     $default = Wpjb_List_Path::getPath("app_config") . "/" . $file;
     $user = Wpjb_List_Path::getPath("user_config") . "/" . $file;
     if (is_file($user)) {
         self::$_list = Daq_Config::parseIni($user, null, true);
     } else {
         self::$_list = Daq_Config::parseIni($default, null, true);
     }
     return self::$_list;
 }
コード例 #6
0
ファイル: Seal.php プロジェクト: robjcordes/nexnewwp
 private static function _exists()
 {
     if (self::$_seal) {
         return true;
     }
     $file = Wpjb_List_Path::getPath("seal_file");
     if (file_exists($file)) {
         $contents = file_get_contents($file);
         self::$_seal = unserialize(base64_decode($contents));
     }
     if (is_array(self::$_seal) && count(self::$_seal) >= 4) {
         return true;
     }
     return false;
 }
コード例 #7
0
ファイル: Twitter.php プロジェクト: robjcordes/nexnewwp
 protected static function _send($msg)
 {
     $path = Wpjb_List_Path::getPath("vendor");
     require_once $path . "/TwitterOAuth/OAuth.php";
     require_once $path . "/TwitterOAuth/TwitterOAuth.php";
     //$user = Wpjb_Project::getInstance()->conf("api_twitter_username");
     //$pass = Wpjb_Project::getInstance()->conf("api_twitter_password");
     $ck = Wpjb_Project::getInstance()->conf("api_twitter_consumer_key");
     $cs = Wpjb_Project::getInstance()->conf("api_twitter_consumer_secret");
     $ot = Wpjb_Project::getInstance()->conf("api_twitter_oauth_token");
     $os = Wpjb_Project::getInstance()->conf("api_twitter_oauth_secret");
     $connection = new TwitterOAuth($ck, $cs, $ot, $os);
     $content = $connection->get('account/verify_credentials');
     if (isset($content->error)) {
         throw new Exception($content->error);
     }
     $connection->post('statuses/update', array('status' => $msg));
     return null;
 }
コード例 #8
0
ファイル: Application.php プロジェクト: robjcordes/nexnewwp
 public function getFiles()
 {
     $path = Wpjb_List_Path::getPath("apply_file");
     $path .= "/" . $this->id . "/";
     $files = glob($path . "*");
     if (!is_array($files)) {
         return array();
     }
     $fArr = array();
     foreach ($files as $file) {
         $f = new stdClass();
         $f->basename = basename($file);
         $f->url = rtrim(site_url(), "/") . "/wp-content/plugins/wpjobboard";
         $f->url .= Wpjb_List_Path::getRawPath("apply_file") . "/";
         $f->url .= $this->getId() . "/" . $f->basename;
         $f->size = filesize($file);
         $f->ext = pathinfo($file, PATHINFO_EXTENSION);
         $f->dir = $file;
         $fArr[] = $f;
     }
     return $fArr;
 }
コード例 #9
0
ファイル: Resume.php プロジェクト: robjcordes/nexnewwp
 public function save()
 {
     $image = null;
     if ($this->hasElement("image")) {
         $image = $this->getElement("image");
     }
     $file = null;
     if ($this->hasElement("file")) {
         $file = $this->getElement("file");
     }
     $valueList = $this->getValues();
     parent::save();
     $this->_saveAdditionalFields($valueList);
     if ($image && $image->fileSent()) {
         $image->setDestination(Wpjb_List_Path::getPath("resume_photo"));
         $image->upload("photo_" . $this->getObject()->getId() . "." . $image->getExt());
     }
     if ($file && $file->fileSent()) {
         $file->setDestination(Wpjb_List_Path::getPath("resume_photo"));
         $file->upload("file_" . $this->getObject()->getId() . "." . $file->getExt());
     }
     apply_filters("wpja_form_save_resume", $this);
     $this->reinit();
 }
コード例 #10
0
ファイル: Apply.php プロジェクト: robjcordes/nexnewwp
 protected function _saveFiles()
 {
     $file = array();
     $application = $this->getObject();
     if ($this->hasElement("resume_id")) {
         $resume_id = $this->getElement("resume_id")->getValue();
     }
     $name = $this->getElement("applicant_name")->getValue();
     $destination = Wpjb_List_Path::getPath("apply_file") . "/" . $application->id;
     if (!is_dir($destination)) {
         mkdir($destination);
     }
     foreach ($this->_getFiles() as $f) {
         if ($f->fileSent()) {
             /* @var $f Daq_Form_Element_File */
             $f->setDestination($destination);
             $this->_files[] = $f->upload();
         }
     }
     if (isset($resume_id) && is_numeric($resume_id)) {
         $filename = sanitize_file_name($name . ".html");
         $resume = new Wpjb_Model_Resume($resume_id);
         $rendered = $resume->renderHTML();
         file_put_contents($destination . "/" . $filename, $rendered);
         $this->_files[] = $destination . "/" . $filename;
     }
 }
コード例 #11
0
ファイル: Resume.php プロジェクト: robjcordes/nexnewwp
 public function getFilePath()
 {
     $path = Wpjb_List_Path::getPath("resume_photo");
     $path .= "/file_" . $this->getId() . ".*";
     $list = glob($path);
     if (!empty($list)) {
         return $list[0];
     } else {
         return null;
     }
 }
コード例 #12
0
ファイル: index.php プロジェクト: robjcordes/nexnewwp
<?php

$this->slot("title", __("Visual Editor", WPJB_DOMAIN));
$this->_include("header.php");
?>

<img src="<?php 
echo site_url() . "/wp-content/plugins/wpjobboard" . Wpjb_List_Path::getRawPath("admin_public");
?>
/char.png" alt="" style="float:left; margin-top:40px" />

<div class="wpjb_intro">

<h3><?php 
_e("About Visual Editor", WPJB_DOMAIN);
?>
</h3>

<span>
    <p>
    <?php 
_e("Visual Editor is a tool that will help you reorganize some forms in admin and frontend using intuitive drag&amp;drop interface.", WPJB_DOMAIN);
?>
    </p>

    <p style="margin-bottom:40px">
        <a class="button rbutton" href="<?php 
echo $this->_url->linkTo("wpjb/visualEditor", "edit/form/add");
?>
"><?php 
_e("Edit \"Add Job\" Form", WPJB_DOMAIN);
コード例 #13
0
ファイル: AddJob.php プロジェクト: robjcordes/nexnewwp
 public function saveAction()
 {
     if (!$this->_canPost()) {
         wp_redirect($this->_stepAdd);
     }
     $this->view->current_step = 3;
     $form = new Wpjb_Form_AddJob();
     $request = $this->getRequest();
     $id = $request->session("wpjb.job_id");
     if ($id < 1) {
         if ($form->isValid($request->session("wpjb.job", array()))) {
             $paymentMethod = $form->getElement("payment_method")->getValue();
             $form->save();
             $job = $form->getObject();
             if (strlen($request->session("wpjb.job_logo_ext")) > 0) {
                 $ext = $request->session("wpjb.job_logo_ext");
                 $path1 = Wpjb_List_Path::getPath("tmp_images");
                 $path2 = Wpjb_List_Path::getPath("user_images");
                 $oldName = $path1 . "/temp_" . session_id() . "." . $ext;
                 $newName = $path2 . "/job_" . $job->getId() . "." . $ext;
                 $job->company_logo_ext = $ext;
                 $job->save();
                 rename($oldName, $newName);
             }
             if ($job->payment_sum > 0) {
                 $uid = null;
                 if (wp_get_current_user()->ID > 0) {
                     $uid = wp_get_current_user()->ID;
                 }
                 $payment = new Wpjb_Model_Payment();
                 $payment->user_id = $uid;
                 $payment->object_id = $job->getId();
                 $payment->object_type = Wpjb_Model_Payment::FOR_JOB;
                 $payment->engine = $paymentMethod;
                 $payment->payment_currency = $job->payment_currency;
                 $payment->payment_sum = $job->payment_sum;
                 $payment->payment_paid = 0;
                 $payment->save();
             }
             $request->setSessionParam("wpjb.job", null);
             $request->setSessionParam("wpjb.job_logo_ext", null);
             $request->setSessionParam("wpjb.job_id", $job->getId());
         } else {
             wp_redirect(Wpjb_Project::getInstance()->getUrl() . "/" . $this->_getRouter()->linkTo("step_add"));
         }
     } else {
         $job = new Wpjb_Model_Job($id);
     }
     if ($job->payment_sum > 0) {
         if ($job->payment_sum != $job->payment_paid) {
             $action = "payment_form";
         } else {
             $action = "payment_already_sent";
         }
     } else {
         $action = "job_online";
         if ($job->is_active && $job->is_approved) {
             $online = true;
         } else {
             $online = false;
         }
         $this->view->online = $online;
     }
     if ($action == "payment_form") {
         $payment = Wpjb_Payment_Factory::factory($job->getPayment(true));
         $this->view->payment = $payment->render();
     }
     $this->view->action = $action;
     $this->view->job = $job;
 }
コード例 #14
0
ファイル: Company.php プロジェクト: robjcordes/nexnewwp
 public function save()
 {
     $file = $this->getElement("company_logo");
     parent::save();
     if ($file->fileSent()) {
         $file->setDestination(Wpjb_List_Path::getPath("company_logo"));
         $file->upload("logo_" . $this->getObject()->getId() . "." . $file->getExt());
     }
 }
コード例 #15
0
ファイル: intro.php プロジェクト: robjcordes/nexnewwp
<?php

$this->slot("title", "WPJobBoard Quick Start");
$this->_include("header.php");
?>

<img src="<?php 
echo get_bloginfo("url") . "/wp-content/plugins/wpjobboard" . Wpjb_List_Path::getRawPath("admin_public");
?>
/char.png" alt="" style="float:left; margin-top:40px" />

<div class="wpjb_intro">

<h3>Hi and welcome to WPJobBoard!</h3>

<span>
    <p>
    It seems you are running WPJB for the first time,
    this page is designed to guide you through most important features. You can always access
    quick start page by clicking "quick start" link in the footer.
    </p>

    <p style="margin-bottom:40px">
        <a class="button rbutton" href="">No thanks, i want to skip this quick start guide.</a>
    </p>
</span>

<h3>Become WPJobBoard Ninja Now!</h3>
<p>
    To take full advantage of WPJobBoard you need to learn where the most important features are
    and how to use them and this is what this tutorial is all about.
コード例 #16
0
ファイル: Employer.php プロジェクト: robjcordes/nexnewwp
 public function getImagePath()
 {
     if ($this->hasImage()) {
         $url = Wpjb_List_Path::getPath("company_logo");
         $url .= "/logo_" . $this->getId() . "." . $this->company_logo_ext;
         return $url;
     }
     return null;
 }
コード例 #17
0
ファイル: functions.php プロジェクト: robjcordes/nexnewwp
/**
 * FORM HELPERS
 */
function wpjb_form_helper_logo_upload(Daq_Form_Element $field, array $options = array())
{
    echo $options["tag"];
    $ext = Daq_Request::getInstance()->session("wpjb.job_logo_ext");
    if ($ext) {
        /// some special treatment
        $path = get_bloginfo("url") . "/wp-content/plugins/wpjobboard";
        $path .= Wpjb_List_Path::getRawPath("tmp_images") . "/temp_" . session_id() . "." . $ext;
        echo '<p class="wpjb-add-job-img"><img src="' . $path . '" alt="" /></p>';
    }
}