Example #1
0
 /**
  * bundles whole crop actions
  * checks for fetching data
  * and saving it into database
  * and also checks for crop action
  * and doing the crop
  */
 public static function cropOperation()
 {
     if (self::shouldFetchData()) {
         $ids = Input::get("gallery")['ids'];
         $ids = explode(",", $ids);
         self::$blogApiPosts = Api::useBlogApi($ids);
         ADb::update_crops_post_info_by_blogApi(self::$blogApiPosts);
         $images = array();
         foreach (self::$blogApiPosts as $post) {
             $images[] = $post->featured;
         }
         AFile::downloadAll(\Crop\Crop::$direction . "/images/", $images);
     }
     if (self::shouldCrop()) {
         $settings = Applum::find(1);
         $gallery = $settings->gallery;
         $images = self::gatherImagesForCrop(unserialize($gallery));
         self::cropAll($images);
     }
 }
 public static function shouldRegisterAUser()
 {
     if (Input::has("registerMeAUser")) {
         $registor = Registration::registorInstance();
         $user = $registor->register(Input::all());
         header('Content-Type: application/json');
         if (isset($user->error)) {
             echo json_encode(['status' => false]);
             die;
         }
         echo json_encode(['status' => true]);
         die;
     }
     return false;
 }
 public function check()
 {
     $validator = Validator::make(Input::all(), $this->rules, $this->messages);
     return $validator;
 }